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.

svn path=/trunk/; revision=50959
This commit is contained in:
Timo Kreuzer 2011-03-02 22:33:14 +00:00
parent 8de09facc2
commit 7110c88cc0
3 changed files with 18 additions and 11 deletions

View file

@ -36,6 +36,6 @@ const PALETTEENTRY* FASTCALL COLOR_GetSystemPaletteTemplate (VOID);
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);

View file

@ -1951,11 +1951,7 @@ UserRealizePalette(HDC hdc)
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 @@ UserRealizePalette(HDC hdc)
UserSendNotifyMessage((HWND)HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0);
}
}
DC_UnlockDc(pdc);
return Ret;
}

View file

@ -723,18 +723,26 @@ NtGdiGetNearestPaletteIndex(
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;
if(!(ppalSurf->flFlags & PAL_INDEXED))
{
// FIXME : set error?
return 0;
goto cleanup;
}
ASSERT(ppalDC->flFlags & PAL_INDEXED);
@ -747,6 +755,8 @@ IntGdiRealizePalette(PDC pdc)
InterlockedExchange((LONG*)&ppalSurf->IndexedColors[i], *(LONG*)&ppalDC->IndexedColors[i]);
}
cleanup:
DC_UnlockDc(pdc);
return realize;
}
@ -800,9 +810,11 @@ IntAnimatePalette(HPALETTE hPal,
{
if (dc->dclevel.hpal == hPal)
{
IntGdiRealizePalette(dc);
DC_UnlockDc(dc);
IntGdiRealizePalette(hDC);
}
DC_UnlockDc(dc);
else
DC_UnlockDc(dc);
}
UserReleaseDC(Wnd,hDC, FALSE);
}