merge latest (4.3.99.16) from XFree86 (vendor) branch
This commit is contained in:
@@ -26,8 +26,9 @@
|
||||
*from the XFree86 Project.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
* Alan Hourihane <alanh@fairlite.demon.co.uk>
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/wingetsp.c,v 1.7 2001/11/01 12:19:40 alanh Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/wingetsp.c,v 1.8 2003/08/07 23:47:58 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
@@ -46,107 +47,132 @@ winGetSpansNativeGDI (DrawablePtr pDrawable,
|
||||
DDXPointPtr pPoint = NULL;
|
||||
int *piWidth = NULL;
|
||||
char *pDst = pDsts;
|
||||
int iBytesToCopy;
|
||||
HBITMAP hbmpWindow, hbmpOrig;
|
||||
HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1;
|
||||
BYTE *pbWindow = NULL;
|
||||
HDC hdcMem;
|
||||
HDC hdcMem, hdcMem1;
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
winScreenPriv(pScreen);
|
||||
int iByteWidth;
|
||||
|
||||
/* Branch on the drawable type */
|
||||
switch (pDrawable->type)
|
||||
{
|
||||
case DRAWABLE_PIXMAP:
|
||||
#if 0
|
||||
ErrorF ("winGetSpans - DRAWABLE_PIXMAP %08x\n",
|
||||
pDrawable);
|
||||
#endif
|
||||
|
||||
pPixmap = (PixmapPtr) pDrawable;
|
||||
pPixmapPriv = winGetPixmapPriv (pPixmap);
|
||||
|
||||
/* Open a memory HDC */
|
||||
hdcMem1 = CreateCompatibleDC (NULL);
|
||||
hdcMem = CreateCompatibleDC (NULL);
|
||||
|
||||
/* Select the drawable pixmap into a DC */
|
||||
hbmpOrig1 = SelectObject (hdcMem1, pPixmapPriv->hBitmap);
|
||||
|
||||
if (hbmpOrig1 == NULL)
|
||||
FatalError ("winGetSpans - DRAWABLE_PIXMAP - SelectObject () "
|
||||
"failed on pPixmapPriv->hBitmap\n");
|
||||
|
||||
/* Loop through spans */
|
||||
for (iSpan = 0; iSpan < iSpans; ++iSpan)
|
||||
{
|
||||
pPoint = pPoints + iSpan;
|
||||
piWidth = piWidths + iSpan;
|
||||
|
||||
iBytesToCopy = PixmapBytePad (*piWidth, pDrawable->depth);
|
||||
|
||||
hbmpWindow = winCreateDIBNativeGDI (*piWidth, 1,
|
||||
pDrawable->depth,
|
||||
&pbWindow,
|
||||
NULL);
|
||||
|
||||
hbmpOrig = SelectObject (hdcMem, hbmpWindow);
|
||||
|
||||
/* Transfer the window bits to the window bitmap */
|
||||
BitBlt (hdcMem,
|
||||
0, 0,
|
||||
*piWidth, 1,
|
||||
hdcMem1,
|
||||
pPoint->x, pPoint->y,
|
||||
SRCCOPY);
|
||||
|
||||
memcpy (pDst,
|
||||
pPixmapPriv->pbBits
|
||||
+ pPixmapPriv->dwScanlineBytes * pPoint->y,
|
||||
iBytesToCopy);
|
||||
(char*) pbWindow,
|
||||
PixmapBytePad (*piWidth, pDrawable->depth));
|
||||
|
||||
/* Pop the window bitmap out of the HDC and delete the bitmap */
|
||||
SelectObject (hdcMem, hbmpOrig);
|
||||
DeleteObject (hbmpWindow);
|
||||
|
||||
#if 0
|
||||
ErrorF ("(%dx%dx%d) (%d,%d) w: %d\n",
|
||||
pDrawable->width, pDrawable->height, pDrawable->depth,
|
||||
pPoint->x, pPoint->y, *piWidth);
|
||||
#endif
|
||||
|
||||
/* Calculate offset of next bit destination */
|
||||
pDst += 4 * ((*piWidth + 31) / 32);
|
||||
pDst += PixmapBytePad (*piWidth, pDrawable->depth);
|
||||
}
|
||||
|
||||
/* Pop the pixmap's bitmap out of the HDC */
|
||||
SelectObject (hdcMem1, hbmpOrig1);
|
||||
|
||||
/* Delete the HDCs */
|
||||
DeleteDC (hdcMem1);
|
||||
DeleteDC (hdcMem);
|
||||
break;
|
||||
|
||||
case DRAWABLE_WINDOW:
|
||||
#if 0
|
||||
ErrorF ("winGetSpans - DRAWABLE_WINDOW\n");
|
||||
|
||||
/*
|
||||
* FIXME: Making huge assumption here that we are copying the
|
||||
* area behind where the cursor will be displayed. We already
|
||||
* know the size of the cursor, so this works, for now.
|
||||
*/
|
||||
|
||||
/* Create a bitmap to blit the window data to */
|
||||
hbmpWindow = winCreateDIBNativeGDI (*piWidths,
|
||||
*piWidths,
|
||||
pDrawable->depth,
|
||||
&pbWindow,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
/* Open a memory HDC */
|
||||
hdcMem = CreateCompatibleDC (NULL);
|
||||
|
||||
/* Select the window bitmap */
|
||||
hbmpOrig = SelectObject (hdcMem, hbmpWindow);
|
||||
|
||||
/* Transfer the window bits to the window bitmap */
|
||||
BitBlt (hdcMem,
|
||||
0, 0,
|
||||
*piWidths, *piWidths, /* FIXME: Assuming square region */
|
||||
pScreenPriv->hdcScreen,
|
||||
pPoints->x, pPoints->y,
|
||||
SRCCOPY);
|
||||
|
||||
/* Pop the window bitmap out of the HDC */
|
||||
SelectObject (hdcMem, hbmpOrig);
|
||||
|
||||
/* Delete the memory HDC */
|
||||
DeleteDC (hdcMem);
|
||||
hdcMem = NULL;
|
||||
|
||||
iByteWidth = PixmapBytePad (*piWidths, pDrawable->depth);
|
||||
|
||||
/* Loop through spans */
|
||||
for (iSpan = 0; iSpan < iSpans; ++iSpan)
|
||||
{
|
||||
pPoint = pPoints + iSpan;
|
||||
piWidth = piWidths + iSpan;
|
||||
|
||||
iBytesToCopy = PixmapBytePad (*piWidth, pDrawable->depth);
|
||||
hbmpWindow = winCreateDIBNativeGDI (*piWidth, 1,
|
||||
pDrawable->depth,
|
||||
&pbWindow,
|
||||
NULL);
|
||||
|
||||
hbmpOrig = SelectObject (hdcMem, hbmpWindow);
|
||||
|
||||
/* Transfer the window bits to the window bitmap */
|
||||
BitBlt (hdcMem,
|
||||
0, 0,
|
||||
*piWidth, 1,
|
||||
pScreenPriv->hdcScreen,
|
||||
pPoint->x, pPoint->y,
|
||||
SRCCOPY);
|
||||
|
||||
memcpy (pDst,
|
||||
pbWindow + iByteWidth * (pPoint->y - pPoints->y),
|
||||
iBytesToCopy);
|
||||
|
||||
(char*) pbWindow,
|
||||
PixmapBytePad (*piWidth, pDrawable->depth));
|
||||
|
||||
/* Pop the window bitmap out of the HDC */
|
||||
SelectObject (hdcMem, hbmpOrig);
|
||||
|
||||
DeleteObject (hbmpWindow);
|
||||
|
||||
#if 0
|
||||
ErrorF ("(%dx%dx%d) (%d,%d) w: %d\n",
|
||||
pDrawable->width, pDrawable->height, pDrawable->depth,
|
||||
pPoint->x, pPoint->y, *piWidth);
|
||||
#endif
|
||||
|
||||
/* Calculate offset of next bit destination */
|
||||
pDst += 4 * ((*piWidth + 31) / 32);
|
||||
pDst += PixmapBytePad (*piWidth, pDrawable->depth);
|
||||
}
|
||||
|
||||
/* Delete the window bitmap */
|
||||
DeleteObject (hbmpWindow);
|
||||
DeleteDC (hdcMem);
|
||||
break;
|
||||
|
||||
case UNDRAWABLE_WINDOW:
|
||||
|
||||
Reference in New Issue
Block a user