Author: tkreuzer
Date: Wed Mar 2 22:33:14 2011
New Revision: 50959
URL:
http://svn.reactos.org/svn/reactos?rev=50959&view=rev
Log:
[WIN32K]
Revert part of r50941. First its architecturally unclean to lock a DC in a USER function,
2nd its a bug to keep the lock while sending a message.
Modified:
trunk/reactos/subsystems/win32/win32k/include/color.h
trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
trunk/reactos/subsystems/win32/win32k/objects/palette.c
Modified: trunk/reactos/subsystems/win32/win32k/include/color.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/color.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/color.h [iso-8859-1] Wed Mar 2 22:33:14
2011
@@ -36,6 +36,6 @@
COLORREF APIENTRY COLOR_LookupNearestColor (PALETTEENTRY* palPalEntry, INT size, COLORREF
color);
INT APIENTRY COLOR_PaletteLookupExactIndex (PALETTEENTRY* palPalEntry, INT size, COLORREF
col);
INT APIENTRY COLOR_PaletteLookupPixel(PALETTEENTRY *palPalEntry, INT size, XLATEOBJ
*XlateObj, COLORREF col, BOOL skipReserved);
-UINT FASTCALL IntGdiRealizePalette (PDC);
+UINT FASTCALL IntGdiRealizePalette (HDC);
HCOLORSPACE FASTCALL IntGdiCreateColorSpace(PLOGCOLORSPACEEXW);
BOOL FASTCALL IntGdiDeleteColorSpace(HCOLORSPACE);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Wed Mar 2
22:33:14 2011
@@ -1951,11 +1951,7 @@
HWND hWnd;
DWORD Ret;
- PDC pdc = DC_LockDc(hdc);
- if(!pdc)
- return 0;
-
- Ret = IntGdiRealizePalette(pdc);
+ Ret = IntGdiRealizePalette(hdc);
if (Ret) // There was a change.
{
hWnd = IntWindowFromDC(hdc);
@@ -1964,7 +1960,6 @@
UserSendNotifyMessage((HWND)HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd,
0);
}
}
- DC_UnlockDc(pdc);
return Ret;
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/palette.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/palette.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/palette.c [iso-8859-1] Wed Mar 2
22:33:14 2011
@@ -723,10 +723,18 @@
UINT
FASTCALL
-IntGdiRealizePalette(PDC pdc)
+IntGdiRealizePalette(HDC hDC)
{
UINT i, realize = 0;
+ PDC pdc;
PALETTE *ppalSurf, *ppalDC;
+
+ pdc = DC_LockDc(hDC);
+ if(!pdc)
+ {
+ EngSetLastError(ERROR_INVALID_HANDLE);
+ return 0;
+ }
ppalSurf = pdc->dclevel.pSurface->ppal;
ppalDC = pdc->dclevel.ppal;
@@ -734,7 +742,7 @@
if(!(ppalSurf->flFlags & PAL_INDEXED))
{
// FIXME : set error?
- return 0;
+ goto cleanup;
}
ASSERT(ppalDC->flFlags & PAL_INDEXED);
@@ -747,6 +755,8 @@
InterlockedExchange((LONG*)&ppalSurf->IndexedColors[i],
*(LONG*)&ppalDC->IndexedColors[i]);
}
+cleanup:
+ DC_UnlockDc(pdc);
return realize;
}
@@ -800,9 +810,11 @@
{
if (dc->dclevel.hpal == hPal)
{
- IntGdiRealizePalette(dc);
+ DC_UnlockDc(dc);
+ IntGdiRealizePalette(hDC);
}
- DC_UnlockDc(dc);
+ else
+ DC_UnlockDc(dc);
}
UserReleaseDC(Wnd,hDC, FALSE);
}