- Use shared locks for surfaces and palettes

svn path=/trunk/; revision=51352
This commit is contained in:
Timo Kreuzer 2011-04-15 15:29:08 +00:00
parent 8357192be7
commit 197cf31913
5 changed files with 31 additions and 31 deletions

View file

@ -743,7 +743,7 @@ DxEngSetDCState(HDC hDC, DWORD SetType, DWORD Set)
if (pDC) if (pDC)
{ {
if (SetType == 1) if (SetType == 1)
{ {
if ( Set ) if ( Set )
pDC->fs |= DC_FLAG_FULLSCREEN; pDC->fs |= DC_FLAG_FULLSCREEN;
else else

View file

@ -934,24 +934,24 @@ NtUserSetCursorContents(
/* Copy new IconInfo field */ /* Copy new IconInfo field */
CurIcon->IconInfo = IconInfo; CurIcon->IconInfo = IconInfo;
psurfBmp = SURFACE_LockSurface(CurIcon->IconInfo.hbmColor); psurfBmp = SURFACE_ShareLockSurface(CurIcon->IconInfo.hbmColor);
if (psurfBmp) if (psurfBmp)
{ {
CurIcon->Size.cx = psurfBmp->SurfObj.sizlBitmap.cx; CurIcon->Size.cx = psurfBmp->SurfObj.sizlBitmap.cx;
CurIcon->Size.cy = psurfBmp->SurfObj.sizlBitmap.cy; CurIcon->Size.cy = psurfBmp->SurfObj.sizlBitmap.cy;
SURFACE_UnlockSurface(psurfBmp); SURFACE_ShareUnlockSurface(psurfBmp);
GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL); GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL);
} }
else else
{ {
psurfBmp = SURFACE_LockSurface(CurIcon->IconInfo.hbmMask); psurfBmp = SURFACE_ShareLockSurface(CurIcon->IconInfo.hbmMask);
if (!psurfBmp) if (!psurfBmp)
goto done; goto done;
CurIcon->Size.cx = psurfBmp->SurfObj.sizlBitmap.cx; CurIcon->Size.cx = psurfBmp->SurfObj.sizlBitmap.cx;
CurIcon->Size.cy = psurfBmp->SurfObj.sizlBitmap.cy / 2; CurIcon->Size.cy = psurfBmp->SurfObj.sizlBitmap.cy / 2;
SURFACE_UnlockSurface(psurfBmp); SURFACE_ShareUnlockSurface(psurfBmp);
} }
GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL); GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL);

View file

@ -119,7 +119,7 @@ GreCreateBitmapEx(
} }
DecompressBitmap(sizl, pvCompressedBits, pvBits, lDelta, iFormat); DecompressBitmap(sizl, pvCompressedBits, pvBits, lDelta, iFormat);
fjBitmap |= BMF_RLE_HACK; fjBitmap |= BMF_RLE_HACK;
iFormat = iFormat == BMF_4RLE ? BMF_4BPP : BMF_8BPP; iFormat = iFormat == BMF_4RLE ? BMF_4BPP : BMF_8BPP;
psurf->SurfObj.iBitmapFormat = iFormat; psurf->SurfObj.iBitmapFormat = iFormat;
} }
@ -201,7 +201,7 @@ NtGdiCreateBitmap(
if (pUnsafeBits && hbmp) if (pUnsafeBits && hbmp)
{ {
PSURFACE psurf = SURFACE_LockSurface(hbmp); PSURFACE psurf = SURFACE_ShareLockSurface(hbmp);
_SEH2_TRY _SEH2_TRY
{ {
ProbeForRead(pUnsafeBits, cjSize, 1); ProbeForRead(pUnsafeBits, cjSize, 1);
@ -215,7 +215,7 @@ NtGdiCreateBitmap(
} }
_SEH2_END _SEH2_END
SURFACE_UnlockSurface(psurf); SURFACE_ShareUnlockSurface(psurf);
} }
return hbmp; return hbmp;

View file

@ -514,7 +514,7 @@ NtGdiSetDIBitsToDeviceInternal(
} }
/* Lock the DIB palette */ /* Lock the DIB palette */
ppalDIB = PALETTE_LockPalette(hpalDIB); ppalDIB = PALETTE_ShareLockPalette(hpalDIB);
if (!ppalDIB) if (!ppalDIB)
{ {
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
@ -555,7 +555,7 @@ Exit:
ret = ScanLines; ret = ScanLines;
} }
if (ppalDIB) PALETTE_UnlockPalette(ppalDIB); if (ppalDIB) PALETTE_ShareUnlockPalette(ppalDIB);
if (pSourceSurf) EngUnlockSurface(pSourceSurf); if (pSourceSurf) EngUnlockSurface(pSourceSurf);
if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap); if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap);
@ -1590,7 +1590,7 @@ DIB_CreateDIBSection(
EngSetLastError(ERROR_NO_SYSTEM_RESOURCES); EngSetLastError(ERROR_NO_SYSTEM_RESOURCES);
goto cleanup; goto cleanup;
} }
bmp = SURFACE_LockSurface(res); bmp = SURFACE_ShareLockSurface(res); // HACK
if (NULL == bmp) if (NULL == bmp)
{ {
DPRINT1("SURFACE_LockSurface failed\n"); DPRINT1("SURFACE_LockSurface failed\n");
@ -1646,7 +1646,7 @@ cleanup:
if (bmp) if (bmp)
{ {
SURFACE_UnlockSurface(bmp); SURFACE_ShareUnlockSurface(bmp);
} }
// Return BITMAP handle and storage location // Return BITMAP handle and storage location

View file

@ -469,11 +469,11 @@ NtGdiCreatePaletteInternal ( IN LPLOGPALETTE pLogPal, IN UINT cEntries )
return NULL; return NULL;
} }
PalGDI = (PPALETTE) PALETTE_LockPalette(NewPalette); PalGDI = (PPALETTE) PALETTE_ShareLockPalette(NewPalette);
if (PalGDI != NULL) if (PalGDI != NULL)
{ {
PALETTE_ValidateFlags(PalGDI->IndexedColors, PalGDI->NumColors); PALETTE_ValidateFlags(PalGDI->IndexedColors, PalGDI->NumColors);
PALETTE_UnlockPalette(PalGDI); PALETTE_ShareUnlockPalette(PalGDI);
} }
else else
{ {
@ -664,7 +664,7 @@ COLORREF APIENTRY NtGdiGetNearestColor(HDC hDC, COLORREF Color)
if (NULL != dc) if (NULL != dc)
{ {
HPALETTE hpal = dc->dclevel.hpal; HPALETTE hpal = dc->dclevel.hpal;
palGDI = (PPALETTE) PALETTE_LockPalette(hpal); palGDI = PALETTE_ShareLockPalette(hpal);
if (!palGDI) if (!palGDI)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
@ -691,7 +691,7 @@ COLORREF APIENTRY NtGdiGetNearestColor(HDC hDC, COLORREF Color)
(GetGValue(Color) >> GBits) << GBits, (GetGValue(Color) >> GBits) << GBits,
(GetBValue(Color) >> BBits) << BBits); (GetBValue(Color) >> BBits) << BBits);
} }
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
DC_UnlockDc(dc); DC_UnlockDc(dc);
} }
@ -704,7 +704,7 @@ NtGdiGetNearestPaletteIndex(
HPALETTE hpal, HPALETTE hpal,
COLORREF crColor) COLORREF crColor)
{ {
PPALETTE ppal = (PPALETTE) PALETTE_LockPalette(hpal); PPALETTE ppal = PALETTE_ShareLockPalette(hpal);
UINT index = 0; UINT index = 0;
if (ppal) if (ppal)
@ -715,7 +715,7 @@ NtGdiGetNearestPaletteIndex(
index = PALETTE_ulGetNearestPaletteIndex(ppal, crColor); index = PALETTE_ulGetNearestPaletteIndex(ppal, crColor);
} }
// else SetLastError ? // else SetLastError ?
PALETTE_UnlockPalette(ppal); PALETTE_ShareUnlockPalette(ppal);
} }
return index; return index;
@ -777,13 +777,13 @@ IntAnimatePalette(HPALETTE hPal,
PWND Wnd; PWND Wnd;
const PALETTEENTRY *pptr = PaletteColors; const PALETTEENTRY *pptr = PaletteColors;
palPtr = (PPALETTE)PALETTE_LockPalette(hPal); palPtr = PALETTE_ShareLockPalette(hPal);
if (!palPtr) return FALSE; if (!palPtr) return FALSE;
pal_entries = palPtr->NumColors; pal_entries = palPtr->NumColors;
if (StartIndex >= pal_entries) if (StartIndex >= pal_entries)
{ {
PALETTE_UnlockPalette(palPtr); PALETTE_ShareUnlockPalette(palPtr);
return FALSE; return FALSE;
} }
if (StartIndex+NumEntries > pal_entries) NumEntries = pal_entries - StartIndex; if (StartIndex+NumEntries > pal_entries) NumEntries = pal_entries - StartIndex;
@ -800,7 +800,7 @@ IntAnimatePalette(HPALETTE hPal,
} }
} }
PALETTE_UnlockPalette(palPtr); PALETTE_ShareUnlockPalette(palPtr);
/* Immediately apply the new palette if current window uses it */ /* Immediately apply the new palette if current window uses it */
Wnd = UserGetDesktopWindow(); Wnd = UserGetDesktopWindow();
@ -831,7 +831,7 @@ IntGetPaletteEntries(
PPALETTE palGDI; PPALETTE palGDI;
UINT numEntries; UINT numEntries;
palGDI = (PPALETTE) PALETTE_LockPalette(hpal); palGDI = (PPALETTE) PALETTE_ShareLockPalette(hpal);
if (NULL == palGDI) if (NULL == palGDI)
{ {
return 0; return 0;
@ -846,7 +846,7 @@ IntGetPaletteEntries(
} }
if (numEntries <= StartIndex) if (numEntries <= StartIndex)
{ {
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
return 0; return 0;
} }
memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY)); memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY));
@ -856,7 +856,7 @@ IntGetPaletteEntries(
Entries = numEntries; Entries = numEntries;
} }
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
return Entries; return Entries;
} }
@ -894,7 +894,7 @@ IntGetSystemPaletteEntries(HDC hDC,
return 0; return 0;
} }
palGDI = PALETTE_LockPalette(dc->dclevel.hpal); palGDI = PALETTE_ShareLockPalette(dc->dclevel.hpal);
if (palGDI != NULL) if (palGDI != NULL)
{ {
if (pe != NULL) if (pe != NULL)
@ -917,7 +917,7 @@ IntGetSystemPaletteEntries(HDC hDC,
} }
if (palGDI != NULL) if (palGDI != NULL)
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
if (dc != NULL) if (dc != NULL)
DC_UnlockDc(dc); DC_UnlockDc(dc);
@ -941,13 +941,13 @@ IntSetPaletteEntries(
return 0; return 0;
} }
palGDI = PALETTE_LockPalette(hpal); palGDI = PALETTE_ShareLockPalette(hpal);
if (!palGDI) return 0; if (!palGDI) return 0;
numEntries = palGDI->NumColors; numEntries = palGDI->NumColors;
if (Start >= numEntries) if (Start >= numEntries)
{ {
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
return 0; return 0;
} }
if (numEntries < Start + Entries) if (numEntries < Start + Entries)
@ -955,7 +955,7 @@ IntSetPaletteEntries(
Entries = numEntries - Start; Entries = numEntries - Start;
} }
memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY)); memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY));
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
return Entries; return Entries;
} }
@ -1138,7 +1138,7 @@ NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
!GDI_HANDLE_IS_TYPE(hgdiobj, GDI_OBJECT_TYPE_PALETTE) ) !GDI_HANDLE_IS_TYPE(hgdiobj, GDI_OBJECT_TYPE_PALETTE) )
return Ret; return Ret;
palGDI = PALETTE_LockPalette(hgdiobj); palGDI = PALETTE_ShareLockPalette(hgdiobj);
if (!palGDI) return FALSE; if (!palGDI) return FALSE;
// FIXME!! // FIXME!!
@ -1146,7 +1146,7 @@ NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
// Zero out Current and Old Translated pointers? // Zero out Current and Old Translated pointers?
// //
Ret = TRUE; Ret = TRUE;
PALETTE_UnlockPalette(palGDI); PALETTE_ShareUnlockPalette(palGDI);
return Ret; return Ret;
} }