Author: fireball Date: Tue Feb 16 20:56:35 2010 New Revision: 45601
URL: http://svn.reactos.org/svn/reactos?rev=45601&view=rev Log: - Implement SetDIBColorTable.
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Tue Feb 16 20:56:35 2010 @@ -717,8 +717,7 @@
UINT CDECL RosDrv_SetDIBColorTable( NTDRV_PDEVICE *physDev, UINT start, UINT count, const RGBQUAD *colors ) { - UNIMPLEMENTED; - return 0; + return RosGdiSetDIBColorTable(physDev->hKernelDC, start, count, colors); }
INT CDECL RosDrv_SetDIBits( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] Tue Feb 16 20:56:35 2010 @@ -351,10 +351,20 @@ return 0; }
-UINT APIENTRY RosGdiSetDIBColorTable( HDC physDev, UINT start, UINT count, const RGBQUAD *colors ) -{ - UNIMPLEMENTED; - return 0; +UINT APIENTRY RosGdiSetDIBColorTable( HDC physDev, UINT StartIndex, UINT Entries, const RGBQUAD *Colors ) +{ + PDC pDC; + + /* Get a pointer to the DCs */ + pDC = DC_Lock(physDev); + + Entries = GreSetDIBColorTable(pDC, StartIndex, Entries, Colors); + + /* Release DC objects */ + DC_Unlock(pDC); + + /* Return amount of lines set */ + return Entries; }
INT APIENTRY RosGdiSetDIBits(HDC physDev, HBITMAP hUserBitmap, UINT StartScan,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] Tue Feb 16 20:56:35 2010 @@ -1227,4 +1227,53 @@ return ret; }
+UINT +NTAPI +GreSetDIBColorTable( + PDC dc, + UINT StartIndex, + UINT Entries, + CONST RGBQUAD *Colors) +{ + PSURFACE psurf; + PPALETTE PalGDI; + UINT Index; + ULONG biBitCount; + + psurf = dc->pBitmap; + if (psurf == NULL) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); + if (biBitCount <= 8 && StartIndex < (1 << biBitCount)) + { + if (StartIndex + Entries > (1 << biBitCount)) + Entries = (1 << biBitCount) - StartIndex; + + PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); + if (PalGDI == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + for (Index = StartIndex; + Index < StartIndex + Entries && Index < PalGDI->NumColors; + Index++) + { + PalGDI->IndexedColors[Index].peRed = Colors[Index - StartIndex].rgbRed; + PalGDI->IndexedColors[Index].peGreen = Colors[Index - StartIndex].rgbGreen; + PalGDI->IndexedColors[Index].peBlue = Colors[Index - StartIndex].rgbBlue; + } + PALETTE_UnlockPalette(PalGDI); + } + else + Entries = 0; + + return Entries; +} + /* EOF */
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] Tue Feb 16 20:56:35 2010 @@ -109,6 +109,14 @@ CONST BITMAPINFO *bmi, UINT ColorUse);
+UINT +NTAPI +GreSetDIBColorTable( + PDC pDC, + UINT StartIndex, + UINT Entries, + CONST RGBQUAD *Colors); + INT FASTCALL BitsPerFormat(ULONG Format);