File:  [WindowsNT SDKs] / ntddk / src / video / displays / vga256 / stretch.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 18:31:12 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: ntddk-nov-1993, HEAD
Microsoft Windows NT Build 511 (DDK SDK) 11-01-1993


/******************************Module*Header*******************************\
* Module Name: stretch.c
*
* DrvStretchBlt
*
* Copyright (c) 1993 Microsoft Corporation
\**************************************************************************/

#include "driver.h"

//@@@ This should become a VOID when all cases are handled in the stretching
//@@@ code, and should go in driver.h
INT vStretchBlt8bpp(PPDEV ppdev, PBYTE pSrc, LONG lSrcNext,
                    PRECTL prclSrc, PRECTL prclDest, PRECTL prclDestClip,
                    PULONG pulXlatVector);

BOOL DrvStretchBlt(
SURFOBJ         *psoDest,
SURFOBJ         *psoSrc,
SURFOBJ         *psoMask,
CLIPOBJ         *pco,
XLATEOBJ        *pxlo,
COLORADJUSTMENT *pca,
POINTL          *pptlBrushOrg,
RECTL           *prclDest,
RECTL           *prclSrc,
POINTL          *pptlMask,
ULONG            iMode)
{
    PPDEV  ppdev = (PPDEV) psoDest->dhpdev;
    PULONG pulXlatVector;
    INT    iClipping;

    // Handle only cases where the source is a DIB and the destination is
    // the VGA surface (which is always the case here if the source is a
    // DIB). Also, halftoning and masking aren't handled by the special-case
    // code. We only handle the case where a single source pixel is mapped onto
    // each destination pixel
    if ((iMode == COLORONCOLOR) &&
        (psoSrc->iType == STYPE_BITMAP) &&
        (psoMask == NULL)) {

        // We don't special case X or Y inversion for now
        if ((prclDest->left < prclDest->right) &&
            (prclDest->top < prclDest->bottom)) {

            // We don't special-case cases where the source has to be clipped
            // to the source bitmap extent
            if ((prclSrc->left >= 0) &&
                (prclSrc->top >= 0)  &&
                (prclSrc->right <= psoSrc->sizlBitmap.cx) &&
                (prclSrc->bottom <= psoSrc->sizlBitmap.cy)) {

                // Set up the clipping type
                if (pco == (CLIPOBJ *) NULL) {
                    // No CLIPOBJ provided, so we don't have to worry about
                    // clipping
                    iClipping = DC_TRIVIAL;
                } else {
                    // Use the CLIPOBJ-provided clipping
                    iClipping = pco->iDComplexity;
                }

                // We don't special-case clipping for now
                if (iClipping != DC_COMPLEX) {

                    switch(psoSrc->iBitmapFormat) {
                        case BMF_1BPP:
                            break;

                        case BMF_4BPP:
                            break;

                        case BMF_8BPP:

                            // Set up the color translation, if any
                            if ((pxlo == NULL) ||
                                    (pxlo->flXlate & XO_TRIVIAL)) {
                                pulXlatVector = NULL;
                            } else {
                                if (pxlo->pulXlate != NULL) {
                                    pulXlatVector = pxlo->pulXlate;
                                } else {
                                    if ((pulXlatVector =
                                            XLATEOBJ_piVector(pxlo)) == NULL) {
                                        return FALSE;
                                    }
                                }
                            }

                            //@@@ won't need to test return code once both
                            //@@@ expand cases are also handled in the
                            //@@@ stretching code
                            if (vStretchBlt8bpp(ppdev,
                                    psoSrc->pvScan0,
                                    psoSrc->lDelta,
                                    prclSrc,
                                    prclDest,
                                    (iClipping == DC_TRIVIAL) ? NULL :
                                     &pco->rclBounds,
                                    pulXlatVector)) {

                                return TRUE;
                            }
                            break;

                        case BMF_16BPP:
                            break;

                        case BMF_24BPP:
                            break;

                        case BMF_32BPP:
                            break;

                        default:
                            break;
                    }
                }
            }
        }
    }

    return(EngStretchBlt(psoDest,
                         psoSrc,
                         psoMask,
                         pco,
                         pxlo,
                         pca,
                         pptlBrushOrg,
                         prclDest,
                         prclSrc,
                         pptlMask,
                         iMode));
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.