diff --git a/graphics/wing.c b/graphics/wing.c index 003bcbb444f..f044cd99888 100644 --- a/graphics/wing.c +++ b/graphics/wing.c @@ -18,9 +18,12 @@ #include "x11drv.h" #include "bitmap.h" +#include "palette.h" #include "dc.h" #include "debug.h" #include "gdi.h" +#include "heap.h" +#include "selectors.h" #include "monitor.h" #include "wintypes.h" #include "xmalloc.h" @@ -30,8 +33,6 @@ typedef enum WING_DITHER_TYPE WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4 } WING_DITHER_TYPE; -static int __WinGOK = -1; - /* * WinG DIB bitmaps can be selected into DC and then scribbled upon * by GDI functions. They can also be changed directly. This gives us @@ -45,198 +46,85 @@ static int __WinGOK = -1; * 961208 - AK */ -static BITMAPINFOHEADER __bmpiWinG = { 0, 1, -1, 1, 8, BI_RGB, 1, 0, 0, 0, 0 }; - -static void __initWinG(void) -{ - if( __WinGOK < 0 ) - { -#ifdef HAVE_LIBXXSHM - Status s = TSXShmQueryExtension(display); - if( s ) - { - int i = TSXShmPixmapFormat(display); - if( i == ZPixmap && MONITOR_GetDepth(&MONITOR_PrimaryMonitor) == 8 ) - { - __WinGOK = 1; - return; - } - } -#endif /* defined(HAVE_LIBXXSHM) */ - FIXME(wing,"WinG: incorrect depth or unsupported card.\n"); - __WinGOK = 0; - } -} - /*********************************************************************** * WinGCreateDC16 (WING.1001) */ HDC16 WINAPI WinGCreateDC16(void) { - __initWinG(); - - if( __WinGOK > 0 ) + TRACE(wing, "(void)\n"); return CreateCompatibleDC16(0); - return (HDC16)NULL; } /*********************************************************************** * WinGRecommendDIBFormat16 (WING.1002) */ -BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *fmt) +BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi) { - FIXME(wing,"(%p): stub\n", fmt); + TRACE(wing, "(%p)\n", bmpi); + if (!bmpi) + return FALSE; + + bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmpi->bmiHeader.biWidth = 320; + bmpi->bmiHeader.biHeight = -1; + bmpi->bmiHeader.biPlanes = 1; + bmpi->bmiHeader.biBitCount = MONITOR_GetDepth(&MONITOR_PrimaryMonitor); + bmpi->bmiHeader.biCompression = BI_RGB; + bmpi->bmiHeader.biSizeImage = 0; + bmpi->bmiHeader.biXPelsPerMeter = 0; + bmpi->bmiHeader.biYPelsPerMeter = 0; + bmpi->bmiHeader.biClrUsed = 0; + bmpi->bmiHeader.biClrImportant = 0; - if( __WinGOK > 0 && fmt ) - { - memcpy(&fmt->bmiHeader, &__bmpiWinG, sizeof(BITMAPINFOHEADER)); return TRUE; } - return FALSE; -} /*********************************************************************** * WinGCreateBitmap16 (WING.1003) */ -HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header, - void **bits) +HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, + SEGPTR *bits) { - FIXME(wing,"(%x,%p,%p): empty stub! (expect failure)\n", - winDC, header, bits); - if( __WinGOK > 0 && header ) - { - BITMAPINFOHEADER* bmpi = &header->bmiHeader; - - FIXME(wing,"bytes=%i,planes=%i,bpp=%i,x=%i,y=%i,rle=0x%08x,size=%i\n", - (int)bmpi->biSize, bmpi->biPlanes, bmpi->biBitCount, - (int)bmpi->biWidth, (int)bmpi->biHeight, - (unsigned)bmpi->biCompression, (int)bmpi->biSizeImage); - -#ifdef PRELIMINARY_WING16_SUPPORT - if( bmpi->biPlanes == __bmpiWinG.biPlanes && bmpi->biBitCount == __bmpiWinG.biBitCount && - bmpi->biCompression == __bmpiWinG.biCompression && (int)bmpi->biHeight < 0 && - bmpi->biWidth ) - { - unsigned bytes = (bmpi->biWidth + bmpi->biWidth % 2)*(-bmpi->biHeight) * bmpi->biBitCount/8; - int key = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0x01FF); - - if( key ) - { - /* Create the BITMAPOBJ - * - * FIXME: A facility to manage shared memory structures - * which would clean up when Wine crashes. Perhaps a part of - * IPC code can be adapted. Otherwise this code leaves a lot - * of junk in shared memory. - */ - - HBITMAP16 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC ); - if (hbitmap) - { -#ifdef HAVE_LIBXXSHM - __ShmBitmapCtl* p = (__ShmBitmapCtl*)xmalloc(sizeof(__ShmBitmapCtl)); -#endif /* defined(HAVE_LIBXXSHM) */ - BITMAPOBJ* bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap ); - - bmpObjPtr->size.cx = 0; - bmpObjPtr->size.cy = 0; - bmpObjPtr->bitmap.bmType = 0; - bmpObjPtr->bitmap.bmWidth = (INT16)abs(bmpi->biWidth); - bmpObjPtr->bitmap.bmHeight = -(INT16)bmpi->biHeight; - bmpObjPtr->bitmap.bmPlanes = (BYTE)bmpi->biPlanes; - bmpObjPtr->bitmap.bmBitsPixel = (BYTE)bmpi->biBitCount; - bmpObjPtr->bitmap.bmWidthBytes = - (INT16)BITMAP_WIDTH_BYTES( bmpObjPtr->bitmap.bmWidth, bmpi->biBitCount ); - -#ifdef HAVE_LIBXXSHM - bmpObjPtr->bitmap.bmBits = (SEGPTR)p; - - p->si.shmid = key; - p->si.shmaddr = shmat(key, NULL, 0); - p->si.readOnly = False; - - if( p->si.shmaddr ) - { - WORD sel = 0; - - TSXShmAttach(display, &p->si); - bmpObjPtr->pixmap = TSXShmCreatePixmap(display, rootWindow, - p->si.shmaddr, &p->si, bmpObjPtr->bitmap.bmWidth, - bmpObjPtr->bitmap.bmHeight, bmpi->biBitCount ); - if( bmpObjPtr->pixmap ) - { - sel = SELECTOR_AllocBlock( p->si.shmaddr, bytes, - SEGMENT_DATA, FALSE, FALSE); - if (sel) p->bits = PTR_SEG_OFF_TO_SEGPTR(sel,0); - else TSXFreePixmap( display, bmpObjPtr->pixmap ); - } - if( !sel ) - { - shmdt( p->si.shmaddr ); - p->si.shmaddr = NULL; - } + TRACE(wing, "(%d,%p,%p)\n", hdc, bmpi, bits); + TRACE(wing, ": create %ldx%ldx%d bitmap\n", bmpi->bmiHeader.biWidth, + bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes); + return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0); } - if( !p->si.shmaddr ) - { - GDI_FreeObject( hbitmap ); - hbitmap = 0; - } -#else /* defined(HAVE_LIBXXSHM) */ - bmpObjPtr->bitmap.bmBits = (SEGPTR) NULL; - bmpObjPtr->pixmap = NULL; -#endif /* defined(HAVE_LIBXXSHM) */ - } - GDI_HEAP_UNLOCK( hbitmap ); - return hbitmap; - } - } -#endif /* defined(PRELIMINARY_WING16_SUPPORT) */ - } - return 0; -} /*********************************************************************** * WinGGetDIBPointer (WING.1004) */ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi) { -#ifdef PRELIMINARY_WING16_SUPPORT -#ifdef HAVE_LIBXXSHM BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( hWinGBitmap, BITMAP_MAGIC ); - if( bmp ) - { - __ShmBitmapCtl* p = (__ShmBitmapCtl*)bmp->bitmap.bmBits; - if( p ) - { - if( bmpi ) memcpy( bmpi, &__bmpiWinG, sizeof(BITMAPINFOHEADER)); - GDI_HEAP_UNLOCK( hWinGBitmap ); - return p->bits; - } - } -#endif /* defined(HAVE_LIBXXSHM) */ -#endif /* defined(PRELIMINARY_WING16_SUPPORT) */ - return (SEGPTR)NULL; + TRACE(wing, "(%d,%p)\n", hWinGBitmap, bmpi); + if (!bmp) return (SEGPTR)NULL; + + if (bmpi) + FIXME(wing, ": Todo - implement setting BITMAPINFO\n"); + + return PTR_SEG_OFF_TO_SEGPTR(bmp->dib->selector, 0); } /*********************************************************************** * WinGSetDIBColorTable (WING.1004) */ -UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hWinGDC, UINT16 start, UINT16 num, - RGBQUAD* pColor) +UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, + RGBQUAD *colors) { - FIXME(wing,"(%x,%d,%d,%p): empty stub!\n",hWinGDC,start,num,pColor); - return num; + TRACE(wing, "(%d,%d,%d,%p)\n", hdc, start, num, colors); + return SetDIBColorTable16(hdc, start, num, colors); } /*********************************************************************** * WinGGetDIBColorTable16 (WING.1005) */ -UINT16 WINAPI WinGGetDIBColorTable16(HDC16 winDC, UINT16 start, - UINT16 num, RGBQUAD* colors) +UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, + RGBQUAD *colors) { - FIXME(wing,"(%x,%d,%d,%p): empty stub!\n",winDC,start,num,colors); - return 0; + TRACE(wing, "(%d,%d,%d,%p)\n", hdc, start, num, colors); + return GetDIBColorTable16(hdc, start, num, colors); } /*********************************************************************** @@ -244,18 +132,18 @@ UINT16 WINAPI WinGGetDIBColorTable16(HDC16 winDC, UINT16 start, */ HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void) { - FIXME(wing,"(void): empty stub!\n"); - return 0; + TRACE(wing, "(void)\n"); + return CreateHalftonePalette16(GetDC16(0)); } /*********************************************************************** * WinGCreateHalfToneBrush16 (WING.1008) */ -HPALETTE16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col, +HBRUSH16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col, WING_DITHER_TYPE type) { - FIXME(wing,"(...): empty stub!\n"); - return 0; + TRACE(wing, "(%d,%ld,%d)\n", winDC, col, type); + return CreateSolidBrush16(col); } /*********************************************************************** @@ -266,8 +154,9 @@ BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest, HDC16 srcDC, INT16 xSrc, INT16 ySrc, INT16 widSrc, INT16 heiSrc) { - - return StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, xSrc, ySrc, widSrc, heiSrc, SRCCOPY); + TRACE(wing, "(%d,%d,...)\n", destDC, srcDC); + return StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, + xSrc, ySrc, widSrc, heiSrc, SRCCOPY); } /*********************************************************************** @@ -277,31 +166,7 @@ BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest, INT16 widDest, INT16 heiDest, HDC16 srcDC, INT16 xSrc, INT16 ySrc) { - /* destDC is a display DC, srcDC is a memory DC */ - - DC *dcDst, *dcSrc; - X11DRV_PDEVICE *physDevDst, *physDevSrc; - - if (!(dcDst = (DC *)GDI_GetObjPtr( destDC, DC_MAGIC ))) return FALSE; - if (!(dcSrc = (DC *) GDI_GetObjPtr( srcDC, DC_MAGIC ))) return FALSE; - physDevDst = (X11DRV_PDEVICE *)dcDst->physDev; - physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev; - - if (dcDst->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion( dcDst ); - - xSrc = dcSrc->w.DCOrgX + XLPTODP( dcSrc, xSrc ); - ySrc = dcSrc->w.DCOrgY + YLPTODP( dcSrc, ySrc ); - xDest = dcDst->w.DCOrgX + XLPTODP( dcDst, xDest ); - yDest = dcDst->w.DCOrgY + YLPTODP( dcDst, yDest ); - widDest = widDest * dcDst->vportExtX / dcDst->wndExtX; - heiDest = heiDest * dcDst->vportExtY / dcDst->wndExtY; - - - TSXSetFunction( display, physDevDst->gc, GXcopy ); - TSXCopyArea( display, physDevSrc->drawable, - physDevDst->drawable, physDevDst->gc, - xSrc, ySrc, widDest, heiDest, xDest, yDest ); - - return TRUE; + TRACE(wing, "(%d,%d,...)\n", destDC, srcDC); + return BitBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, + xSrc, ySrc, SRCCOPY); } - diff --git a/if1632/gdi.spec b/if1632/gdi.spec index 55d9b3e89f9..5343380f32e 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -350,7 +350,7 @@ file gdi.exe 526 stub GetMiterLimit 527 stub SetMiterLimit 528 stub GDIParametersInfo -529 stub CreateHalftonePalette +529 pascal16 CreateHalftonePalette(word) CreateHalftonePalette16 # Stubs for Hebrew version 530 pascal16 GDI_530() stub_GDI_530 531 pascal16 GDI_531() stub_GDI_531 diff --git a/include/bitmap.h b/include/bitmap.h index ee66b6934c1..7336e826418 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -27,6 +27,9 @@ typedef struct /* Cached XImage */ XImage *image; + /* Selector for 16-bit access to bits */ + WORD selector; + } DIBSECTIONOBJ; /* Flags used for BitmapBits. We only use the first two at the moment */ diff --git a/include/palette.h b/include/palette.h index c90842a54d3..3b532039aed 100644 --- a/include/palette.h +++ b/include/palette.h @@ -24,4 +24,7 @@ extern int PALETTE_GetObject( PALETTEOBJ * palette, int count, LPSTR buffer ); extern BOOL32 PALETTE_DeleteObject( HPALETTE16 hpalette, PALETTEOBJ *palette ); extern BOOL32 PALETTE_UnrealizeObject( HPALETTE16 hpalette, PALETTEOBJ *palette); +extern HPALETTE16 WINAPI CreateHalftonePalette16(HDC16 hdc); +extern HPALETTE32 WINAPI CreateHalftonePalette32(HDC32 hdc); + #endif /* __WINE_PALETTE_H */ diff --git a/include/wingdi.h b/include/wingdi.h index 4a234c74573..68266e31f13 100644 --- a/include/wingdi.h +++ b/include/wingdi.h @@ -96,7 +96,125 @@ typedef struct tagCOLORADJUSTMENT SHORT caColorfulness; SHORT caRedGreenTint; } COLORADJUSTMENT, *PCOLORADJUSTMENT, *LPCOLORADJUSTMENT; - + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 + +/* Flag returned from Escape QUERYDIBSUPPORT */ +#define QDI_SETDIBITS 1 +#define QDI_GETDIBITS 2 +#define QDI_DIBTOSCREEN 4 +#define QDI_STRETCHDIB 8 + + +#define PR_JOBSTATUS 0x0000 + + +/* GDI Escape commands */ +#define NEWFRAME 1 +#define ABORTDOC 2 +#define NEXTBAND 3 +#define SETCOLORTABLE 4 +#define GETCOLORTABLE 5 +#define FLUSHOUTPUT 6 +#define DRAFTMODE 7 +#define QUERYESCSUPPORT 8 +#define SETABORTPROC 9 +#define STARTDOC 10 +#define ENDDOC 11 +#define GETPHYSPAGESIZE 12 +#define GETPRINTINGOFFSET 13 +#define GETSCALINGFACTOR 14 +#define MFCOMMENT 15 +#define GETPENWIDTH 16 +#define SETCOPYCOUNT 17 +#define SELECTPAPERSOURCE 18 +#define DEVICEDATA 19 +#define PASSTHROUGH 19 +#define GETTECHNOLGY 20 +#define GETTECHNOLOGY 20 /* yes, both of them */ +#define SETLINECAP 21 +#define SETLINEJOIN 22 +#define SETMITERLIMIT 23 +#define BANDINFO 24 +#define DRAWPATTERNRECT 25 +#define GETVECTORPENSIZE 26 +#define GETVECTORBRUSHSIZE 27 +#define ENABLEDUPLEX 28 +#define GETSETPAPERBINS 29 +#define GETSETPRINTORIENT 30 +#define ENUMPAPERBINS 31 +#define SETDIBSCALING 32 +#define EPSPRINTING 33 +#define ENUMPAPERMETRICS 34 +#define GETSETPAPERMETRICS 35 +#define POSTSCRIPT_DATA 37 +#define POSTSCRIPT_IGNORE 38 +#define MOUSETRAILS 39 +#define GETDEVICEUNITS 42 + +#define GETEXTENDEDTEXTMETRICS 256 +#define GETEXTENTTABLE 257 +#define GETPAIRKERNTABLE 258 +#define GETTRACKKERNTABLE 259 +#define EXTTEXTOUT 512 +#define GETFACENAME 513 +#define DOWNLOADFACE 514 +#define ENABLERELATIVEWIDTHS 768 +#define ENABLEPAIRKERNING 769 +#define SETKERNTRACK 770 +#define SETALLJUSTVALUES 771 +#define SETCHARSET 772 + +#define STRETCHBLT 2048 +#define GETSETSCREENPARAMS 3072 +#define QUERYDIBSUPPORT 3073 +#define BEGIN_PATH 4096 +#define CLIP_TO_PATH 4097 +#define END_PATH 4098 +#define EXT_DEVICE_CAPS 4099 +#define RESTORE_CTM 4100 +#define SAVE_CTM 4101 +#define SET_ARC_DIRECTION 4102 +#define SET_BACKGROUND_COLOR 4103 +#define SET_POLY_MODE 4104 +#define SET_SCREEN_ANGLE 4105 +#define SET_SPREAD 4106 +#define TRANSFORM_CTM 4107 +#define SET_CLIP_BOX 4108 +#define SET_BOUNDS 4109 +#define SET_MIRROR_MODE 4110 +#define OPENCHANNEL 4110 +#define DOWNLOADHEADER 4111 +#define CLOSECHANNEL 4112 +#define POSTSCRIPT_PASSTHROUGH 4115 +#define ENCAPSULATED_POSTSCRIPT 4116 + +/* Spooler Error Codes */ +#define SP_NOTREPORTED 0x4000 +#define SP_ERROR (-1) +#define SP_APPABORT (-2) +#define SP_USERABORT (-3) +#define SP_OUTOFDISK (-4) +#define SP_OUTOFMEMORY (-5) + + /* Raster operations */ #define R2_BLACK 1 @@ -1948,6 +2066,12 @@ typedef struct { DECL_WINELIB_TYPE_AW(NONCLIENTMETRICS) DECL_WINELIB_TYPE_AW(LPNONCLIENTMETRICS) +/* Flags for PolyDraw and GetPath */ +#define PT_CLOSEFIGURE 0x0001 +#define PT_LINETO 0x0002 +#define PT_BEZIERTO 0x0004 +#define PT_MOVETO 0x0006 + #define RDH_RECTANGLES 1 typedef struct _RGNDATAHEADER { @@ -2151,9 +2275,9 @@ HBRUSH16 WINAPI CreateDIBPatternBrush16(HGLOBAL16,UINT16); HBRUSH32 WINAPI CreateDIBPatternBrush32(HGLOBAL32,UINT32); #define CreateDIBPatternBrush WINELIB_NAME(CreateDIBPatternBrush) HBITMAP16 WINAPI CreateDIBSection16 (HDC16, BITMAPINFO *, UINT16, - LPVOID **, HANDLE32, DWORD offset); + SEGPTR *, HANDLE32, DWORD offset); HBITMAP32 WINAPI CreateDIBSection32 (HDC32, BITMAPINFO *, UINT32, - LPVOID **, HANDLE32, DWORD offset); + LPVOID *, HANDLE32, DWORD offset); #define CreateDIBSection WINELIB_NAME(CreateDIBSection) HBITMAP16 WINAPI CreateDiscardableBitmap16(HDC16,INT16,INT16); HBITMAP32 WINAPI CreateDiscardableBitmap32(HDC32,INT32,INT32); diff --git a/objects/palette.c b/objects/palette.c index 44469fb8426..3a57d7595a9 100644 --- a/objects/palette.c +++ b/objects/palette.c @@ -124,7 +124,21 @@ HPALETTE32 WINAPI CreatePalette32( /*********************************************************************** - * CreateHalftonePalette [GDI32.47] Creates a halftone palette + * CreateHalftonePalette16 [GDI.?] Creates a halftone palette + * + * RETURNS + * Success: Handle to logical halftone palette + * Failure: 0 + */ +HPALETTE16 WINAPI CreateHalftonePalette16( + HDC16 hdc) /* [in] Handle to device context */ +{ + return CreateHalftonePalette32(hdc); + } + + +/*********************************************************************** + * CreateHalftonePalette32 [GDI32.47] Creates a halftone palette * * RETURNS * Success: Handle to logical halftone palette @@ -132,46 +146,40 @@ HPALETTE32 WINAPI CreatePalette32( * * FIXME: not truly tested */ -HPALETTE32 WINAPI CreateHalftonePalette(HDC32 hdc) /* [in] Handle to device context */ -{ int r,g,b,i; - HPALETTE32 hPalette = 0; - int palNumEntries = 216 + NB_RESERVED_COLORS; - - const PALETTEENTRY* __sysPalTemplate = COLOR_GetSystemPaletteTemplate(); +HPALETTE32 WINAPI CreateHalftonePalette32( + HDC32 hdc) /* [in] Handle to device context */ +{ + int i, r, g, b; + struct { + WORD Version; + WORD NumberOfEntries; + PALETTEENTRY aEntries[256]; + } Palette = { + 0x300, 256 + }; - LOGPALETTE * pLogPal = (LOGPALETTE*) HeapAlloc( GetProcessHeap(), 0, - sizeof(LOGPALETTE) + (palNumEntries-1)*sizeof(PALETTEENTRY)); - - TRACE(palette,"(0x%x)\n", hdc); + GetSystemPaletteEntries32(hdc, 0, 256, Palette.aEntries); + return CreatePalette32((LOGPALETTE *)&Palette); - pLogPal->palVersion = 0x300; - pLogPal->palNumEntries = palNumEntries; - - for( i = 0; i < NB_RESERVED_COLORS; i ++ ) - { pLogPal->palPalEntry[i].peRed = __sysPalTemplate[i].peRed; - pLogPal->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen; - pLogPal->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue; - pLogPal->palPalEntry[i].peFlags = 0; - } - - for (r=0; r<6; r++) - { for (g=0; g<6; g++) - { for (b=0; b<6; b++) - { pLogPal->palPalEntry[NB_RESERVED_COLORS+r*36+g*6+b].peRed = r*51; - pLogPal->palPalEntry[NB_RESERVED_COLORS+r*36+g*6+b].peGreen = g*51; - pLogPal->palPalEntry[NB_RESERVED_COLORS+r*36+g*6+b].peBlue = b*51; - pLogPal->palPalEntry[NB_RESERVED_COLORS+r*36+g*6+b].peFlags = 0; + for (r = 0; r < 6; r++) { + for (g = 0; g < 6; g++) { + for (b = 0; b < 6; b++) { + i = r + g*6 + b*36 + 10; + Palette.aEntries[i].peRed = r * 51; + Palette.aEntries[i].peGreen = g * 51; + Palette.aEntries[i].peBlue = b * 51; } } } - hPalette = CreatePalette32 (pLogPal); - if (hPalette) - { SelectPalette32 (hdc, hPalette, FALSE); + for (i = 216; i < 246; i++) { + int v = (i - 216) * 8; + Palette.aEntries[i].peRed = v; + Palette.aEntries[i].peGreen = v; + Palette.aEntries[i].peBlue = v; } - HeapFree (GetProcessHeap(), 0, pLogPal); - return hPalette; + return CreatePalette32((LOGPALETTE *)&Palette); } diff --git a/relay32/gdi32.spec b/relay32/gdi32.spec index 02a7b107594..14e9cb3f3e7 100644 --- a/relay32/gdi32.spec +++ b/relay32/gdi32.spec @@ -49,7 +49,7 @@ init MAIN_GdiInit 44 stdcall CreateFontIndirectA(ptr) CreateFontIndirect32A 45 stdcall CreateFontIndirectW(ptr) CreateFontIndirect32W 46 stdcall CreateFontW(long long long long long long long long long long long long long wstr) CreateFont32W - 47 stdcall CreateHalftonePalette(long) CreateHalftonePalette + 47 stdcall CreateHalftonePalette(long) CreateHalftonePalette32 48 stdcall CreateHatchBrush(long long) CreateHatchBrush32 49 stdcall CreateICA(str str str ptr) CreateIC32A 50 stdcall CreateICW(wstr wstr wstr ptr) CreateIC32W