diff --git a/configure.ac b/configure.ac index 30c0c5cd9..a12e9e286 100644 --- a/configure.ac +++ b/configure.ac @@ -2206,7 +2206,6 @@ AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes]) AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$AIGLX" = xyes]) -AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes]) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 88bc85a44..96e100604 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -737,9 +737,6 @@ winUseMsg(void) "\t\t4 - Shadow DirectDraw4 Non-Locking\n" #ifdef XWIN_PRIMARYFB "\t\t8 - Primary DirectDraw - obsolete\n" -#endif -#ifdef XWIN_NATIVEGDI - "\t\t16 - Native GDI - experimental\n" #endif ); diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am index 2c7fde313..dea55b4c4 100644 --- a/hw/xwin/Makefile.am +++ b/hw/xwin/Makefile.am @@ -37,21 +37,6 @@ DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la endif -if XWIN_NATIVEGDI -SRCS_NATIVEGDI = \ - winclip.c \ - winfillsp.c \ - winfont.c \ - wingc.c \ - wingetsp.c \ - winnativegdi.c \ - winpixmap.c \ - winpolyline.c \ - winrop.c \ - winsetsp.c -DEFS_NATIVEGDI = -DXWIN_NATIVEGDI -endif - if XWIN_PRIMARYFB SRCS_PRIMARYFB = \ winpfbdd.c diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index c71f6a154..f3eca1e0b 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -263,8 +263,6 @@ Shadow DirectDraw Shadow DirectDraw Non-Locking .IP 8 4 Primary DirectDraw (unsupported, obsolete) -.IP 16 4 -Native GDI (unsupported, experimental and barely functional) .RE .SH FULLSCREEN OPTIONS diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 7af35e71b..6b3e42a1a 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -106,9 +106,6 @@ #ifdef XWIN_PRIMARYFB #define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ #endif -#ifdef XWIN_NATIVEGDI -#define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */ -#endif #define AltMapIndex Mod1MapIndex #define NumLockMapIndex Mod2MapIndex @@ -304,12 +301,6 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr) (WindowPtr pWin); typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr); -#ifdef XWIN_NATIVEGDI -/* Typedefs for native GDI wrappers */ -typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont); -typedef Bool (*UnrealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont); -#endif - /* * GC (graphics context) privates */ @@ -582,12 +573,6 @@ typedef struct _winPrivScreenRec { SetShapeProcPtr SetShape; winCursorRec cursor; - -#ifdef XWIN_NATIVEGDI - RealizeFontPtr RealizeFont; - UnrealizeFontPtr UnrealizeFont; -#endif - } winPrivScreenRec; #ifdef XWIN_MULTIWINDOWEXTWM @@ -775,15 +760,6 @@ void winBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadMask); -#ifdef XWIN_NATIVEGDI -/* - * winclip.c - */ - -RegionPtr - winPixmapToRegionNativeGDI(PixmapPtr pPix); -#endif - #ifdef XWIN_CLIPBOARD /* * winclipboardinit.c @@ -859,52 +835,6 @@ void winMessageBoxF(const char *pszError, UINT uType, ...) _X_ATTRIBUTE_PRINTF(1, 3); -#ifdef XWIN_NATIVEGDI -/* - * winfillsp.c - */ - -void - -winFillSpansNativeGDI(DrawablePtr pDrawable, - GCPtr pGC, - int nSpans, - DDXPointPtr pPoints, int *pWidths, int fSorted); -#endif - -#ifdef XWIN_NATIVEGDI -/* - * winfont.c - */ - -Bool - winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont); - -Bool - winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont); -#endif - -#ifdef XWIN_NATIVEGDI -/* - * wingc.c - */ - -Bool - winCreateGCNativeGDI(GCPtr pGC); -#endif - -#ifdef XWIN_NATIVEGDI -/* - * wingetsp.c - */ - -void - -winGetSpansNativeGDI(DrawablePtr pDrawable, - int wMax, - DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst); -#endif - /* * winglobals.c */ @@ -956,23 +886,12 @@ void * winmisc.c */ -#ifdef XWIN_NATIVEGDI -void - -winQueryBestSizeNativeGDI(int class, unsigned short *pWidth, - unsigned short *pHeight, ScreenPtr pScreen); -#endif - CARD8 winCountBits(DWORD dw); Bool winUpdateFBPointer(ScreenPtr pScreen, void *pbits); -#ifdef XWIN_NATIVEGDI -BOOL winPaintBackground(HWND hwnd, COLORREF colorref); -#endif - /* * winmouse.c */ @@ -994,19 +913,6 @@ winMouseButtonsHandle(ScreenPtr pScreen, void winEnqueueMotion(int x, int y); -#ifdef XWIN_NATIVEGDI -/* - * winnativegdi.c - */ - -HBITMAP -winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth, - BYTE ** ppbBits, BITMAPINFO ** ppbmi); - -Bool - winSetEngineFunctionsNativeGDI(ScreenPtr pScreen); -#endif - #ifdef XWIN_PRIMARYFB /* * winpfbddd.c @@ -1016,38 +922,6 @@ Bool winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen); #endif -#ifdef XWIN_NATIVEGDI -/* - * winpixmap.c - */ - -PixmapPtr - -winCreatePixmapNativeGDI(ScreenPtr pScreen, int width, int height, int depth, - unsigned usage_hint); - -Bool - winDestroyPixmapNativeGDI(PixmapPtr pPixmap); - -Bool - -winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap, - int iWidth, int iHeight, - int iDepth, - int iBitsPerPixel, - int devKind, void *pPixData); -#endif - -#ifdef XWIN_NATIVEGDI -/* - * winpolyline.c - */ - -void - -winPolyLineNativeGDI(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr ppt); -#endif /* * winscrinit.c */ @@ -1058,26 +932,6 @@ Bool Bool winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv); -#if defined(XWIN_NATIVEGDI) -Bool - -winFinishScreenInitNativeGDI(int i, - ScreenPtr pScreen, int argc, char **argv); -#endif - -#ifdef XWIN_NATIVEGDI -/* - * winsetsp.c - */ - -void - -winSetSpansNativeGDI(DrawablePtr pDrawable, - GCPtr pGC, - char *pSrc, - DDXPointPtr pPoints, int *pWidth, int nSpans, int fSorted); -#endif - /* * winshaddd.c */ @@ -1112,30 +966,6 @@ winWakeupHandler(ScreenPtr pScreen, * winwindow.c */ -#ifdef XWIN_NATIVEGDI -Bool - winCreateWindowNativeGDI(WindowPtr pWin); - -Bool - winDestroyWindowNativeGDI(WindowPtr pWin); - -Bool - winPositionWindowNativeGDI(WindowPtr pWin, int x, int y); - -void - -winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); - -Bool - winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask); - -Bool - winUnmapWindowNativeGDI(WindowPtr pWindow); - -Bool - winMapWindowNativeGDI(WindowPtr pWindow); -#endif - Bool winCreateWindowRootless(WindowPtr pWindow); diff --git a/hw/xwin/winclip.c b/hw/xwin/winclip.c deleted file mode 100644 index 941e9483a..000000000 --- a/hw/xwin/winclip.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* Look at mfb/mfbclip.c for sample implementation */ -RegionPtr -winPixmapToRegionNativeGDI(PixmapPtr pPix) -{ - ErrorF("winPixmapToRegion()\n"); - return NULL; -} diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index 6732dcb58..9f7201620 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -110,20 +110,8 @@ winCreateBoundingWindowFullScreen(ScreenPtr pScreen) GetModuleHandle(NULL), /* Instance handle */ pScreenPriv); /* ScreenPrivates */ - /* Branch on the server engine */ - switch (pScreenInfo->dwEngine) { -#ifdef XWIN_NATIVEGDI - case WIN_SERVER_SHADOW_GDI: - /* Show the window */ - ShowWindow(*phwnd, SW_SHOWMAXIMIZED); - break; -#endif - - default: - /* Hide the window */ - ShowWindow(*phwnd, SW_SHOWNORMAL); - break; - } + /* Hide the window */ + ShowWindow(*phwnd, SW_SHOWNORMAL); /* Send first paint message */ UpdateWindow(*phwnd); @@ -474,12 +462,6 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen) } } -#ifdef XWIN_NATIVEGDI - /* Paint window background blue */ - if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI) - winPaintBackground(*phwnd, RGB(0x00, 0x00, 0xFF)); -#endif - winDebug("winCreateBoundingWindowWindowed - Returning\n"); return TRUE; diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c index 1f55ada58..8aa90514c 100644 --- a/hw/xwin/winengine.c +++ b/hw/xwin/winengine.c @@ -59,10 +59,6 @@ winDetectSupportedEngines(void) /* Initialize the engine support flags */ g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI; -#ifdef XWIN_NATIVEGDI - g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI; -#endif - /* Get operating system version information */ ZeroMemory(&osvi, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(osvi); @@ -210,11 +206,6 @@ winSetEngine(ScreenPtr pScreen) case WIN_SERVER_PRIMARY_DD: winSetEngineFunctionsPrimaryDD(pScreen); break; -#endif -#ifdef XWIN_NATIVEGDI - case WIN_SERVER_NATIVE_GDI: - winSetEngineFunctionsNativeGDI(pScreen); - break; #endif default: FatalError("winSetEngine - Invalid engine type\n"); diff --git a/hw/xwin/winfillsp.c b/hw/xwin/winfillsp.c deleted file mode 100644 index bd0a15e8a..000000000 --- a/hw/xwin/winfillsp.c +++ /dev/null @@ -1,842 +0,0 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of the XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Harold L Hunt II - * Alan Hourihane - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -extern void ROP16(HDC hdc, int rop); - -#define TRANSLATE_COLOR(color) \ -{ \ - if (pDrawable->depth == 15) \ - color = ((color & 0x1F) << 19) | ((color & 0x03E0) << 6) | \ - ((color & 0xF800) >> 8); \ - else if (pDrawable->depth == 16) \ - color = ((color & 0x1F) << 19) | ((color & 0x07E0) << 5) | \ - ((color & 0xF800) >> 8); \ - else if (pDrawable->depth == 24 || pDrawable->depth == 32) \ - color = ((color & 0xFF) << 16) | (color & 0xFF00) | \ - ((color & 0xFF0000) >> 16); \ -} - -/* See Porting Layer Definition - p. 54 */ -void -winFillSpansNativeGDI(DrawablePtr pDrawable, - GCPtr pGC, - int iSpans, - DDXPointPtr pPoints, int *piWidths, int fSorted) -{ - winGCPriv(pGC); - HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL; - HBITMAP hPenOrig = NULL; - HBITMAP hBitmap = NULL; - PixmapPtr pPixmap = NULL; - winPrivPixmapPtr pPixmapPriv = NULL; - PixmapPtr pStipple = NULL; - winPrivPixmapPtr pStipplePriv = NULL; - PixmapPtr pTile = NULL; - winPrivPixmapPtr pTilePriv = NULL; - HDC hdcStipple = NULL, hdcTile = NULL; - HPEN hPen = NULL; - int iX; - int fg, bg; - RegionPtr pClip = pGC->pCompositeClip; - BoxPtr pextent, pbox; - int nbox; - int extentX1, extentX2, extentY1, extentY2; - int fullX1, fullX2, fullY1; - HRGN hrgn = NULL, combined = NULL; - - nbox = RegionNumRects(pClip); - pbox = RegionRects(pClip); - - if (!nbox) - return; - - combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2); - nbox--; - pbox++; - - while (nbox--) { - hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2); - CombineRgn(combined, combined, hrgn, RGN_OR); - DeleteObject(hrgn); - hrgn = NULL; - pbox++; - } - - pextent = RegionExtents(pClip); - extentX1 = pextent->x1; - extentY1 = pextent->y1; - extentX2 = pextent->x2; - extentY2 = pextent->y2; - - /* Branch on the type of drawable we have */ - switch (pDrawable->type) { - case DRAWABLE_PIXMAP: - - SelectClipRgn(pGCPriv->hdcMem, combined); - DeleteObject(combined); - combined = NULL; - - /* Get a pixmap pointer from the drawable pointer, and fetch privates */ - pPixmap = (PixmapPtr) pDrawable; - pPixmapPriv = winGetPixmapPriv(pPixmap); - - /* Select the drawable pixmap into memory hdc */ - hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap); - if (hbmpOrig == NULL) - FatalError("winFillSpans - DRAWABLE_PIXMAP - " - "SelectObject () failed on\n\tpPixmapPriv->hBitmap: " - "%p\n", pPixmapPriv->hBitmap); - - /* Branch on the fill type */ - switch (pGC->fillStyle) { - case FillSolid: - - ROP16(pGCPriv->hdcMem, pGC->alu); - - if (pDrawable->depth == 1) { - if (pGC->fgPixel == 0) - hPenOrig = SelectObject(pGCPriv->hdcMem, - GetStockObject(BLACK_PEN)); - else - hPenOrig = SelectObject(pGCPriv->hdcMem, - GetStockObject(WHITE_PEN)); - } - else { - fg = pGC->fgPixel; - TRANSLATE_COLOR(fg); - hPen = CreatePen(PS_SOLID, 0, fg); - hPenOrig = SelectObject(pGCPriv->hdcMem, hPen); - } - - while (iSpans--) { - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - MoveToEx(pGCPriv->hdcMem, fullX1, fullY1, NULL); - LineTo(pGCPriv->hdcMem, fullX2, fullY1); - } - - SetROP2(pGCPriv->hdcMem, R2_COPYPEN); - - /* Give back the Pen */ - SelectObject(pGCPriv->hdcMem, hPenOrig); - - if (pDrawable->depth != 1) - DeleteObject(hPen); - break; - - case FillOpaqueStippled: - - pStipple = pGC->stipple; - pStipplePriv = winGetPixmapPriv(pStipple); - - /* Create a device-dependent bitmap for the stipple */ - hBitmap = CreateDIBitmap(pGCPriv->hdcMem, - (BITMAPINFOHEADER *) pStipplePriv->pbmih, - CBM_INIT, - pStipplePriv->pbBits, - (BITMAPINFO *) pStipplePriv->pbmih, - DIB_RGB_COLORS); - - /* Create a memory DC to hold the stipple */ - hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem); - - /* Select the stipple bitmap into the stipple DC */ - hbmpOrigStipple = SelectObject(hdcStipple, hBitmap); - if (hbmpOrigStipple == NULL) - FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - " - "SelectObject () failed on hbmpOrigStipple\n"); - - /* Make a temporary copy of the foreground and background colors */ - bg = pGC->bgPixel; - fg = pGC->fgPixel; - - /* Translate the depth-dependent colors to Win32 COLORREFs */ - TRANSLATE_COLOR(fg); - TRANSLATE_COLOR(bg); - SetTextColor(pGCPriv->hdcMem, fg); - SetBkColor(pGCPriv->hdcMem, bg); - - while (iSpans--) { - int width = pStipple->drawable.width; - - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - for (iX = fullX1; iX < fullX2; iX += width) { - int xoffset; - - if ((iX + pStipple->drawable.width) > fullX2) - width = fullX2 - iX; - else - width = pStipple->drawable.width; - - if (iX == fullX1) - xoffset = - (fullX1 - - (pDrawable->x + - (pGC->patOrg.x % pStipple->drawable.width) - - pStipple->drawable.width)) % - pStipple->drawable.width; - else - xoffset = 0; - - if (xoffset + width > pStipple->drawable.width) - width = pStipple->drawable.width - xoffset; - - BitBlt(pGCPriv->hdcMem, - iX, fullY1, - width, 1, - hdcStipple, - xoffset, - (fullY1 - - (pDrawable->y + - (pGC->patOrg.y % pStipple->drawable.height) - - pStipple->drawable.height)) % - pStipple->drawable.height, g_copyROP[pGC->alu]); - } - } - - /* Clear the stipple HDC */ - SelectObject(hdcStipple, hbmpOrigStipple); - DeleteDC(hdcStipple); - - /* Delete the device dependent stipple bitmap */ - DeleteObject(hBitmap); - - break; - case FillStippled: - - pStipple = pGC->stipple; - pStipplePriv = winGetPixmapPriv(pStipple); - - /* Create a device-dependent bitmap for the stipple */ - hBitmap = CreateDIBitmap(pGCPriv->hdcMem, - (BITMAPINFOHEADER *) pStipplePriv->pbmih, - CBM_INIT, - pStipplePriv->pbBits, - (BITMAPINFO *) pStipplePriv->pbmih, - DIB_RGB_COLORS); - - /* Create a memory DC to hold the stipple */ - hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem); - - /* Select the stipple bitmap into the stipple DC */ - hbmpOrigStipple = SelectObject(hdcStipple, hBitmap); - if (hbmpOrigStipple == NULL) - FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - " - "SelectObject () failed on hbmpOrigStipple\n"); - - /* Make a temporary copy of the foreground and background colors */ - bg = pGC->bgPixel; - fg = pGC->fgPixel; - - /* Translate the depth-dependent colors to Win32 COLORREFs */ - TRANSLATE_COLOR(fg); - TRANSLATE_COLOR(bg); - - /* this is fudgy, we should only invert on the last one - * We need to get the black/white pixels right in the - * colormap. But yeah ! it's working.. - */ - if (pGC->bgPixel != -1 && pGC->fgPixel != -1) { - SetTextColor(pGCPriv->hdcMem, fg); - SetBkColor(pGCPriv->hdcMem, bg); - BitBlt(hdcStipple, - 0, 0, - pStipple->drawable.width, pStipple->drawable.height, - hdcStipple, 0, 0, 0x330008); - } - else if (pGC->bgPixel == -1) { - SetTextColor(pGCPriv->hdcMem, fg); - SetBkMode(pGCPriv->hdcMem, TRANSPARENT); - BitBlt(hdcStipple, - 0, 0, - pStipple->drawable.width, pStipple->drawable.height, - hdcStipple, 0, 0, 0x330008); - } - else if (pGC->fgPixel == -1) { - SetTextColor(pGCPriv->hdcMem, bg); - SetBkMode(pGCPriv->hdcMem, TRANSPARENT); -#if 0 - BitBlt(hdcStipple, - 0, 0, - pStipple->drawable.width, pStipple->drawable.height, - hdcStipple, 0, 0, 0x330008); -#endif - } - - while (iSpans--) { - int width = pStipple->drawable.width; - - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - for (iX = fullX1; iX < fullX2; iX += width) { - int xoffset; - - if ((iX + pStipple->drawable.width) > fullX2) - width = fullX2 - iX; - else - width = pStipple->drawable.width; - - if (iX == fullX1) - xoffset = - (fullX1 - - (pDrawable->x + - (pGC->patOrg.x % pStipple->drawable.width) - - pStipple->drawable.width)) % - pStipple->drawable.width; - else - xoffset = 0; - - if (xoffset + width > pStipple->drawable.width) - width = pStipple->drawable.width - xoffset; - - BitBlt(pGCPriv->hdcMem, - iX, fullY1, - width, 1, - hdcStipple, - xoffset, - (fullY1 - - (pDrawable->y + - (pGC->patOrg.y % pStipple->drawable.height) - - pStipple->drawable.height)) % - pStipple->drawable.height, g_copyROP[pGC->alu]); - } - } - - /* Clear the stipple HDC */ - SelectObject(hdcStipple, hbmpOrigStipple); - DeleteDC(hdcStipple); - - /* Delete the device dependent stipple bitmap */ - DeleteObject(hBitmap); - - /* Restore the background mode */ - SetBkMode(pGCPriv->hdcMem, OPAQUE); - break; - - case FillTiled: - - /* Get a pixmap pointer from the tile pointer, and fetch privates */ - pTile = (PixmapPtr) pGC->tile.pixmap; - pTilePriv = winGetPixmapPriv(pTile); - - /* Create a memory DC to hold the tile */ - hdcTile = CreateCompatibleDC(pGCPriv->hdcMem); - - /* Select the tile into a DC */ - hbmpOrig = SelectObject(hdcTile, pTilePriv->hBitmap); - if (hbmpOrig == NULL) - FatalError("winFillSpans - DRAWABLE_PIXMAP - FillTiled - " - "SelectObject () failed on pTilePriv->hBitmap\n"); - - while (iSpans--) { - int width = pTile->drawable.width; - - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - for (iX = fullX1; iX < fullX2; iX += width) { - int xoffset; - - if ((iX + pTile->drawable.width) > fullX2) - width = fullX2 - iX; - else - width = pTile->drawable.width; - - if (iX == fullX1) - xoffset = - (fullX1 - - (pDrawable->x + - (pGC->patOrg.x % pTile->drawable.width) - - pTile->drawable.width)) % pTile->drawable.width; - else - xoffset = 0; - - if (xoffset + width > pTile->drawable.width) - width = pTile->drawable.width - xoffset; - - BitBlt(pGCPriv->hdcMem, - iX, fullY1, - width, 1, - hdcTile, - xoffset, - (fullY1 - - (pDrawable->y + - (pGC->patOrg.y % pTile->drawable.height) - - pTile->drawable.height)) % pTile->drawable.height, - g_copyROP[pGC->alu]); - } - } - - /* Push the tile pixmap out of the memory HDC */ - SelectObject(hdcTile, hbmpOrig); - - /* Delete the tile */ - DeleteDC(hdcTile); - break; - - default: - ErrorF("winFillSpans - DRAWABLE_PIXMAP - Unknown fillStyle\n"); - break; - } - - /* Reset clip region */ - SelectClipRgn(pGCPriv->hdcMem, NULL); - - /* Push the drawable pixmap out of the GC HDC */ - SelectObject(pGCPriv->hdcMem, hbmpOrig); - break; - - case DRAWABLE_WINDOW: - - SelectClipRgn(pGCPriv->hdc, combined); - DeleteObject(combined); - combined = NULL; - - /* Branch on fill style */ - switch (pGC->fillStyle) { - case FillSolid: - - ROP16(pGCPriv->hdc, pGC->alu); - - if (pDrawable->depth == 1) { - if (pGC->fgPixel == 0) - hPenOrig = SelectObject(pGCPriv->hdc, - GetStockObject(BLACK_PEN)); - else - hPenOrig = SelectObject(pGCPriv->hdc, - GetStockObject(WHITE_PEN)); - } - else { - fg = pGC->fgPixel; - TRANSLATE_COLOR(fg); - hPen = CreatePen(PS_SOLID, 0, fg); - hPenOrig = SelectObject(pGCPriv->hdc, hPen); - } - - while (iSpans--) { - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - MoveToEx(pGCPriv->hdc, fullX1, fullY1, NULL); - LineTo(pGCPriv->hdc, fullX2, fullY1); - } - - SetROP2(pGCPriv->hdc, R2_COPYPEN); - - /* Give back the Brush */ - SelectObject(pGCPriv->hdc, hPenOrig); - - if (pDrawable->depth != 1) - DeleteObject(hPen); - break; - - case FillOpaqueStippled: - - pStipple = pGC->stipple; - pStipplePriv = winGetPixmapPriv(pStipple); - - /* Create a device-dependent bitmap for the stipple */ - hBitmap = CreateDIBitmap(pGCPriv->hdc, - (BITMAPINFOHEADER *) pStipplePriv->pbmih, - CBM_INIT, - pStipplePriv->pbBits, - (BITMAPINFO *) pStipplePriv->pbmih, - DIB_RGB_COLORS); - - /* Create a memory DC to hold the stipple */ - hdcStipple = CreateCompatibleDC(pGCPriv->hdc); - - /* Select the stipple bitmap into the stipple DC */ - hbmpOrigStipple = SelectObject(hdcStipple, hBitmap); - if (hbmpOrigStipple == NULL) - FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - " - "SelectObject () failed on hbmpOrigStipple\n"); - - /* Make a temporary copy of the foreground and background colors */ - bg = pGC->bgPixel; - fg = pGC->fgPixel; - - /* Translate the depth-dependent colors to Win32 COLORREFs */ - TRANSLATE_COLOR(fg); - TRANSLATE_COLOR(bg); - SetTextColor(pGCPriv->hdc, fg); - SetBkColor(pGCPriv->hdc, bg); - - while (iSpans--) { - int width = pStipple->drawable.width; - - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - for (iX = fullX1; iX < fullX2; iX += width) { - int xoffset; - - if ((iX + pStipple->drawable.width) > fullX2) - width = fullX2 - iX; - else - width = pStipple->drawable.width; - - if (iX == fullX1) - xoffset = - (fullX1 - - (pDrawable->x + - (pGC->patOrg.x % pStipple->drawable.width) - - pStipple->drawable.width)) % - pStipple->drawable.width; - else - xoffset = 0; - - if (xoffset + width > pStipple->drawable.width) - width = pStipple->drawable.width - xoffset; - - BitBlt(pGCPriv->hdc, - iX, fullY1, - width, 1, - hdcStipple, - xoffset, - (fullY1 - - (pDrawable->y + - (pGC->patOrg.y % pStipple->drawable.height) - - pStipple->drawable.height)) % - pStipple->drawable.height, g_copyROP[pGC->alu]); - } - } - - /* Clear the stipple HDC */ - SelectObject(hdcStipple, hbmpOrigStipple); - DeleteDC(hdcStipple); - - /* Delete the device dependent stipple bitmap */ - DeleteObject(hBitmap); - - break; - - case FillStippled: - pStipple = pGC->stipple; - pStipplePriv = winGetPixmapPriv(pStipple); - - /* Create a device-dependent bitmap for the stipple */ - hBitmap = CreateDIBitmap(pGCPriv->hdcMem, - (BITMAPINFOHEADER *) pStipplePriv->pbmih, - CBM_INIT, - pStipplePriv->pbBits, - (BITMAPINFO *) pStipplePriv->pbmih, - DIB_RGB_COLORS); - - /* Create a memory DC to hold the stipple */ - hdcStipple = CreateCompatibleDC(pGCPriv->hdc); - - /* Select the stipple bitmap into the stipple DC */ - hbmpOrigStipple = SelectObject(hdcStipple, hBitmap); - if (hbmpOrigStipple == NULL) - FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - " - "SelectObject () failed on hbmpOrigStipple\n"); - - /* Make a temporary copy of the foreground and background colors */ - bg = pGC->bgPixel; - fg = pGC->fgPixel; - - /* Translate the depth-dependent colors to Win32 COLORREFs */ - TRANSLATE_COLOR(fg); - TRANSLATE_COLOR(bg); - - /* this is fudgy, we should only invert on the last one - * We need to get the black/white pixels right in the - * colormap. But yeah ! it's working.. - */ - if (pGC->bgPixel != -1 && pGC->fgPixel != -1) { - SetTextColor(pGCPriv->hdc, fg); - SetBkColor(pGCPriv->hdc, bg); - BitBlt(hdcStipple, - 0, 0, - pStipple->drawable.width, pStipple->drawable.height, - hdcStipple, 0, 0, 0x330008); - } - else if (pGC->bgPixel == -1) { - SetTextColor(pGCPriv->hdc, fg); - SetBkMode(pGCPriv->hdc, TRANSPARENT); - BitBlt(hdcStipple, - 0, 0, - pStipple->drawable.width, pStipple->drawable.height, - hdcStipple, 0, 0, 0x330008); - } - else if (pGC->fgPixel == -1) { - SetTextColor(pGCPriv->hdc, bg); - SetBkMode(pGCPriv->hdc, TRANSPARENT); -#if 0 - BitBlt(hdcStipple, - 0, 0, - pStipple->drawable.width, pStipple->drawable.height, - hdcStipple, 0, 0, 0x330008); -#endif - } - - while (iSpans--) { - int width = pStipple->drawable.width; - - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - for (iX = fullX1; iX < fullX2; iX += width) { - int xoffset; - - if ((iX + pStipple->drawable.width) > fullX2) - width = fullX2 - iX; - else - width = pStipple->drawable.width; - - if (iX == fullX1) - xoffset = - (fullX1 - - (pDrawable->x + - (pGC->patOrg.x % pStipple->drawable.width) - - pStipple->drawable.width)) % - pStipple->drawable.width; - else - xoffset = 0; - - if (xoffset + width > pStipple->drawable.width) - width = pStipple->drawable.width - xoffset; - - BitBlt(pGCPriv->hdc, - iX, fullY1, - width, 1, - hdcStipple, - xoffset, - (fullY1 - - (pDrawable->y + - (pGC->patOrg.y % pStipple->drawable.height) - - pStipple->drawable.height)) % - pStipple->drawable.height, g_copyROP[pGC->alu]); - } - } - - /* Clear the stipple HDC */ - SelectObject(hdcStipple, hbmpOrigStipple); - DeleteDC(hdcStipple); - - /* Delete the device dependent stipple bitmap */ - DeleteObject(hBitmap); - - /* Restore the background mode */ - SetBkMode(pGCPriv->hdc, OPAQUE); - break; - - case FillTiled: - - /* Get a pixmap pointer from the tile pointer, and fetch privates */ - pTile = (PixmapPtr) pGC->tile.pixmap; - pTilePriv = winGetPixmapPriv(pTile); - - /* Select the tile into a DC */ - hbmpOrig = SelectObject(pGCPriv->hdcMem, pTilePriv->hBitmap); - if (hbmpOrig == NULL) - FatalError("winFillSpans - DRAWABLE_WINDOW - FillTiled - " - "SelectObject () failed on pTilePriv->hBitmap\n"); - - while (iSpans--) { - int width = pTile->drawable.width; - - fullX1 = pPoints->x; - fullY1 = pPoints->y; - fullX2 = fullX1 + (int) *piWidths; - pPoints++; - piWidths++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - for (iX = fullX1; iX < fullX2; iX += width) { - int xoffset; - - if ((iX + pTile->drawable.width) > fullX2) - width = fullX2 - iX; - else - width = pTile->drawable.width; - - if (iX == fullX1) - xoffset = - (fullX1 - - (pDrawable->x + - (pGC->patOrg.x % pTile->drawable.width) - - pTile->drawable.width)) % pTile->drawable.width; - else - xoffset = 0; - - if (xoffset + width > pTile->drawable.width) - width = pTile->drawable.width - xoffset; - - BitBlt(pGCPriv->hdc, - iX, fullY1, - width, 1, - pGCPriv->hdcMem, - xoffset, - (fullY1 - - (pDrawable->y + - (pGC->patOrg.y % pTile->drawable.height) - - pTile->drawable.height)) % pTile->drawable.height, - g_copyROP[pGC->alu]); - } - } - - /* Push the tile pixmap out of the memory HDC */ - SelectObject(pGCPriv->hdcMem, hbmpOrig); - break; - - default: - ErrorF("winFillSpans - DRAWABLE_WINDOW - Unknown fillStyle\n"); - break; - } - - /* Reset clip region */ - SelectClipRgn(pGCPriv->hdc, NULL); - break; - - default: - ErrorF("winFillSpans - Unknown drawable type\n"); - break; - } -} diff --git a/hw/xwin/winfont.c b/hw/xwin/winfont.c deleted file mode 100644 index 7bcbce1c7..000000000 --- a/hw/xwin/winfont.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -#ifdef XWIN_NATIVEGDI -/* See Porting Layer Definition - p. 32 */ -/* See mfb/mfbfont.c - mfbRealizeFont() - which is empty :) */ -Bool -winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont) -{ - BOOL fResult = TRUE; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winRealizeFont (%p, %p)\n", pScreen, pFont); -#endif - - WIN_UNWRAP(RealizeFont); - if (pScreen->RealizeFont) - fResult = (*pScreen->RealizeFont) (pScreen, pFont); - WIN_WRAP(RealizeFont, winRealizeFontNativeGDI); - - return fResult; -} - -/* See Porting Layer Definition - p. 32 */ -/* See mfb/mfbfont.c - mfbUnrealizeFont() - which is empty :) */ -Bool -winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont) -{ - BOOL fResult = TRUE; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winUnrealizeFont (%p, %p)\n", pScreen, pFont); -#endif - - WIN_UNWRAP(UnrealizeFont); - if (pScreen->UnrealizeFont) - fResult = (*pScreen->UnrealizeFont) (pScreen, pFont); - WIN_WRAP(UnrealizeFont, winUnrealizeFontNativeGDI); - - return fResult; -#if CYGDEBUG - winDebug("winUnrealizeFont()\n"); -#endif - return TRUE; -} -#endif diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c deleted file mode 100644 index 5986e0a47..000000000 --- a/hw/xwin/wingc.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* - * Local prototypes - */ - -#if 0 -static void - winChangeGCNativeGDI(GCPtr pGC, unsigned long ulChanges); -#endif - -static void - -winValidateGCNativeGDI(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); - -#if 0 -static void - winCopyGCNativeGDI(GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst); -#endif - -static void - winDestroyGCNativeGDI(GCPtr pGC); - -#if 0 -static void - winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects); - -static void - winDestroyClipNativeGDI(GCPtr pGC); - -static void - winCopyClipNativeGDI(GCPtr pGCdst, GCPtr pGCsrc); -#endif - -#if 0 -/* GC Handling Routines */ -const GCFuncs winGCFuncs = { - winValidateGCNativeGDI, - winChangeGCNativeGDI, - winCopyGCNativeGDI, - winDestroyGCNativeGDI, - winChangeClipNativeGDI, - winDestroyClipNativeGDI, - winCopyClipNativeGDI, -}; -#else -const GCFuncs winGCFuncs = { - winValidateGCNativeGDI, - miChangeGC, - miCopyGC, - winDestroyGCNativeGDI, - miChangeClip, - miDestroyClip, - miCopyClip, -}; -#endif - -/* Drawing Primitives */ -const GCOps winGCOps = { - winFillSpansNativeGDI, - winSetSpansNativeGDI, - miPutImage, - miCopyArea, - miCopyPlane, - miPolyPoint, - winPolyLineNativeGDI, - miPolySegment, - miPolyRectangle, - miPolyArc, - miFillPolygon, - miPolyFillRect, - miPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, -#if 0 - winImageGlyphBltNativeGDI, - winPolyGlyphBltNativeGDI, -#else - miImageGlyphBlt, - miPolyGlyphBlt, -#endif - miPushPixels, -}; - -/* See Porting Layer Definition - p. 45 */ -/* See mfb/mfbgc.c - mfbCreateGC() */ -/* See Strategies for Porting - pp. 15, 16 */ -Bool -winCreateGCNativeGDI(GCPtr pGC) -{ - winPrivGCPtr pGCPriv = NULL; - winPrivScreenPtr pScreenPriv = NULL; - -#if 0 - ErrorF("winCreateGCNativeGDI - depth: %d\n", pGC->depth); -#endif - - pGC->ops = (GCOps *) &winGCOps; - pGC->funcs = (GCFuncs *) &winGCFuncs; - - /* We want all coordinates passed to spans functions to be screen relative */ - pGC->miTranslate = TRUE; - - /* Allocate privates for this GC */ - pGCPriv = winGetGCPriv(pGC); - if (pGCPriv == NULL) { - ErrorF("winCreateGCNativeGDI () - Privates pointer was NULL\n"); - return FALSE; - } - - /* Create a new screen DC for the display window */ - pScreenPriv = winGetScreenPriv(pGC->pScreen); - pGCPriv->hdc = GetDC(pScreenPriv->hwndScreen); - - /* Allocate a memory DC for the GC */ - pGCPriv->hdcMem = CreateCompatibleDC(pGCPriv->hdc); - - return TRUE; -} - -#if 0 -/* See Porting Layer Definition - p. 45 */ -static void -winChangeGCNativeGDI(GCPtr pGC, unsigned long ulChanges) -{ -#if 0 - ErrorF("winChangeGCNativeGDI () - Doing nothing\n"); -#endif -} -#endif - -static void -winValidateGCNativeGDI(GCPtr pGC, - unsigned long ulChanges, DrawablePtr pDrawable) -{ - if ((ulChanges & - (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode)) - || (pDrawable->serialNumber != - (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { - miComputeCompositeClip(pGC, pDrawable); - } -} - -#if 0 -/* See Porting Layer Definition - p. 46 */ -static void -winCopyGCNativeGDI(GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst) -{ - -} -#endif - -/* See Porting Layer Definition - p. 46 */ -static void -winDestroyGCNativeGDI(GCPtr pGC) -{ - winGCPriv(pGC); - winScreenPriv(pGC->pScreen); - - if (pGC->freeCompClip) - RegionDestroy(pGC->pCompositeClip); - - /* Free the memory DC */ - if (pGCPriv->hdcMem != NULL) { - DeleteDC(pGCPriv->hdcMem); - pGCPriv->hdcMem = 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); -} - -#if 0 -/* See Porting Layer Definition - p. 46 */ -static void -winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects) -{ - -} - -/* See Porting Layer Definition - p. 47 */ -static void -winDestroyClipNativeGDI(GCPtr pGC) -{ - -} - -/* See Porting Layer Definition - p. 47 */ -static void -winCopyClipNativeGDI(GCPtr pGCdst, GCPtr pGCsrc) -{ - -} -#endif diff --git a/hw/xwin/wingetsp.c b/hw/xwin/wingetsp.c deleted file mode 100644 index 049e2c939..000000000 --- a/hw/xwin/wingetsp.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of the XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Harold L Hunt II - * Alan Hourihane - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* See Porting Layer Definition - p. 55 */ -void -winGetSpansNativeGDI(DrawablePtr pDrawable, - int nMax, - DDXPointPtr pPoints, - int *piWidths, int iSpans, char *pDsts) -{ - PixmapPtr pPixmap = NULL; - winPrivPixmapPtr pPixmapPriv = NULL; - int iSpan; - DDXPointPtr pPoint = NULL; - int *piWidth = NULL; - char *pDst = pDsts; - HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1; - BYTE *pbWindow = NULL; - HDC hdcMem, hdcMem1; - ScreenPtr pScreen = pDrawable->pScreen; - - winScreenPriv(pScreen); - - /* 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; - - 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, - (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 += 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"); -#endif - - /* Open a memory HDC */ - hdcMem = CreateCompatibleDC(NULL); - - /* Loop through spans */ - for (iSpan = 0; iSpan < iSpans; ++iSpan) { - pPoint = pPoints + iSpan; - piWidth = piWidths + iSpan; - - 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, - (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 += PixmapBytePad(*piWidth, pDrawable->depth); - } - - /* Delete the window bitmap */ - DeleteDC(hdcMem); - break; - - default: - FatalError("winGetSpans - Unknown drawable type\n"); - break; - } -} diff --git a/hw/xwin/winmisc.c b/hw/xwin/winmisc.c index 10f97322f..bea6290c6 100644 --- a/hw/xwin/winmisc.c +++ b/hw/xwin/winmisc.c @@ -33,21 +33,6 @@ #endif #include "win.h" -#ifdef XWIN_NATIVEGDI -/* See Porting Layer Definition - p. 33 */ -/* - * Called by clients, returns the best size for a cursor, tile, or - * stipple, specified by class (sometimes called kind) - */ - -void -winQueryBestSizeNativeGDI(int class, unsigned short *pWidth, - unsigned short *pHeight, ScreenPtr pScreen) -{ - ErrorF("winQueryBestSizeNativeGDI\n"); -} -#endif - /* * Count the number of one bits in a color mask. */ @@ -93,51 +78,3 @@ winUpdateFBPointer(ScreenPtr pScreen, void *pbits) return TRUE; } - -#ifdef XWIN_NATIVEGDI -/* - * Paint the window background with the specified color - */ - -BOOL -winPaintBackground(HWND hwnd, COLORREF colorref) -{ - HDC hdc; - HBRUSH hbrush; - RECT rect; - - /* Create an hdc */ - hdc = GetDC(hwnd); - if (hdc == NULL) { - printf("gdiWindowProc - GetDC failed\n"); - exit(1); - } - - /* Create and select blue brush */ - hbrush = CreateSolidBrush(colorref); - if (hbrush == NULL) { - printf("gdiWindowProc - CreateSolidBrush failed\n"); - exit(1); - } - - /* Get window extents */ - if (GetClientRect(hwnd, &rect) == FALSE) { - printf("gdiWindowProc - GetClientRect failed\n"); - exit(1); - } - - /* Fill window with blue brush */ - if (FillRect(hdc, &rect, hbrush) == 0) { - printf("gdiWindowProc - FillRect failed\n"); - exit(1); - } - - /* Delete blue brush */ - DeleteObject(hbrush); - - /* Release the hdc */ - ReleaseDC(hwnd, hdc); - - return TRUE; -} -#endif diff --git a/hw/xwin/winnativegdi.c b/hw/xwin/winnativegdi.c deleted file mode 100644 index 1859698a0..000000000 --- a/hw/xwin/winnativegdi.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of the XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* - * Local function prototypes - */ - -static Bool - winAllocateFBNativeGDI(ScreenPtr pScreen); - -static void - winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf); - -static Bool - winCloseScreenNativeGDI(ScreenPtr pScreen); - -static Bool - winInitVisualsNativeGDI(ScreenPtr pScreen); - -static Bool - winAdjustVideoModeNativeGDI(ScreenPtr pScreen); - -#if 0 -static Bool - winBltExposedRegionsNativeGDI(ScreenPtr pScreen); -#endif - -static Bool - winActivateAppNativeGDI(ScreenPtr pScreen); - -static Bool - winRedrawScreenNativeGDI(ScreenPtr pScreen); - -static Bool - winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen); - -static Bool - winInstallColormapNativeGDI(ColormapPtr pColormap); - -static Bool - winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs); - -static Bool - winCreateColormapNativeGDI(ColormapPtr pColormap); - -static Bool - winDestroyColormapNativeGDI(ColormapPtr pColormap); - -static Bool -winAllocateFBNativeGDI(ScreenPtr pScreen) -{ - FatalError("winAllocateFBNativeGDI\n"); - - return TRUE; -} - -static void -winFreeFBNativeGDI(ScreenPtr pScreen) -{ - FatalError("winFreeFBNativeGDI\n"); -} - -static Bool -winInitScreenNativeGDI(ScreenPtr pScreen) -{ - FatalError("winInitScreenNativeGDI\n"); -} - -/* - * We wrap whatever CloseScreen procedure was specified by fb; - * a pointer to said procedure is stored in our privates. - */ - -static Bool -winCloseScreenNativeGDI(ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - ErrorF("winCloseScreenNativeGDI - Freeing screen resources\n"); - - /* Flag that the screen is closed */ - pScreenPriv->fClosed = TRUE; - pScreenPriv->fActive = FALSE; - - /* - * NOTE: mi doesn't use a CloseScreen procedure, so we do not - * need to call a wrapped procedure here. - */ - - /* Delete the window property */ - RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP); - - ErrorF("winCloseScreenNativeGDI - Destroying window\n"); - - /* Delete tray icon, if we have one */ - if (!pScreenInfo->fNoTrayIcon) - winDeleteNotifyIcon(pScreenPriv); - - /* Free the exit confirmation dialog box, if it exists */ - if (g_hDlgExit != NULL) { - DestroyWindow(g_hDlgExit); - g_hDlgExit = NULL; - } - - /* Kill our window */ - if (pScreenPriv->hwndScreen) { - DestroyWindow(pScreenPriv->hwndScreen); - pScreenPriv->hwndScreen = NULL; - } - - /* Invalidate our screeninfo's pointer to the screen */ - pScreenInfo->pScreen = NULL; - - /* Free the screen privates for this screen */ - free(pScreenPriv); - - ErrorF("winCloseScreenNativeGDI - Returning\n"); - - return TRUE; -} - -static void -winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf) -{ - FatalError("winShadowUpdateNativeGDI\n"); - return; -} - -static Bool -winInitVisualsNativeGDI(ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set the bitsPerRGB and bit masks */ - switch (pScreenInfo->dwDepth) { - case 24: - pScreenPriv->dwBitsPerRGB = 8; - pScreenPriv->dwRedMask = 0x00FF0000; - pScreenPriv->dwGreenMask = 0x0000FF00; - pScreenPriv->dwBlueMask = 0x000000FF; - break; - - case 16: - pScreenPriv->dwBitsPerRGB = 6; - pScreenPriv->dwRedMask = 0xF800; - pScreenPriv->dwGreenMask = 0x07E0; - pScreenPriv->dwBlueMask = 0x001F; - break; - - case 15: - pScreenPriv->dwBitsPerRGB = 5; - pScreenPriv->dwRedMask = 0x7C00; - pScreenPriv->dwGreenMask = 0x03E0; - pScreenPriv->dwBlueMask = 0x001F; - break; - - case 8: - pScreenPriv->dwBitsPerRGB = 8; - pScreenPriv->dwRedMask = 0; - pScreenPriv->dwGreenMask = 0; - pScreenPriv->dwBlueMask = 0; - break; - - default: - ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n"); - return FALSE; - break; - } - - /* Tell the user how many bits per RGB we are using */ - ErrorF("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n", - (int) pScreenPriv->dwBitsPerRGB); - - /* Create a single visual according to the Windows screen depth */ - switch (pScreenInfo->dwDepth) { - case 24: - case 16: - case 15: - if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth, - TrueColorMask, - pScreenPriv->dwBitsPerRGB, - TrueColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) { - ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n"); - return FALSE; - } - break; - - case 8: - ErrorF("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); - if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth, - StaticColorMask, - pScreenPriv->dwBitsPerRGB, - StaticColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) { - ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n"); - return FALSE; - } - break; - - default: - ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n"); - return FALSE; - } - -#if 1 - ErrorF("winInitVisualsNativeGDI - Returning\n"); -#endif - - return TRUE; -} - -/* Adjust the video mode */ -static Bool -winAdjustVideoModeNativeGDI(ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HDC hdc = NULL; - DWORD dwBPP; - - hdc = GetDC(NULL); - - /* We're in serious trouble if we can't get a DC */ - if (hdc == NULL) { - ErrorF("winAdjustVideoModeNativeGDI - GetDC () failed\n"); - return FALSE; - } - - /* Query GDI for current display depth */ - dwBPP = GetDeviceCaps(hdc, BITSPIXEL); - pScreenInfo->dwDepth = GetDeviceCaps(hdc, PLANES); - - switch (pScreenInfo->dwDepth) { - case 24: - case 16: - case 15: - case 8: - break; - default: - if (dwBPP == 32) - pScreenInfo->dwDepth = 24; - else - pScreenInfo->dwDepth = dwBPP; - break; - } - - /* GDI cannot change the screen depth, so we'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - - /* Release our DC */ - ReleaseDC(NULL, hdc); - - return TRUE; -} - -static Bool -winActivateAppNativeGDI(ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - - /* - * Are we active? - * Are we fullscreen? - */ - if (pScreenPriv != NULL - && pScreenPriv->fActive - && pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) { - /* - * Activating, attempt to bring our window - * to the top of the display - */ - ShowWindow(pScreenPriv->hwndScreen, SW_RESTORE); - } - - /* - * Are we inactive? - * Are we fullscreen? - */ - if (pScreenPriv != NULL - && !pScreenPriv->fActive - && pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) { - /* - * Deactivating, stuff our window onto the - * task bar. - */ - ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE); - } - - return TRUE; -} - -HBITMAP -winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth, - BYTE ** ppbBits, BITMAPINFO ** ppbmi) -{ - BITMAPINFOHEADER *pbmih = NULL; - HBITMAP hBitmap = NULL; - BITMAPINFO *pbmi = NULL; - - /* Don't create an invalid bitmap */ - if (iWidth == 0 || iHeight == 0 || iDepth == 0) { - ErrorF("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n", - iWidth, iHeight, iDepth); - return NULL; - } - - /* Allocate bitmap info header */ - pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); - if (pbmih == NULL) { - ErrorF("winCreateDIBNativeGDI - malloc () failed\n"); - return FALSE; - } - ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); - - /* Describe bitmap to be created */ - pbmih->biSize = sizeof(BITMAPINFOHEADER); - pbmih->biWidth = iWidth; - pbmih->biHeight = -iHeight; - pbmih->biPlanes = 1; - pbmih->biBitCount = iDepth; - pbmih->biCompression = BI_RGB; - pbmih->biSizeImage = 0; - pbmih->biXPelsPerMeter = 0; - pbmih->biYPelsPerMeter = 0; - pbmih->biClrUsed = 0; - pbmih->biClrImportant = 0; - - /* Setup color table for mono DIBs */ - if (iDepth == 1) { - pbmi = (BITMAPINFO *) pbmih; - pbmi->bmiColors[1].rgbBlue = 255; - pbmi->bmiColors[1].rgbGreen = 255; - pbmi->bmiColors[1].rgbRed = 255; - } - - /* Create a DIB with a bit pointer */ - hBitmap = CreateDIBSection(NULL, - (BITMAPINFO *) pbmih, - DIB_RGB_COLORS, (void **) ppbBits, NULL, 0); - if (hBitmap == NULL) { - ErrorF("winCreateDIBNativeGDI - CreateDIBSection () failed\n"); - return NULL; - } - - /* Free the bitmap info header memory */ - if (ppbmi != NULL) { - /* Store the address of the BMIH in the ppbmih parameter */ - *ppbmi = (BITMAPINFO *) pbmih; - } - else { - free(pbmih); - pbmih = NULL; - } - - return hBitmap; -} - -#if 0 -static Bool -winBltExposedRegionsNativeGDI(ScreenPtr pScreen) -{ - - return TRUE; -} -#endif - -static Bool -winRedrawScreenNativeGDI(ScreenPtr pScreen) -{ - FatalError("winRedrawScreenNativeGDI\n"); - return TRUE; -} - -static Bool -winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen) -{ - FatalError("winRealizeInstalledPaletteNativeGDI\n"); - return TRUE; -} - -static Bool -winInstallColormapNativeGDI(ColormapPtr pColormap) -{ - FatalError("winInstallColormapNativeGDI\n"); - return TRUE; -} - -static Bool -winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs) -{ - FatalError("winStoreColorsNativeGDI\n"); - return TRUE; -} - -static Bool -winCreateColormapNativeGDI(ColormapPtr pColormap) -{ - FatalError("winCreateColormapNativeGDI\n"); - return TRUE; -} - -static Bool -winDestroyColormapNativeGDI(ColormapPtr pColormap) -{ - FatalError("winDestroyColormapNativeGDI\n"); - return TRUE; -} - -/* Set engine specific funtions */ -Bool -winSetEngineFunctionsNativeGDI(ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set our pointers */ - pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI; - pScreenPriv->pwinFreeFB = winFreeFBNativeGDI; - pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI; - pScreenPriv->pwinInitScreen = winInitScreenNativeGDI; - pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI; - pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI; - pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI; - if (pScreenInfo->fFullScreen) - pScreenPriv->pwinCreateBoundingWindow = - winCreateBoundingWindowFullScreen; - else - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; - pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI; - /* - * WARNING: Do not set the BltExposedRegions procedure pointer to anything - * other than NULL until a working painting procedure is in place. - * Else, winWindowProc will get stuck in an infinite loop because - * Windows expects the BeginPaint and EndPaint functions to be called - * before a WM_PAINT message can be removed from the queue. We are - * using NULL here as a signal for winWindowProc that it should - * not signal that the WM_PAINT message has been processed. - */ - pScreenPriv->pwinBltExposedRegions = NULL; - pScreenPriv->pwinActivateApp = winActivateAppNativeGDI; - pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI; - pScreenPriv->pwinRealizeInstalledPalette = - winRealizeInstalledPaletteNativeGDI; - pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI; - pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI; - pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI; - pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI; - pScreenPriv->pwinHotKeyAltTab = - (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA; - - return TRUE; -} diff --git a/hw/xwin/winpixmap.c b/hw/xwin/winpixmap.c deleted file mode 100644 index ef158c854..000000000 --- a/hw/xwin/winpixmap.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of the XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: drewry, september 1986 - * Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* - * Local prototypes - */ - -#if 0 -static void - winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw); - -static void - winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh); - -static void - -winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix, - int xrot, int yrot); -#endif - -/* See Porting Layer Definition - p. 34 */ -/* See mfb/mfbpixmap.c - mfbCreatePixmap() */ -PixmapPtr -winCreatePixmapNativeGDI(ScreenPtr pScreen, - int iWidth, int iHeight, - int iDepth, unsigned usage_hint) -{ - winPrivPixmapPtr pPixmapPriv = NULL; - PixmapPtr pPixmap = NULL; - - /* Allocate pixmap memory */ - pPixmap = AllocatePixmap(pScreen, 0); - if (!pPixmap) { - ErrorF("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n"); - return NullPixmap; - } - -#if CYGDEBUG - winDebug("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n", - iWidth, iHeight, iDepth, usage_hint, - PixmapBytePad(iWidth, iDepth)); -#endif - - /* Setup pixmap values */ - pPixmap->drawable.type = DRAWABLE_PIXMAP; - pPixmap->drawable.class = 0; - pPixmap->drawable.pScreen = pScreen; - pPixmap->drawable.depth = iDepth; - pPixmap->drawable.bitsPerPixel = BitsPerPixel(iDepth); - pPixmap->drawable.id = 0; - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pPixmap->drawable.x = 0; - pPixmap->drawable.y = 0; - pPixmap->drawable.width = iWidth; - pPixmap->drawable.height = iHeight; - pPixmap->devKind = 0; - pPixmap->refcnt = 1; - pPixmap->devPrivate.ptr = NULL; - pPixmap->usage_hint = usage_hint; - - /* Pixmap privates are allocated by AllocatePixmap */ - pPixmapPriv = winGetPixmapPriv(pPixmap); - - /* Initialize pixmap privates */ - pPixmapPriv->hBitmap = NULL; - pPixmapPriv->hdcSelected = NULL; - pPixmapPriv->pbBits = NULL; - pPixmapPriv->dwScanlineBytes = PixmapBytePad(iWidth, iDepth); - - /* Check for zero width or height pixmaps */ - if (iWidth == 0 || iHeight == 0) { - /* Don't allocate a real pixmap, just set fields and return */ - return pPixmap; - } - - /* Create a DIB for the pixmap */ - pPixmapPriv->hBitmap = winCreateDIBNativeGDI(iWidth, iHeight, iDepth, - &pPixmapPriv->pbBits, - (BITMAPINFO **) &pPixmapPriv-> - pbmih); - -#if CYGDEBUG - winDebug("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " - "screen: %08x\n", - pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen); -#endif - - return pPixmap; -} - -/* - * See Porting Layer Definition - p. 35 - * - * See mfb/mfbpixmap.c - mfbDestroyPixmap() - */ - -Bool -winDestroyPixmapNativeGDI(PixmapPtr pPixmap) -{ - winPrivPixmapPtr pPixmapPriv = NULL; - -#if CYGDEBUG - winDebug("winDestroyPixmapNativeGDI ()\n"); -#endif - - /* Bail early if there is not a pixmap to destroy */ - if (pPixmap == NULL) { - ErrorF("winDestroyPixmapNativeGDI () - No pixmap to destroy\n"); - return TRUE; - } - - /* Get a handle to the pixmap privates */ - pPixmapPriv = winGetPixmapPriv(pPixmap); - -#if CYGDEBUG - winDebug("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n", - pPixmapPriv->hBitmap); -#endif - - /* Decrement reference count, return if nonzero */ - --pPixmap->refcnt; - if (pPixmap->refcnt != 0) - return TRUE; - - /* Free GDI bitmap */ - if (pPixmapPriv->hBitmap) - DeleteObject(pPixmapPriv->hBitmap); - - /* Free the bitmap info header memory */ - free(pPixmapPriv->pbmih); - pPixmapPriv->pbmih = NULL; - - /* Free the pixmap memory */ - free(pPixmap); - pPixmap = NULL; - - return TRUE; -} - -/* - * Not used yet - */ - -Bool -winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap, - int iWidth, int iHeight, - int iDepth, - int iBitsPerPixel, int devKind, void *pPixData) -{ - FatalError("winModifyPixmapHeaderNativeGDI ()\n"); - return TRUE; -} - -#if 0 -/* - * Not used yet. - * See cfb/cfbpixmap.c - */ - -static void -winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw) -{ - ErrorF("winXRotatePixmap()\n"); - /* fill in this function, look at CFB */ -} - -/* - * Not used yet. - * See cfb/cfbpixmap.c - */ -static void -winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh) -{ - ErrorF("winYRotatePixmap()\n"); - /* fill in this function, look at CFB */ -} - -/* - * Not used yet. - * See cfb/cfbpixmap.c - */ - -static void -winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix, - int xrot, int yrot) -{ - ErrorF("winCopyRotatePixmap()\n"); - /* fill in this function, look at CFB */ -} -#endif diff --git a/hw/xwin/winpolyline.c b/hw/xwin/winpolyline.c deleted file mode 100644 index 8b7e10645..000000000 --- a/hw/xwin/winpolyline.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* See Porting Layer Definition - p. 50 */ -void -winPolyLineNativeGDI(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr ppt) -{ - switch (pGC->lineStyle) { - case LineSolid: - if (pGC->lineWidth == 0) - return miZeroLine(pDrawable, pGC, mode, npt, ppt); - else - miWideLine(pDrawable, pGC, mode, npt, ppt); - break; - case LineOnOffDash: - case LineDoubleDash: - miWideDash(pDrawable, pGC, mode, npt, ppt); - break; - } -} diff --git a/hw/xwin/winrop.c b/hw/xwin/winrop.c deleted file mode 100644 index 1f9ff7320..000000000 --- a/hw/xwin/winrop.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - *Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of the XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Alan Hourihane - */ - -/* - * Raster operations used by Windows translated to X's 16 rop codes... - */ -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -void - ROP16(HDC hdc, int rop); - -int g_copyROP[16] = { 0xFF0062, /* GXclear - 0 */ - 0x8800C6, /* GXand - S & D */ - 0x440328, /* GXandReverse - S & !D */ - 0xCC0020, /* GXcopy - S */ - 0x220326, /* GXandInverted - !S & D */ - 0xAA0029, /* GXnoop - D */ - 0x660046, /* GXxor - S ^ D */ - 0xEE0086, /* GXor - S | D */ - 0x1100A6, /* GXnor - !S & !D */ - 0x990126, /* GXequiv - !S ^ D */ - 0x550009, /* GXinvert - !D */ - 0xDD0228, /* GXorReverse - S | !D */ - 0x330008, /* GXcopyInverted - !S */ - 0xBB0226, /* GXorInverted - !S | D */ - 0x7700C6, /* GXnand - !S | !D */ - 0x000042 /* GXset - 1 */ -}; - -int g_patternROP[16] = { 0xFF0062, /* GXclear - 0 */ - 0xA000C9, /* GXand - P & D */ - 0xF50225, /* GXandReverse - P & !D */ - 0xF00021, /* GXcopy - P */ - 0x5F00E9, /* GXandInverted - !P & D */ - 0xAA0029, /* GXnoop - D */ - 0xA50065, /* GXxor - P ^ D */ - 0xA000C9, /* GXor - P | D */ - 0x5F00E9, /* GXnor - !P & !D */ - 0x5A0049, /* GXequiv - !P ^ D */ - 0x550009, /* GXinvert - !D */ - 0x500325, /* GXorReverse - P | !D */ - 0x0F0001, /* GXcopyInverted - !P */ - 0x0A0329, /* GXorInverted - !P | D */ - 0x0500A9, /* GXnand - !P | !D */ - 0x000042 /* GXset - 1 */ -}; - -void -ROP16(HDC hdc, int rop) -{ - switch (rop) { - case GXclear: - SetROP2(hdc, R2_BLACK); - break; - - case GXand: - SetROP2(hdc, R2_MASKPEN); - break; - - case GXandReverse: - SetROP2(hdc, R2_MASKPENNOT); - break; - - case GXcopy: - SetROP2(hdc, R2_COPYPEN); - break; - - case GXnoop: - SetROP2(hdc, R2_NOP); - break; - - case GXxor: - SetROP2(hdc, R2_XORPEN); - break; - - case GXor: - SetROP2(hdc, R2_MERGEPEN); - break; - - case GXnor: - SetROP2(hdc, R2_NOTMERGEPEN); - break; - - case GXequiv: - SetROP2(hdc, R2_NOTXORPEN); - break; - - case GXinvert: - SetROP2(hdc, R2_NOT); - break; - - case GXorReverse: - SetROP2(hdc, R2_MERGEPENNOT); - break; - - case GXcopyInverted: - SetROP2(hdc, R2_NOTCOPYPEN); - break; - - case GXorInverted: - SetROP2(hdc, R2_MERGENOTPEN); - break; - - case GXnand: - SetROP2(hdc, R2_NOTMASKPEN); - break; - - case GXset: - SetROP2(hdc, R2_WHITE); - break; - } -} diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index 23152cbd2..ed1773c11 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -570,145 +570,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv) return TRUE; } -#ifdef XWIN_NATIVEGDI -/* See Porting Layer Definition - p. 20 */ - -Bool -winFinishScreenInitNativeGDI(int i, - ScreenPtr pScreen, int argc, char **argv) -{ - winScreenPriv(pScreen); - winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i]; - VisualPtr pVisuals = NULL; - DepthPtr pDepths = NULL; - VisualID rootVisual = 0; - int nVisuals = 0, nDepths = 0, nRootDepth = 0; - - /* Ignore user input (mouse, keyboard) */ - pScreenInfo->fIgnoreInput = FALSE; - - /* Get device contexts for the screen and shadow bitmap */ - pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen); - if (pScreenPriv->hdcScreen == NULL) - FatalError("winFinishScreenInitNativeGDI - Couldn't get a DC\n"); - - /* Init visuals */ - if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { - ErrorF("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n"); - return FALSE; - } - - /* Initialize the mi visuals */ - if (!miInitVisuals(&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth, - &rootVisual, - ((unsigned long) 1 << (pScreenInfo->dwDepth - 1)), 8, - TrueColor)) { - ErrorF("winFinishScreenInitNativeGDI - miInitVisuals () failed\n"); - return FALSE; - } - - /* Initialize the CloseScreen procedure pointer */ - pScreen->CloseScreen = NULL; - - /* Initialize the mi code */ - if (!miScreenInit(pScreen, NULL, /* No framebuffer */ - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - monitorResolution, monitorResolution, - pScreenInfo->dwStride, - nRootDepth, nDepths, pDepths, rootVisual, - nVisuals, pVisuals)) { - ErrorF("winFinishScreenInitNativeGDI - miScreenInit failed\n"); - return FALSE; - } - - pScreen->defColormap = FakeClientID(0); - - /* - * Register our block and wakeup handlers; these procedures - * process messages in our Windows message queue; specifically, - * they process mouse and keyboard input. - */ - pScreen->BlockHandler = winBlockHandler; - pScreen->WakeupHandler = winWakeupHandler; - - /* Place our save screen function */ - pScreen->SaveScreen = winSaveScreen; - - /* Pixmaps */ - pScreen->CreatePixmap = winCreatePixmapNativeGDI; - pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; - - /* Other Screen Routines */ - pScreen->QueryBestSize = winQueryBestSizeNativeGDI; - pScreen->SaveScreen = winSaveScreen; - pScreen->GetImage = miGetImage; - pScreen->GetSpans = winGetSpansNativeGDI; - - /* Window Procedures */ - pScreen->CreateWindow = winCreateWindowNativeGDI; - pScreen->DestroyWindow = winDestroyWindowNativeGDI; - pScreen->PositionWindow = winPositionWindowNativeGDI; - /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; */ - pScreen->RealizeWindow = winMapWindowNativeGDI; - pScreen->UnrealizeWindow = winUnmapWindowNativeGDI; - - /* Paint window */ - pScreen->CopyWindow = winCopyWindowNativeGDI; - - /* Fonts */ - pScreen->RealizeFont = winRealizeFontNativeGDI; - pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; - - /* GC */ - pScreen->CreateGC = winCreateGCNativeGDI; - - /* Colormap Routines */ - pScreen->CreateColormap = miInitializeColormap; - pScreen->DestroyColormap = - (DestroyColormapProcPtr) (void (*)(void)) NoopDDA; - pScreen->InstallColormap = miInstallColormap; - pScreen->UninstallColormap = miUninstallColormap; - pScreen->ListInstalledColormaps = miListInstalledColormaps; - pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA; - pScreen->ResolveColor = miResolveColor; - - /* Bitmap */ - pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; - - ErrorF("winFinishScreenInitNativeGDI - calling miDCInitialize\n"); - - /* Set the default white and black pixel positions */ - pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0; - - /* Initialize the cursor */ - if (!miDCInitialize(pScreen, &g_winPointerCursorFuncs)) { - ErrorF("winFinishScreenInitNativeGDI - miDCInitialize failed\n"); - return FALSE; - } - - /* Create a default colormap */ - if (!miCreateDefColormap(pScreen)) { - ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () " - "failed\n"); - return FALSE; - } - - ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () " - "returned\n"); - - /* mi doesn't use a CloseScreen procedure, so no need to wrap */ - pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; - - /* Tell the server that we are enabled */ - pScreenPriv->fEnabled = TRUE; - - ErrorF("winFinishScreenInitNativeGDI - Successful addition of " - "screen %p\n", pScreen); - - return TRUE; -} -#endif - /* See Porting Layer Definition - p. 33 */ static Bool winSaveScreen(ScreenPtr pScreen, int on) diff --git a/hw/xwin/winsetsp.c b/hw/xwin/winsetsp.c deleted file mode 100644 index 11108cb53..000000000 --- a/hw/xwin/winsetsp.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of the XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Harold L Hunt II - * Alan Hourihane - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - -/* See Porting Layer Definition - p. 55 */ -void -winSetSpansNativeGDI(DrawablePtr pDrawable, - GCPtr pGC, - char *pSrcs, - DDXPointPtr pPoints, - int *piWidths, int iSpans, int fSorted) -{ - winGCPriv(pGC); - PixmapPtr pPixmap = NULL; - winPrivPixmapPtr pPixmapPriv = NULL; - HBITMAP hbmpOrig = NULL; - BITMAPINFO *pbmi; - HRGN hrgn = NULL, combined = NULL; - int nbox; - BoxPtr pbox; - - nbox = RegionNumRects(pGC->pCompositeClip); - pbox = RegionRects(pGC->pCompositeClip); - - if (!nbox) - return; - - pbmi = malloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD)); - - combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2); - nbox--; - pbox++; - while (nbox--) { - hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2); - CombineRgn(combined, combined, hrgn, RGN_OR); - DeleteObject(hrgn); - hrgn = NULL; - pbox++; - } - - /* Branch on the drawable type */ - switch (pDrawable->type) { - case DRAWABLE_PIXMAP: - - SelectClipRgn(pGCPriv->hdcMem, combined); - DeleteObject(combined); - combined = NULL; - - pPixmap = (PixmapPtr) pDrawable; - pPixmapPriv = winGetPixmapPriv(pPixmap); - - /* Select the drawable pixmap into a DC */ - hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap); - if (hbmpOrig == NULL) - FatalError("winSetSpans - DRAWABLE_PIXMAP - SelectObject () " - "failed on pPixmapPriv->hBitmap\n"); - - while (iSpans--) { - ZeroMemory(pbmi, sizeof(BITMAPINFO)); - pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biWidth = *piWidths; - pbmi->bmiHeader.biHeight = 1; - pbmi->bmiHeader.biPlanes = 1; - pbmi->bmiHeader.biBitCount = pDrawable->depth; - pbmi->bmiHeader.biCompression = BI_RGB; - - /* Setup color table for mono DIBs */ - if (pDrawable->depth == 1) { - RGBQUAD *bmiColors = &(pbmi->bmiColors[0]); - bmiColors[1].rgbBlue = 255; - bmiColors[1].rgbGreen = 255; - bmiColors[1].rgbRed = 255; - } - - StretchDIBits(pGCPriv->hdcMem, - pPoints->x, pPoints->y, - *piWidths, 1, - 0, 0, - *piWidths, 1, - pSrcs, - (BITMAPINFO *) pbmi, - DIB_RGB_COLORS, g_copyROP[pGC->alu]); - - pSrcs += PixmapBytePad(*piWidths, pDrawable->depth); - pPoints++; - piWidths++; - } - - /* Reset the clip region */ - SelectClipRgn(pGCPriv->hdcMem, NULL); - - /* Push the drawable pixmap out of the GC HDC */ - SelectObject(pGCPriv->hdcMem, hbmpOrig); - break; - - case DRAWABLE_WINDOW: - - SelectClipRgn(pGCPriv->hdc, combined); - DeleteObject(combined); - combined = NULL; - - while (iSpans--) { - ZeroMemory(pbmi, sizeof(BITMAPINFO)); - pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biWidth = *piWidths; - pbmi->bmiHeader.biHeight = 1; - pbmi->bmiHeader.biPlanes = 1; - pbmi->bmiHeader.biBitCount = pDrawable->depth; - pbmi->bmiHeader.biCompression = BI_RGB; - - /* Setup color table for mono DIBs */ - if (pDrawable->depth == 1) { - RGBQUAD *bmiColors = &(pbmi->bmiColors[0]); - bmiColors[1].rgbBlue = 255; - bmiColors[1].rgbGreen = 255; - bmiColors[1].rgbRed = 255; - } - - StretchDIBits(pGCPriv->hdc, - pPoints->x, pPoints->y, - *piWidths, 1, - 0, 0, - *piWidths, 1, - pSrcs, - (BITMAPINFO *) pbmi, - DIB_RGB_COLORS, g_copyROP[pGC->alu]); - - pSrcs += PixmapBytePad(*piWidths, pDrawable->depth); - pPoints++; - piWidths++; - } - - /* Reset the clip region */ - SelectClipRgn(pGCPriv->hdc, NULL); - break; - - default: - FatalError("\nwinSetSpansNativeGDI - Unknown drawable type\n\n"); - break; - } - - free(pbmi); -} diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c index 8c1c28f2a..934f6d845 100644 --- a/hw/xwin/winwindow.c +++ b/hw/xwin/winwindow.c @@ -49,225 +49,6 @@ static void winReshapeRootless(WindowPtr pWin); -#ifdef XWIN_NATIVEGDI -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbCreateWindow() */ - -Bool -winCreateWindowNativeGDI(WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winCreateWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(CreateWindow); - fResult = (*pScreen->CreateWindow) (pWin); - WIN_WRAP(CreateWindow, winCreateWindowNativeGDI); - - return fResult; -} - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbDestroyWindow() */ - -Bool -winDestroyWindowNativeGDI(WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winDestroyWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(DestroyWindow); - fResult = (*pScreen->DestroyWindow) (pWin); - WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI); - - return fResult; -} - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbPositionWindow() */ - -Bool -winPositionWindowNativeGDI(WindowPtr pWin, int x, int y) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winPositionWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(PositionWindow); - fResult = (*pScreen->PositionWindow) (pWin, x, y); - WIN_WRAP(PositionWindow, winPositionWindowNativeGDI); - - return fResult; -} - -/* See Porting Layer Definition - p. 39 */ -/* See mfb/mfbwindow.c - mfbCopyWindow() */ - -void -winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - DDXPointPtr pptSrc; - DDXPointPtr ppt; - RegionPtr prgnDst; - BoxPtr pBox; - int dx, dy; - int i, nbox; - BoxPtr pBoxDst; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if 0 - ErrorF("winCopyWindow\n"); -#endif - - /* Create a region for the destination */ - prgnDst = RegionCreate(NULL, 1); - - /* Calculate the shift from the source to the destination */ - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - - /* Translate the region from the destination to the source? */ - RegionTranslate(prgnSrc, -dx, -dy); - RegionIntersect(prgnDst, &pWin->borderClip, prgnSrc); - - /* Get a pointer to the first box in the region to be copied */ - pBox = RegionRects(prgnDst); - - /* Get the number of boxes in the region */ - nbox = RegionNumRects(prgnDst); - - /* Allocate source points for each box */ - if (!(pptSrc = malloc(nbox * sizeof(DDXPointRec)))) - return; - - /* Set an iterator pointer */ - ppt = pptSrc; - - /* Calculate the source point of each box? */ - for (i = nbox; --i >= 0; ppt++, pBox++) { - ppt->x = pBox->x1 + dx; - ppt->y = pBox->y1 + dy; - } - - /* Setup loop pointers again */ - pBoxDst = RegionRects(prgnDst); - ppt = pptSrc; - -#if 0 - ErrorF("winCopyWindow - x1\tx2\ty1\ty2\tx\ty\n"); -#endif - - /* BitBlt each source to the destination point */ - for (i = nbox; --i >= 0; pBoxDst++, ppt++) { -#if 0 - ErrorF("winCopyWindow - %d\t%d\t%d\t%d\t%d\t%d\n", - pBoxDst->x1, pBoxDst->x2, pBoxDst->y1, pBoxDst->y2, - ppt->x, ppt->y); -#endif - - BitBlt(pScreenPriv->hdcScreen, - pBoxDst->x1, pBoxDst->y1, - pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1, - pScreenPriv->hdcScreen, ppt->x, ppt->y, SRCCOPY); - } - - /* Cleanup the regions, etc. */ - free(pptSrc); - RegionDestroy(prgnDst); -} - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ - -Bool -winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winChangeWindowAttributesNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(ChangeWindowAttributes); - fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask); - WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI); - - /* - * NOTE: We do not currently need to do anything here. - */ - - return fResult; -} - -/* See Porting Layer Definition - p. 37 - * Also referred to as UnrealizeWindow - */ - -Bool -winUnmapWindowNativeGDI(WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winUnmapWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(UnrealizeWindow); - fResult = (*pScreen->UnrealizeWindow) (pWin); - WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI); - - return fResult; -} - -/* See Porting Layer Definition - p. 37 - * Also referred to as RealizeWindow - */ - -Bool -winMapWindowNativeGDI(WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace("winMapWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(RealizeWindow); - fResult = (*pScreen->RealizeWindow) (pWin); - WIN_WRAP(RealizeWindow, winMapWindowMultiWindow); - - return fResult; - -} -#endif - /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbCreateWindow() */