merge latest (4.3.99.16) from XFree86 (vendor) branch

This commit is contained in:
Kaleb Keithley
2003-11-26 22:49:07 +00:00
parent c57959ad6a
commit 0097b6fe2d
796 changed files with 58012 additions and 26524 deletions

View File

@@ -27,9 +27,11 @@
*
* Authors: Harold L Hunt II
*/
/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.10 2001/10/30 15:39:09 alanh Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.11 2003/08/07 23:47:58 alanh Exp $ */
#include "win.h"
void
winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
#if 0
/* GC Handling Routines */
@@ -45,8 +47,8 @@ const GCFuncs winGCFuncs = {
#else
const GCFuncs winGCFuncs = {
winValidateGCNativeGDI,
winChangeGCNativeGDI,
winCopyGCNativeGDI,
miChangeGC,
miCopyGC,
winDestroyGCNativeGDI,
miChangeClip,
miDestroyClip,
@@ -73,9 +75,14 @@ const GCOps winGCOps = {
miPolyText16,
miImageText8,
miImageText16,
#if 0
winImageGlyphBltNativeGDI,
winPolyGlyphBltNativeGDI,
#else
miImageGlyphBlt,
miPolyGlyphBlt,
miPushPixels
#endif
winPushPixels
#ifdef NEED_LINEHELPER
,NULL
#endif
@@ -91,23 +98,21 @@ winCreateGCNativeGDI (GCPtr pGC)
winPrivGCPtr pGCPriv = NULL;
winPrivScreenPtr pScreenPriv = NULL;
ErrorF ("winCreateGCNativeGDI () depth: %d\n",
#if 0
ErrorF ("winCreateGCNativeGDI - depth: %d\n",
pGC->depth);
#endif
pGC->clientClip = NULL;
pGC->clientClipType = CT_NONE;
pGC->freeCompClip = FALSE;
pGC->pCompositeClip = 0;
pGC->ops = (GCOps *) &winGCOps;
pGC->funcs = (GCFuncs *) &winGCFuncs;
/*
* Setting miTranslate to 1 causes the coordinates passed to
* FillSpans, GetSpans, and SetSpans to be screen relative, rather
* than drawable relative.
*
* miTranslate was set to 0 prior to 2001-08-17.
*/
pGC->miTranslate = 1;
/* We want all coordinates passed to spans functions to be screen relative */
pGC->miTranslate = TRUE;
/* Allocate privates for this GC */
pGCPriv = winGetGCPriv (pGC);
@@ -117,9 +122,9 @@ winCreateGCNativeGDI (GCPtr pGC)
return FALSE;
}
/* Copy the screen DC to the local privates */
/* Create a new screen DC for the display window */
pScreenPriv = winGetScreenPriv (pGC->pScreen);
pGCPriv->hdc = pScreenPriv->hdcScreen;
pGCPriv->hdc = GetDC (pScreenPriv->hwndScreen);
/* Allocate a memory DC for the GC */
pGCPriv->hdcMem = CreateCompatibleDC (pGCPriv->hdc);
@@ -132,7 +137,7 @@ winCreateGCNativeGDI (GCPtr pGC)
void
winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges)
{
#if CYGDEBUG
#if 0
ErrorF ("winChangeGCNativeGDI () - Doing nothing\n");
#endif
}
@@ -143,225 +148,11 @@ winValidateGCNativeGDI (GCPtr pGC,
unsigned long ulChanges,
DrawablePtr pDrawable)
{
winGCPriv(pGC);
HBITMAP hbmpOrig = NULL;
PixmapPtr pPixmap = NULL;
winPrivPixmapPtr pPixmapPriv = NULL;
RGBQUAD rgbColors[2] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
PixmapPtr pStipple = NULL;
winPrivPixmapPtr pStipplePriv = NULL;
int i;
DEBUG_FN_NAME("winValidateGC");
DEBUGVARS;
DEBUGPROC_MSG;
/* Branch on drawable type */
switch (pDrawable->type)
{
case DRAWABLE_PIXMAP:
/* Branch on the fill style */
switch (pGC->fillStyle)
{
case FillSolid:
ErrorF ("winValidateGC - DRAWABLE_PIXMAP - FillSolid\n");
/* Select a stock pen */
if (pDrawable->depth == 1 && pGC->fgPixel)
{
ErrorF ("winValidateGC - Selecting WHITE_PEN\n");
SelectObject (pGCPriv->hdcMem, GetStockObject (WHITE_PEN));
}
else if (pDrawable->depth == 1 && !pGC->fgPixel)
{
ErrorF ("winValidateGC - Selecting BLACK_PEN\n");
SelectObject (pGCPriv->hdcMem, GetStockObject (BLACK_PEN));
}
else if (pGC->fgPixel)
{
ErrorF ("winValidateGC - Selecting custom pen: %d\n",
pGC->fgPixel);
/*
* FIXME: So far I've only seen a white pen selected here.
*/
#if 1
SelectObject (pGCPriv->hdcMem, GetStockObject (WHITE_PEN));
#else
/* FIXME: This leaks a pen */
SelectObject (pGCPriv->hdcMem,
CreatePen (PS_SOLID, 0, pGC->fgPixel));
#endif
}
else
{
ErrorF ("winValidateGC - Selecting BLACK_PEN\n");
SelectObject (pGCPriv->hdcMem, GetStockObject (BLACK_PEN));
}
break;
case FillStippled:
ErrorF ("winValidateGC - DRAWABLE_PIXMAP - FillStippled\n");
/*
* NOTE: Setting the brush color has no effect on DIB fills.
* You need to set the stipple bitmap's color table instead.
*/
#if 1
/* Pick the white color index */
if (pGC->fgPixel)
i = 1;
else
i = 0;
/* Set the white color, black is default */
rgbColors[i].rgbRed = 255;
rgbColors[i].rgbGreen = 255;
rgbColors[i].rgbBlue = 255;
/* Get stipple and privates pointers */
pStipple = pGC->stipple;
pStipplePriv = winGetPixmapPriv (pStipple);
/* Select the stipple bitmap */
hbmpOrig = SelectObject (pGCPriv->hdcMem, pStipplePriv->hBitmap);
/* Set the stipple color table */
SetDIBColorTable (pGCPriv->hdcMem, 0, 2, rgbColors);
/* Pop the stipple out of the hdc */
SelectObject (pGCPriv->hdcMem, hbmpOrig);
#else
/* Set the foreground color for the stipple fill */
if (pGC->fgPixel == 0x1)
{
SetTextColor (pGCPriv->hdcMem, RGB(0x00, 0x00, 0x00));
}
else if (pGC->fgPixel == 0xFFFF)
{
SetTextColor (pGCPriv->hdcMem, RGB(0xFF, 0xFF, 0xFF));
}
else
{
SetTextColor (pGCPriv->hdcMem, RGB(0x00, 0x00, 0x00));
}
SetBkColor (pGCPriv->hdcMem, RGB(0x00, 0x00, 0x00));
#endif
break;
case FillOpaqueStippled:
FatalError ("winValidateGC - DRAWABLE_PIXMAP - "
"FillOpaqueStippled\n");
break;
case FillTiled:
FatalError ("winValidateGC - DRAWABLE_PIXMAP - FillTiled\n");
break;
default:
FatalError ("winValidateGC - DRAWABLE_PIXMAP - Unknown fill "
"style\n");
break;
}
break;
case DRAWABLE_WINDOW:
/* Branch on the fill style */
switch (pGC->fillStyle)
{
case FillTiled:
ErrorF ("winValidateGC - DRAWABLE_WINDOW - FillTiled\n");
/*
* Do nothing here for now. Select the tile bitmap into the
* appropriate DC in the drawing function.
*/
/*
* BEGIN REMOVE - Visual verification only.
*/
/* Get pixmap and privates pointers for the tile */
pPixmap = pGC->tile.pixmap;
pPixmapPriv = winGetPixmapPriv (pPixmap);
/* Push the tile into the GC's DC */
hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap);
if (hbmpOrig == NULL)
FatalError ("winValidateGC - DRAWABLE_WINDOW - FillTiled - "
"SelectObject () failed on pPixmapPriv->hBitmap\n");
/* Blit the tile to a remote area of the screen */
BitBlt (pGCPriv->hdc,
64, 64,
pGC->tile.pixmap->drawable.width,
pGC->tile.pixmap->drawable.height,
pGCPriv->hdcMem,
0, 0,
SRCCOPY);
DEBUG_MSG ("Blitted the tile to a remote area of the screen");
/* Pop the tile out of the GC's DC */
SelectObject (pGCPriv->hdcMem, hbmpOrig);
/*
* END REMOVE - Visual verification only.
*/
break;
case FillStippled:
FatalError ("winValidateGC - DRAWABLE_WINDOW - FillStippled\n");
break;
case FillOpaqueStippled:
FatalError ("winValidateGC - DRAWABLE_WINDOW - "
"FillOpaqueStippled\n");
break;
case FillSolid:
ErrorF ("winValidateGC - DRAWABLE_WINDOW - FillSolid\n");
/* Select a stock pen */
if (pDrawable->depth == 1 && pGC->fgPixel)
{
ErrorF ("winValidateGC - Selecting WHITE_PEN\n");
SelectObject (pGCPriv->hdc, GetStockObject (WHITE_PEN));
}
else if (pDrawable->depth == 1 && !pGC->fgPixel)
{
ErrorF ("winValidateGC - Selecting BLACK_PEN\n");
SelectObject (pGCPriv->hdc, GetStockObject (BLACK_PEN));
}
else if (pGC->fgPixel)
{
ErrorF ("winValidateGC - Selecting custom pen: %d\n",
pGC->fgPixel);
/*
* FIXME: So far I've only seen a white pen selected here.
*/
SelectObject (pGCPriv->hdc, GetStockObject (WHITE_PEN));
}
else
{
ErrorF ("winValidateGC - Selecting BLACK_PEN\n");
SelectObject (pGCPriv->hdc, GetStockObject (BLACK_PEN));
}
break;
default:
FatalError ("winValidateGC - DRAWABLE_WINDOW - Unknown fill "
"style\n");
break;
}
break;
case UNDRAWABLE_WINDOW:
ErrorF ("\nwinValidateGC - UNDRAWABLE_WINDOW\n\n");
break;
case DRAWABLE_BUFFER:
FatalError ("winValidateGC - DRAWABLE_BUFFER\n");
break;
default:
FatalError ("winValidateGC - Unknown drawable type\n");
break;
}
if ((ulChanges & (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode))
|| (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
{
miComputeCompositeClip (pGC, pDrawable);
}
}
@@ -378,6 +169,10 @@ void
winDestroyGCNativeGDI (GCPtr pGC)
{
winGCPriv(pGC);
winScreenPriv(pGC->pScreen);
if (pGC->freeCompClip)
REGION_DESTROY (pGC->pScreen, pGC->pCompositeClip);
/* Free the memory DC */
if (pGCPriv->hdcMem != NULL)
@@ -386,8 +181,12 @@ winDestroyGCNativeGDI (GCPtr pGC)
pGCPriv->hdcMem = NULL;
}
/* Invalidate the screen DC pointer */
pGCPriv->hdc = NULL;
/* Release the screen DC for the display window */
if (pGCPriv->hdc != NULL)
{
ReleaseDC (pScreenPriv->hwndScreen, pGCPriv->hdc);
pGCPriv->hdc = NULL;
}
/* Invalidate the GC privates pointer */
winSetGCPriv (pGC, NULL);