From 0e85f8a438a3d65eab038219c2fc8ec15a0be490 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 19 Aug 2007 23:49:47 +0000 Subject: [PATCH] - rename NtGdiSelectPalette to NtUserSelectPalette, move it to ntuser/windc.c and implement stub function SelectPalette in gdi32.dll calling it (Don't ask me why it is named this way, but it is on windows) - rename NtGdiSetDIBitsToDevice to NtGdiSetDIBitsToDeviceInternal and implement stub function in gdi32.dll - update ntgdibad.h svn path=/trunk/; revision=28428 --- reactos/dll/win32/gdi32/gdi32.def | 4 +- reactos/dll/win32/gdi32/objects/bitmap.c | 34 +++++++++++ reactos/dll/win32/gdi32/objects/dc.c | 14 +++++ reactos/include/reactos/win32k/ntgdibad.h | 32 ----------- .../subsystems/win32/win32k/ntuser/windc.c | 57 +++++++++++++++++++ .../subsystems/win32/win32k/objects/color.c | 57 ------------------- reactos/subsystems/win32/win32k/objects/dc.c | 2 +- .../subsystems/win32/win32k/objects/dibobj.c | 39 +++++++------ reactos/subsystems/win32/win32k/w32ksvc.db | 6 +- 9 files changed, 133 insertions(+), 112 deletions(-) diff --git a/reactos/dll/win32/gdi32/gdi32.def b/reactos/dll/win32/gdi32/gdi32.def index 96ffdc3bcbe..1d9c1792b32 100644 --- a/reactos/dll/win32/gdi32/gdi32.def +++ b/reactos/dll/win32/gdi32/gdi32.def @@ -527,7 +527,7 @@ SelectClipPath@8 SelectClipRgn@8 SelectFontLocal@8 SelectObject@8=NtGdiSelectObject@8 -SelectPalette@12=NtGdiSelectPalette@12 +SelectPalette@12 SetAbortProc@8 SetArcDirection@8 SetBitmapAttributes@8 @@ -544,7 +544,7 @@ SetDCBrushColor@8 SetDCPenColor@8 SetDIBColorTable@16=NtGdiSetDIBColorTable@16 SetDIBits@28=NtGdiSetDIBits@28 -SetDIBitsToDevice@48=NtGdiSetDIBitsToDevice@48 +SetDIBitsToDevice@48 SetDeviceGammaRamp@8 SetEnhMetaFileBits@8 SetFontEnumeration@4 diff --git a/reactos/dll/win32/gdi32/objects/bitmap.c b/reactos/dll/win32/gdi32/objects/bitmap.c index 6efa1336333..504d3d5a460 100644 --- a/reactos/dll/win32/gdi32/objects/bitmap.c +++ b/reactos/dll/win32/gdi32/objects/bitmap.c @@ -110,3 +110,37 @@ CreateDiscardableBitmap( { return NtGdiCreateCompatibleBitmap(hDC, Width, Height); } + + +INT WINAPI +SetDIBitsToDevice( + HDC hDC, + int XDest, + int YDest, + DWORD Width, + DWORD Height, + int XSrc, + int YSrc, + UINT StartScan, + UINT ScanLines, + CONST VOID *Bits, + CONST BITMAPINFO *lpbmi, + UINT ColorUse) +{ + return NtGdiSetDIBitsToDeviceInternal(hDC, + XDest, + YDest, + Width, + Height, + XSrc, + YSrc, + StartScan, + ScanLines, + (LPBYTE)Bits, + (LPBITMAPINFO)lpbmi, + ColorUse, + lpbmi->bmiHeader.biSizeImage, + lpbmi->bmiHeader.biSize, + FALSE, + NULL); +} diff --git a/reactos/dll/win32/gdi32/objects/dc.c b/reactos/dll/win32/gdi32/objects/dc.c index 558108ccbb8..9f0e7e7db90 100644 --- a/reactos/dll/win32/gdi32/objects/dc.c +++ b/reactos/dll/win32/gdi32/objects/dc.c @@ -918,3 +918,17 @@ GetWindowOrgEx( return NtGdiGetDCPoint( hdc, GdiGetWindowOrg, lpPoint ); } +/* FIXME: include correct header */ +HPALETTE STDCALL NtUserSelectPalette(HDC hDC, + HPALETTE hpal, + BOOL ForceBackground); + +HPALETTE +STDCALL +SelectPalette( + HDC hDC, + HPALETTE hPal, + BOOL bForceBackground) +{ + return NtUserSelectPalette(hDC, hPal, bForceBackground); +} diff --git a/reactos/include/reactos/win32k/ntgdibad.h b/reactos/include/reactos/win32k/ntgdibad.h index 682e0e79989..2870baa60f9 100644 --- a/reactos/include/reactos/win32k/ntgdibad.h +++ b/reactos/include/reactos/win32k/ntgdibad.h @@ -78,11 +78,6 @@ NtGdiCreateScalableFontResource( LPCWSTR CurrentPath ); -/* The gdi32 call Should Use NtGdiGetRandomRgn and nothing else */ -HRGN -NTAPI -NtGdiGetClipRgn(HDC hDC); - /* The gdi32 call Should Use NtGdiGetTextExtent */ BOOL NTAPI @@ -604,15 +599,6 @@ NtGdiRemoveFontResource(LPCWSTR FileName); /* Should be done in user-mode. */ HGDIOBJ STDCALL NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj); -/* Use NtUserSelectPalette. */ -HPALETTE -STDCALL -NtGdiSelectPalette ( - HDC hDC, - HPALETTE hpal, - BOOL ForceBackground - ); - /* Needs to be done in user-mode, using shared GDI Object Attributes. */ COLORREF STDCALL NtGdiSetBkColor (HDC hDC, COLORREF Color); @@ -642,24 +628,6 @@ NtGdiSetDIBits ( UINT ColorUse ); -/* Use NtGdiSetDIBitsToDeviceInternal. */ -INT -STDCALL -NtGdiSetDIBitsToDevice ( - HDC hDC, - INT XDest, - INT YDest, - DWORD Width, - DWORD Height, - INT XSrc, - INT YSrc, - UINT StartScan, - UINT ScanLines, - CONST VOID * Bits, - CONST BITMAPINFO * bmi, - UINT ColorUse - ); - /* Metafiles are user-mode. */ HENHMETAFILE STDCALL diff --git a/reactos/subsystems/win32/win32k/ntuser/windc.c b/reactos/subsystems/win32/win32k/ntuser/windc.c index abbe6954978..0d59a1cb446 100644 --- a/reactos/subsystems/win32/win32k/ntuser/windc.c +++ b/reactos/subsystems/win32/win32k/ntuser/windc.c @@ -1006,5 +1006,62 @@ NtUserChangeDisplaySettings( return Ret; } +/*! + * Select logical palette into device context. + * \param hDC handle to the device context + * \param hpal handle to the palette + * \param ForceBackground If this value is FALSE the logical palette will be copied to the device palette only when the applicatioon + * is in the foreground. If this value is TRUE then map the colors in the logical palette to the device + * palette colors in the best way. + * \return old palette + * + * \todo implement ForceBackground == TRUE +*/ +HPALETTE STDCALL NtUserSelectPalette(HDC hDC, + HPALETTE hpal, + BOOL ForceBackground) +{ + PDC dc; + HPALETTE oldPal = NULL; + PPALGDI PalGDI; + + // FIXME: mark the palette as a [fore\back]ground pal + dc = DC_LockDc(hDC); + if (NULL != dc) + { + /* Check if this is a valid palette handle */ + PalGDI = PALETTE_LockPalette(hpal); + if (NULL != PalGDI) + { + /* Is this a valid palette for this depth? */ + if ((dc->w.bitsPerPixel <= 8 && PAL_INDEXED == PalGDI->Mode) + || (8 < dc->w.bitsPerPixel && PAL_INDEXED != PalGDI->Mode)) + { + PALETTE_UnlockPalette(PalGDI); + oldPal = dc->w.hPalette; + dc->w.hPalette = hpal; + } + else if (8 < dc->w.bitsPerPixel && PAL_INDEXED == PalGDI->Mode) + { + PALETTE_UnlockPalette(PalGDI); + oldPal = dc->PalIndexed; + dc->PalIndexed = hpal; + } + else + { + PALETTE_UnlockPalette(PalGDI); + oldPal = NULL; + } + } + else + { + oldPal = NULL; + } + DC_UnlockDc(dc); + } + + return oldPal; +} + /* EOF */ diff --git a/reactos/subsystems/win32/win32k/objects/color.c b/reactos/subsystems/win32/win32k/objects/color.c index 44206e11cc5..7ad236bcdbc 100644 --- a/reactos/subsystems/win32/win32k/objects/color.c +++ b/reactos/subsystems/win32/win32k/objects/color.c @@ -617,63 +617,6 @@ BOOL STDCALL NtGdiResizePalette(HPALETTE hpal, return FALSE; } -/*! - * Select logical palette into device context. - * \param hDC handle to the device context - * \param hpal handle to the palette - * \param ForceBackground If this value is FALSE the logical palette will be copied to the device palette only when the applicatioon - * is in the foreground. If this value is TRUE then map the colors in the logical palette to the device - * palette colors in the best way. - * \return old palette - * - * \todo implement ForceBackground == TRUE -*/ -HPALETTE STDCALL NtGdiSelectPalette(HDC hDC, - HPALETTE hpal, - BOOL ForceBackground) -{ - PDC dc; - HPALETTE oldPal = NULL; - PPALGDI PalGDI; - - // FIXME: mark the palette as a [fore\back]ground pal - dc = DC_LockDc(hDC); - if (NULL != dc) - { - /* Check if this is a valid palette handle */ - PalGDI = PALETTE_LockPalette(hpal); - if (NULL != PalGDI) - { - /* Is this a valid palette for this depth? */ - if ((dc->w.bitsPerPixel <= 8 && PAL_INDEXED == PalGDI->Mode) - || (8 < dc->w.bitsPerPixel && PAL_INDEXED != PalGDI->Mode)) - { - PALETTE_UnlockPalette(PalGDI); - oldPal = dc->w.hPalette; - dc->w.hPalette = hpal; - } - else if (8 < dc->w.bitsPerPixel && PAL_INDEXED == PalGDI->Mode) - { - PALETTE_UnlockPalette(PalGDI); - oldPal = dc->PalIndexed; - dc->PalIndexed = hpal; - } - else - { - PALETTE_UnlockPalette(PalGDI); - oldPal = NULL; - } - } - else - { - oldPal = NULL; - } - DC_UnlockDc(dc); - } - - return oldPal; -} - BOOL STDCALL NtGdiSetColorAdjustment(HDC hDC, CONST LPCOLORADJUSTMENT ca) { diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index 2917ce7acf7..0c1b1a81098 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -1461,7 +1461,7 @@ IntGdiSetDCState ( HDC hDC, HDC hDCSave ) NtGdiSetBkColor( hDC, dcs->Dc_Attr.crBackgroundClr); NtGdiSetTextColor( hDC, dcs->Dc_Attr.crForegroundClr); - NtGdiSelectPalette( hDC, dcs->w.hPalette, FALSE ); + NtUserSelectPalette( hDC, dcs->w.hPalette, FALSE ); #if 0 GDISelectPalette16( hDC, dcs->w.hPalette, FALSE ); diff --git a/reactos/subsystems/win32/win32k/objects/dibobj.c b/reactos/subsystems/win32/win32k/objects/dibobj.c index bc563401ff8..66134364169 100644 --- a/reactos/subsystems/win32/win32k/objects/dibobj.c +++ b/reactos/subsystems/win32/win32k/objects/dibobj.c @@ -324,20 +324,27 @@ NtGdiSetDIBits( return Ret; } -INT STDCALL -NtGdiSetDIBitsToDevice( - HDC hDC, - INT XDest, - INT YDest, - DWORD Width, - DWORD Height, - INT XSrc, - INT YSrc, - UINT StartScan, - UINT ScanLines, - CONST VOID *Bits, - CONST BITMAPINFO *bmi, - UINT ColorUse) +W32KAPI +INT +APIENTRY +NtGdiSetDIBitsToDeviceInternal( + IN HDC hDC, + IN INT XDest, + IN INT YDest, + IN DWORD Width, + IN DWORD Height, + IN INT XSrc, + IN INT YSrc, + IN DWORD StartScan, + IN DWORD ScanLines, + IN LPBYTE Bits, + IN LPBITMAPINFO bmi, + IN DWORD ColorUse, + IN UINT cjMaxBits, + IN UINT cjMaxInfo, + IN BOOL bTransformCoordinates, + IN OPTIONAL HANDLE hcmXform +) { UNIMPLEMENTED; return 0; @@ -591,7 +598,7 @@ INT STDCALL NtGdiStretchDIBits(HDC hDC, if(Usage == DIB_PAL_COLORS) { hPal = NtGdiGetCurrentObject(hDC, OBJ_PAL); - hPal = NtGdiSelectPalette(hdcMem, hPal, FALSE); + hPal = NtUserSelectPalette(hdcMem, hPal, FALSE); } if (BitsInfo->bmiHeader.biCompression == BI_RLE4 || @@ -622,7 +629,7 @@ INT STDCALL NtGdiStretchDIBits(HDC hDC, SrcWidth, SrcHeight, ROP, 0); if(hPal) - NtGdiSelectPalette(hdcMem, hPal, FALSE); + NtUserSelectPalette(hdcMem, hPal, FALSE); NtGdiSelectObject(hdcMem, hOldBitmap); NtGdiDeleteObjectApp(hdcMem); diff --git a/reactos/subsystems/win32/win32k/w32ksvc.db b/reactos/subsystems/win32/win32k/w32ksvc.db index 915589bf222..75b8c7cb9da 100644 --- a/reactos/subsystems/win32/win32k/w32ksvc.db +++ b/reactos/subsystems/win32/win32k/w32ksvc.db @@ -277,7 +277,7 @@ NtGdiSetBrushOrg 4 NtGdiSetColorAdjustment 2 NtGdiSetColorSpace 2 NtGdiSetDeviceGammaRamp 2 -# NtGdiSetDIBitsToDeviceInternal 16 +NtGdiSetDIBitsToDeviceInternal 16 # NtGdiSetFontEnumeration 1 # NtGdiSetFontXform 3 NtGdiSetIcmMode 3 @@ -507,7 +507,7 @@ NtUserResolveDesktopForWOW 1 NtUserSBGetParms 4 NtUserScrollDC 7 NtUserScrollWindowEx 8 -# NtUserSelectPalette 3 +NtUserSelectPalette 3 NtUserSendInput 3 NtUserSetActiveWindow 1 # NtUserSetAppImeLevel 2 @@ -692,12 +692,10 @@ NtUserValidateHandleSecure 1 # #ReactOS specify syscall NtGdiSelectObject 2 -NtGdiSelectPalette 3 NtGdiSetBkColor 2 NtGdiSetBkMode 2 NtGdiSetDIBColorTable 4 NtGdiSetDIBits 7 -NtGdiSetDIBitsToDevice 12 NtGdiSetEnhMetaFileBits 2 NtGdiSetGraphicsMode 2 NtGdiSetICMProfile 2