diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index 4184d885b93..a85bcf784a0 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -17,7 +17,6 @@ typedef struct _ROS_DC_INFO HRGN hClipRgn; /* Clip region (may be 0) */ HRGN hVisRgn; /* Should me to DC. Visible region (must never be 0) */ HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */ - HBITMAP hBitmap; BYTE bitsPerPixel; diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 72fd2bf1e71..eec157f0d6e 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -89,7 +89,6 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, PSYSTEM_CURSORINFO CurInfo; PCURICON_OBJECT OldCursor; HCURSOR Ret = (HCURSOR)0; - HBITMAP dcbmp; HBITMAP hMask = 0; SURFOBJ *soMask = NULL, *soColor = NULL; XLATEOBJ *XlateObj = NULL; @@ -120,13 +119,14 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, { return Ret; } - dcbmp = dc->rosdc.hBitmap; DevInfo = (PDEVINFO)&dc->ppdev->DevInfo; - DC_UnlockDc(dc); - psurf = SURFACE_LockSurface(dcbmp); + psurf = dc->dclevel.pSurface; if (!psurf) + { + DC_UnlockDc(dc); return (HCURSOR)0; + } pso = &psurf->SurfObj; if (!NewCursor) @@ -148,7 +148,7 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, CurInfo->ShowingCursor = 0; } - SURFACE_UnlockSurface(psurf); + DC_UnlockDc(dc); return Ret; } @@ -162,7 +162,7 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, if (maskBpp != 1) { DPRINT1("SetCursor: The Mask bitmap must have 1BPP!\n"); - SURFACE_UnlockSurface(psurf); + DC_UnlockDc(dc); return Ret; } @@ -207,7 +207,7 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, if ( !hMask ) { SURFACE_UnlockSurface(MaskBmpObj); - SURFACE_UnlockSurface(psurf); + DC_UnlockDc(dc); return (HCURSOR)0; } soMask = EngLockSurface((HSURF)hMask); @@ -249,7 +249,6 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, DPRINT1("IntEngSetPointerShape returned %lx\n", Status); } - SURFACE_UnlockSurface(psurf); if(hMask) { EngUnlockSurface(soMask); @@ -260,6 +259,7 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor, EngDeleteXlate(XlateObj); } + DC_UnlockDc(dc); return Ret; } @@ -1724,7 +1724,6 @@ UserShowCursor(BOOL bShow) HDC Screen; PDC dc; - HBITMAP hbmpDc; SURFOBJ *SurfObj; SURFACE *psurfDc; PDEVOBJ *ppdev; @@ -1743,19 +1742,18 @@ UserShowCursor(BOOL bShow) return showpointer; /* No mouse */ } - hbmpDc = dc->rosdc.hBitmap; - DC_UnlockDc(dc); + psurfDc = dc->dclevel.pSurface; - psurfDc = SURFACE_LockSurface(hbmpDc); if ( !psurfDc ) { + DC_UnlockDc(dc); return showpointer; /* No Mouse */ } SurfObj = &psurfDc->SurfObj; if (SurfObj == NULL) { - SURFACE_UnlockSurface(psurfDc); + DC_UnlockDc(dc); return showpointer; /* No mouse */ } @@ -1763,7 +1761,7 @@ UserShowCursor(BOOL bShow) if(ppdev == NULL) { - SURFACE_UnlockSurface(psurfDc); + DC_UnlockDc(dc); return showpointer; /* No mouse */ } @@ -1800,6 +1798,6 @@ UserShowCursor(BOOL bShow) } } - SURFACE_UnlockSurface(psurfDc); + DC_UnlockDc(dc); return showpointer; } diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index 307f9e00a76..312f42a838b 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -432,12 +432,11 @@ IntGetDesktopWorkArea(PDESKTOP Desktop, RECTL *Rect) SURFACE *psurf; dc = DC_LockDc(ScreenDeviceContext); /* FIXME - Handle dc == NULL!!!! */ - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); - if(psurf) + psurf = dc->dclevel.pSurface; + if (psurf) { Ret->right = psurf->SurfObj.sizlBitmap.cx; Ret->bottom = psurf->SurfObj.sizlBitmap.cy; - SURFACE_UnlockSurface(psurf); } DC_UnlockDc(dc); } diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 00094632409..a0cb8561bf3 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -1072,7 +1072,6 @@ IntMouseInput(MOUSEINPUT *mi) PWINSTATION_OBJECT WinSta; BOOL DoMove, SwapButtons; MSG Msg; - HBITMAP hBitmap; SURFACE *psurf; SURFOBJ *pso; PDC dc; @@ -1169,10 +1168,7 @@ IntMouseInput(MOUSEINPUT *mi) dc = DC_LockDc(hDC); if (dc) { - hBitmap = dc->rosdc.hBitmap; - DC_UnlockDc(dc); - - psurf = SURFACE_LockSurface(hBitmap); + psurf = dc->dclevel.pSurface; if (psurf) { pso = &psurf->SurfObj; @@ -1185,9 +1181,9 @@ IntMouseInput(MOUSEINPUT *mi) * use the old values to move the pointer image */ gpsi->ptCursor.x = MousePos.x; gpsi->ptCursor.y = MousePos.y; - - SURFACE_UnlockSurface(psurf); } + + DC_UnlockDc(dc); } } diff --git a/reactos/subsystems/win32/win32k/objects/arc.c b/reactos/subsystems/win32/win32k/objects/arc.c index c18fc1560e0..1636f0df888 100644 --- a/reactos/subsystems/win32/win32k/objects/arc.c +++ b/reactos/subsystems/win32/win32k/objects/arc.c @@ -156,7 +156,7 @@ IntArc( DC *dc, arctype, pbrushPen); - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (NULL == psurf) { DPRINT1("Arc Fail 2\n"); @@ -174,7 +174,6 @@ IntArc( DC *dc, PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine); pbrushPen->ptPenWidth.x = PenOrigWidth; - SURFACE_UnlockSurface(psurf); PEN_UnlockPen(pbrushPen); DPRINT("IntArc Exit.\n"); return ret; diff --git a/reactos/subsystems/win32/win32k/objects/bitblt.c b/reactos/subsystems/win32/win32k/objects/bitblt.c index f805614c45e..fe5d994efa0 100644 --- a/reactos/subsystems/win32/win32k/objects/bitblt.c +++ b/reactos/subsystems/win32/win32k/objects/bitblt.c @@ -120,7 +120,7 @@ NtGdiAlphaBlend( } /* Determine surfaces to be used in the bitblt */ - BitmapDest = SURFACE_LockSurface(DCDest->rosdc.hBitmap); + BitmapDest = DCDest->dclevel.pSurface; if (!BitmapDest) { if (hDCSrc != hDCDest) @@ -128,14 +128,11 @@ NtGdiAlphaBlend( DC_UnlockDc(DCDest); return FALSE; } - if (DCSrc->rosdc.hBitmap == DCDest->rosdc.hBitmap) - BitmapSrc = BitmapDest; - else + { - BitmapSrc = SURFACE_LockSurface(DCSrc->rosdc.hBitmap); + BitmapSrc = DCSrc->dclevel.pSurface; if (!BitmapSrc) { - SURFACE_UnlockSurface(BitmapDest); if (hDCSrc != hDCDest) DC_UnlockDc(DCSrc); DC_UnlockDc(DCDest); @@ -164,9 +161,6 @@ NtGdiAlphaBlend( if (XlateObj != NULL) EngDeleteXlate(XlateObj); - SURFACE_UnlockSurface(BitmapDest); - if (BitmapSrc != BitmapDest) - SURFACE_UnlockSurface(BitmapSrc); DC_UnlockDc(DCDest); if (hDCSrc != hDCDest) DC_UnlockDc(DCSrc); @@ -264,17 +258,14 @@ NtGdiBitBlt( } /* Determine surfaces to be used in the bitblt */ - BitmapDest = SURFACE_LockSurface(DCDest->rosdc.hBitmap); + BitmapDest = DCDest->dclevel.pSurface; if (!BitmapDest) goto cleanup; if (UsesSource) { - if (DCSrc->rosdc.hBitmap == DCDest->rosdc.hBitmap) - BitmapSrc = BitmapDest; - else { - BitmapSrc = SURFACE_LockSurface(DCSrc->rosdc.hBitmap); + BitmapSrc = DCSrc->dclevel.pSurface; if (!BitmapSrc) goto cleanup; } @@ -311,14 +302,6 @@ cleanup: if (UsesSource && XlateObj != NULL) EngDeleteXlate(XlateObj); - if(BitmapDest != NULL) - { - SURFACE_UnlockSurface(BitmapDest); - } - if (BitmapSrc != NULL && BitmapSrc != BitmapDest) - { - SURFACE_UnlockSurface(BitmapSrc); - } if (UsesSource && hDCSrc != hDCDest) { DC_UnlockDc(DCSrc); @@ -387,13 +370,13 @@ NtGdiTransparentBlt( return TRUE; } - BitmapDest = SURFACE_LockSurface(DCDest->rosdc.hBitmap); + BitmapDest = DCDest->dclevel.pSurface; if (!BitmapDest) { goto done; } - BitmapSrc = SURFACE_LockSurface(DCSrc->rosdc.hBitmap); + BitmapSrc = DCSrc->dclevel.pSurface; if (!BitmapSrc) { goto done; @@ -466,14 +449,6 @@ NtGdiTransparentBlt( done: DC_UnlockDc(DCSrc); - if (BitmapDest) - { - SURFACE_UnlockSurface(BitmapDest); - } - if (BitmapSrc) - { - SURFACE_UnlockSurface(BitmapSrc); - } if(hdcDst != hdcSrc) { DC_UnlockDc(DCDest); @@ -826,18 +801,13 @@ GreStretchBltMask( BrushOrigin.y = 0; /* Determine surfaces to be used in the bitblt */ - BitmapDest = SURFACE_LockSurface(DCDest->rosdc.hBitmap); + BitmapDest = DCDest->dclevel.pSurface; if (BitmapDest == NULL) goto failed; if (UsesSource) { - if (DCSrc->rosdc.hBitmap == DCDest->rosdc.hBitmap) { - BitmapSrc = BitmapDest; - } - else - { - BitmapSrc = SURFACE_LockSurface(DCSrc->rosdc.hBitmap); + BitmapSrc = DCSrc->dclevel.pSurface; if (BitmapSrc == NULL) goto failed; } @@ -862,7 +832,7 @@ GreStretchBltMask( DCMask = DC_LockDc(hDCMask); if (DCMask) { - BitmapMask = SURFACE_LockSurface(DCMask->rosdc.hBitmap); + BitmapMask = DCMask->dclevel.pSurface; if (BitmapMask && (BitmapMask->SurfObj.sizlBitmap.cx != WidthSrc || BitmapMask->SurfObj.sizlBitmap.cy != HeightSrc)) @@ -891,18 +861,6 @@ failed: { EngDeleteXlate(XlateObj); } - if (BitmapSrc && DCSrc->rosdc.hBitmap != DCDest->rosdc.hBitmap) - { - SURFACE_UnlockSurface(BitmapSrc); - } - if (BitmapDest) - { - SURFACE_UnlockSurface(BitmapDest); - } - if (BitmapMask) - { - SURFACE_UnlockSurface(BitmapMask); - } if (UsesSource && hDCSrc != hDCDest) { DC_UnlockDc(DCSrc); @@ -967,7 +925,7 @@ IntPatBlt( ASSERT(BrushObj); - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (psurf == NULL) { SetLastWin32Error(ERROR_INVALID_HANDLE); @@ -1024,8 +982,6 @@ IntPatBlt( ROP3_TO_ROP4(ROP)); } - SURFACE_UnlockSurface(psurf); - return ret; } diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index a86fa5f9beb..4302e10204e 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -154,7 +154,7 @@ IntCreateCompatibleBitmap( { DIBSECTION dibs; INT Count; - PSURFACE psurf = SURFACE_LockSurface(Dc->rosdc.hBitmap); + PSURFACE psurf = Dc->dclevel.pSurface; Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs); if (Count) @@ -223,7 +223,6 @@ IntCreateCompatibleBitmap( if (!PalGDI) { ExFreePoolWithTag(bi, TAG_TEMP); - SURFACE_UnlockSurface(psurf); SetLastWin32Error(ERROR_INVALID_HANDLE); return 0; } @@ -239,7 +238,6 @@ IntCreateCompatibleBitmap( } PALETTE_UnlockPalette(PalGDI); } - SURFACE_UnlockSurface(psurf); Bmp = DIB_CreateDIBSection(Dc, bi, @@ -254,7 +252,6 @@ IntCreateCompatibleBitmap( } } } - SURFACE_UnlockSurface(psurf); } } return Bmp; @@ -361,7 +358,7 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos) if (RECTL_bPointInRect(&dc->rosdc.CombinedClip->rclBounds, XPos, YPos)) { bInRect = TRUE; - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; pso = &psurf->SurfObj; if (psurf) { @@ -381,7 +378,6 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos) } EngDeleteXlate(XlateObj); } - SURFACE_UnlockSurface(psurf); } } DC_UnlockDc(dc); diff --git a/reactos/subsystems/win32/win32k/objects/dclife.c b/reactos/subsystems/win32/win32k/objects/dclife.c index a5933916a11..d204f96012e 100644 --- a/reactos/subsystems/win32/win32k/objects/dclife.c +++ b/reactos/subsystems/win32/win32k/objects/dclife.c @@ -212,6 +212,7 @@ IntGdiCreateDC( HRGN hVisRgn; UNICODE_STRING StdDriver; BOOL calledFromUser; + HSURF hsurf; RtlInitUnicodeString(&StdDriver, L"DISPLAY"); @@ -284,7 +285,9 @@ IntGdiCreateDC( pdc->dhpdev = PrimarySurface.hPDev; if (pUMdhpdev) pUMdhpdev = pdc->dhpdev; // set DHPDEV for device. pdc->ppdev = (PVOID)&PrimarySurface; - pdc->rosdc.hBitmap = (HBITMAP)PrimarySurface.pSurface; // <- what kind of haxx0ry is that? + hsurf = (HBITMAP)PrimarySurface.pSurface; // <- what kind of haxx0ry is that? + pdc->dclevel.pSurface = SURFACE_ShareLockSurface(hsurf); + // ATM we only have one display. pdcattr->ulDirty_ |= DC_PRIMARY_DISPLAY; @@ -574,6 +577,7 @@ NtGdiCreateCompatibleDC(HDC hDC) HRGN hVisRgn; UNICODE_STRING DriverName; DWORD Layout = 0; + HSURF hsurf; if (hDC == NULL) { @@ -628,7 +632,8 @@ NtGdiCreateCompatibleDC(HDC hDC) pdcattrNew->szlViewportExt = pdcattrOld->szlViewportExt; pdcNew->dctype = DC_TYPE_MEMORY; // Always! - pdcNew->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP); + hsurf = NtGdiGetStockObject(DEFAULT_BITMAP); + pdcNew->dclevel.pSurface = SURFACE_ShareLockSurface(hsurf); pdcNew->ppdev = pdcOld->ppdev; pdcNew->dclevel.hpal = pdcOld->dclevel.hpal; diff --git a/reactos/subsystems/win32/win32k/objects/dcobjs.c b/reactos/subsystems/win32/win32k/objects/dcobjs.c index 330010b83ee..ec45654ade2 100644 --- a/reactos/subsystems/win32/win32k/objects/dcobjs.c +++ b/reactos/subsystems/win32/win32k/objects/dcobjs.c @@ -20,11 +20,10 @@ IntUpdateBrushXlate(PDC pdc, XLATEOBJ **ppxlo, BRUSH *pbrush) XLATEOBJ *pxlo = NULL; HPALETTE hPalette = NULL; - psurf = SURFACE_LockSurface(pdc->rosdc.hBitmap); + psurf = pdc->dclevel.pSurface; if (psurf) { hPalette = psurf->hDIBPalette; - SURFACE_UnlockSurface(psurf); } if (!hPalette) hPalette = pPrimarySurface->DevInfo.hpalDefault; @@ -185,14 +184,12 @@ DC_vUpdateTextBrush(PDC pdc) SURFACE *psurf; HPALETTE hpal; -// psurf = pdc->dclevel.pSurface; - psurf = SURFACE_LockSurface(pdc->rosdc.hBitmap); + psurf = pdc->dclevel.pSurface; if (psurf) { hpal = psurf->hDIBPalette; if (!hpal) hpal = pPrimarySurface->DevInfo.hpalDefault; pxlo = IntEngCreateXlate(0, PAL_RGB, hpal, NULL); - SURFACE_UnlockSurface(psurf); } /* Update the eboText's solid color */ @@ -216,14 +213,12 @@ DC_vUpdateBackgroundBrush(PDC pdc) SURFACE *psurf; HPALETTE hpal; -// psurf = pdc->dclevel.pSurface; - psurf = SURFACE_LockSurface(pdc->rosdc.hBitmap); + psurf = pdc->dclevel.pSurface; if (psurf) { hpal = psurf->hDIBPalette; if (!hpal) hpal = pPrimarySurface->DevInfo.hpalDefault; pxlo = IntEngCreateXlate(0, PAL_RGB, hpal, NULL); - SURFACE_UnlockSurface(psurf); } /* Update the eboBackground's solid color */ @@ -386,11 +381,6 @@ NtGdiSelectBitmap( psurfOld = pDC->dclevel.pSurface; hOrgBmp = psurfOld ? psurfOld->BaseObject.hHmgr : NULL; - /* FIXME: ros hack */ - hOrgBmp = pDC->rosdc.hBitmap; - - pDC->rosdc.hBitmap = hBmp; - /* Release the old bitmap, reference the new */ DC_vSelectSurface(pDC, psurfBmp); @@ -530,8 +520,11 @@ NtGdiGetDCObject(HDC hDC, INT ObjectType) break; case GDI_OBJECT_TYPE_BITMAP: - SelObject = pdc->rosdc.hBitmap; + { + SURFACE *psurf = pdc->dclevel.pSurface; + SelObject = psurf ? psurf->BaseObject.hHmgr : NULL; break; + } case GDI_OBJECT_TYPE_COLORSPACE: DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_COLORSPACE not supported yet!\n"); diff --git a/reactos/subsystems/win32/win32k/objects/dcstate.c b/reactos/subsystems/win32/win32k/objects/dcstate.c index 0b0cce90bf1..32dc51e05f9 100644 --- a/reactos/subsystems/win32/win32k/objects/dcstate.c +++ b/reactos/subsystems/win32/win32k/objects/dcstate.c @@ -48,8 +48,6 @@ DC_vCopyState(PDC pdcSrc, PDC pdcDst) pdcDst->dclevel.plfnt = pdcSrc->dclevel.plfnt; /* ROS hacks */ - pdcDst->rosdc.hBitmap = pdcSrc->rosdc.hBitmap; - if (pdcDst->dctype != DC_TYPE_MEMORY) { pdcDst->rosdc.bitsPerPixel = pdcSrc->rosdc.bitsPerPixel; diff --git a/reactos/subsystems/win32/win32k/objects/dibobj.c b/reactos/subsystems/win32/win32k/objects/dibobj.c index 41a292ac899..67a39ec20d6 100644 --- a/reactos/subsystems/win32/win32k/objects/dibobj.c +++ b/reactos/subsystems/win32/win32k/objects/dibobj.c @@ -85,7 +85,7 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color return 0; } - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (psurf == NULL) { DC_UnlockDc(dc); @@ -95,7 +95,6 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color if (psurf->hSecure == NULL) { - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); SetLastWin32Error(ERROR_INVALID_PARAMETER); return 0; @@ -110,7 +109,6 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); if (PalGDI == NULL) { - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); SetLastWin32Error(ERROR_INVALID_HANDLE); return 0; @@ -132,7 +130,6 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color /* Mark the brushes invalid */ dc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE|DIRTY_BACKGROUND|DIRTY_TEXT; - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); return Entries; @@ -154,7 +151,7 @@ IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) return 0; } - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (psurf == NULL) { DC_UnlockDc(dc); @@ -164,7 +161,6 @@ IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) if (psurf->hSecure == NULL) { - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); SetLastWin32Error(ERROR_INVALID_PARAMETER); return 0; @@ -180,7 +176,6 @@ IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); if (PalGDI == NULL) { - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); SetLastWin32Error(ERROR_INVALID_HANDLE); return 0; @@ -200,7 +195,6 @@ IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) else Entries = 0; - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); return Entries; @@ -484,14 +478,13 @@ NtGdiSetDIBitsToDeviceInternal( DDBPalette = pDC->ppdev->DevInfo.hpalDefault; /* Try to use hDIBPalette if it exists */ - pSurf = SURFACE_LockSurface(pDC->rosdc.hBitmap); + pSurf = pDC->dclevel.pSurface; if (pSurf && pSurf->hDIBPalette) { DDBPalette = pSurf->hDIBPalette; - SURFACE_UnlockSurface(pSurf); } - pDestSurf = EngLockSurface((HSURF)pDC->rosdc.hBitmap); + pDestSurf = pSurf ? &pSurf->SurfObj : NULL; rcDest.left = XDest; rcDest.top = YDest; @@ -582,7 +575,6 @@ Exit: if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap); if (XlateObj) EngDeleteXlate(XlateObj); if (DIBPalette) PALETTE_FreePaletteByHandle(DIBPalette); - EngUnlockSurface(pDestSurf); DC_UnlockDc(pDC); return ret; @@ -1257,7 +1249,7 @@ NtGdiCreateDIBitmapInternal(IN HDC hDc, { DIBSECTION dibs; INT Count; - SURFACE *psurf = SURFACE_LockSurface(Dc->rosdc.hBitmap); + SURFACE *psurf = Dc->dclevel.pSurface; Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs); if (!Count) bpp = 1; @@ -1270,7 +1262,6 @@ NtGdiCreateDIBitmapInternal(IN HDC hDc, /* A DIB section is selected in the DC */ bpp = dibs.dsBmih.biBitCount; } - SURFACE_UnlockSurface(psurf); } } Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage); diff --git a/reactos/subsystems/win32/win32k/objects/drawing.c b/reactos/subsystems/win32/win32k/objects/drawing.c index 1f63e21ff12..fed699d952e 100755 --- a/reactos/subsystems/win32/win32k/objects/drawing.c +++ b/reactos/subsystems/win32/win32k/objects/drawing.c @@ -1198,7 +1198,7 @@ IntFillRect( DC *dc, ASSERT(pbrush); - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (psurf == NULL) { SetLastWin32Error(ERROR_INVALID_HANDLE); @@ -1249,7 +1249,6 @@ IntFillRect( DC *dc, ROP3_TO_ROP4(ROP)); } - SURFACE_UnlockSurface(psurf); return (int)Ret; } diff --git a/reactos/subsystems/win32/win32k/objects/fillshap.c b/reactos/subsystems/win32/win32k/objects/fillshap.c index 650ed64a563..a77eba5ac60 100644 --- a/reactos/subsystems/win32/win32k/objects/fillshap.c +++ b/reactos/subsystems/win32/win32k/objects/fillshap.c @@ -96,7 +96,7 @@ IntGdiPolygon(PDC dc, /* Special locking order to avoid lock-ups */ pbrFill = dc->dclevel.pbrFill; pbrLine = dc->dclevel.pbrLine; - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; /* FIXME - psurf can be NULL!!!! don't assert but handle this case gracefully! */ ASSERT(psurf); @@ -153,7 +153,6 @@ IntGdiPolygon(PDC dc, } } } - SURFACE_UnlockSurface(psurf); return ret; } @@ -581,7 +580,7 @@ IntRectangle(PDC dc, ret = FALSE; goto cleanup; } - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (!psurf) { ret = FALSE; @@ -646,9 +645,6 @@ IntRectangle(PDC dc, } cleanup: - if (psurf) - SURFACE_UnlockSurface(psurf); - /* Move current position in DC? MSDN: The current position is neither used nor updated by Rectangle. */ @@ -917,7 +913,7 @@ IntGdiGradientFill( DitherOrg.x += dc->ptlDCOrig.x; DitherOrg.y += dc->ptlDCOrig.y; - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; /* FIXME - psurf can be NULL!!! Don't assert but handle this case gracefully! */ ASSERT(psurf); @@ -947,7 +943,6 @@ IntGdiGradientFill( &DitherOrg, ulMode); - SURFACE_UnlockSurface(psurf); EngDeleteXlate(XlateObj); return Ret; @@ -1121,7 +1116,7 @@ NtGdiExtFloodFill( Ret = FALSE; goto cleanup; } - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (!psurf) { Ret = FALSE; @@ -1129,9 +1124,6 @@ NtGdiExtFloodFill( } cleanup: - if (psurf) - SURFACE_UnlockSurface(psurf); - DC_UnlockDc(dc); return Ret; } diff --git a/reactos/subsystems/win32/win32k/objects/freetype.c b/reactos/subsystems/win32/win32k/objects/freetype.c index 5f20afcba22..63ea4ee3363 100644 --- a/reactos/subsystems/win32/win32k/objects/freetype.c +++ b/reactos/subsystems/win32/win32k/objects/freetype.c @@ -3171,7 +3171,7 @@ GreExtTextOutW( IntLPtoDP(dc, (POINT *)lprc, 2); } - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; if (!psurf) { goto fail; @@ -3579,7 +3579,6 @@ GreExtTextOutW( EngDeleteXlate(XlateObj); EngDeleteXlate(XlateObj2); - SURFACE_UnlockSurface(psurf); if (TextObj != NULL) TEXTOBJ_UnlockText(TextObj); good: @@ -3594,8 +3593,6 @@ fail: EngDeleteXlate(XlateObj); if (TextObj != NULL) TEXTOBJ_UnlockText(TextObj); - if (psurf != NULL) - SURFACE_UnlockSurface(psurf); DC_UnlockDc(dc); return FALSE; diff --git a/reactos/subsystems/win32/win32k/objects/line.c b/reactos/subsystems/win32/win32k/objects/line.c index b2fbad6e110..1ea6264573e 100644 --- a/reactos/subsystems/win32/win32k/objects/line.c +++ b/reactos/subsystems/win32/win32k/objects/line.c @@ -113,7 +113,7 @@ IntGdiLineTo(DC *dc, if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(dc); - psurf = SURFACE_LockSurface( dc->rosdc.hBitmap ); + psurf = dc->dclevel.pSurface; if (NULL == psurf) { SetLastWin32Error(ERROR_INVALID_HANDLE); @@ -153,7 +153,6 @@ IntGdiLineTo(DC *dc, ROP2_TO_MIX(pdcattr->jROP2)); } - SURFACE_UnlockSurface(psurf); } if (Ret) @@ -263,7 +262,7 @@ IntGdiPolyline(DC *dc, Points = EngAllocMem(0, Count * sizeof(POINT), TAG_COORD); if (Points != NULL) { - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; /* FIXME - psurf can be NULL!!!! Don't assert but handle this case gracefully! */ ASSERT(psurf); @@ -285,7 +284,6 @@ IntGdiPolyline(DC *dc, Count, ROP2_TO_MIX(pdcattr->jROP2)); - SURFACE_UnlockSurface(psurf); EngFreeMem(Points); } else diff --git a/reactos/subsystems/win32/win32k/objects/print.c b/reactos/subsystems/win32/win32k/objects/print.c index 4db70d3d637..107f0b3436d 100644 --- a/reactos/subsystems/win32/win32k/objects/print.c +++ b/reactos/subsystems/win32/win32k/objects/print.c @@ -114,7 +114,7 @@ IntGdiExtEscape( INT OutSize, LPSTR OutData) { - SURFACE *psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + SURFACE *psurf = dc->dclevel.pSurface; INT Result; /* FIXME - Handle psurf == NULL !!!!!! */ @@ -139,7 +139,6 @@ IntGdiExtEscape( OutSize, (PVOID)OutData ); } - SURFACE_UnlockSurface(psurf); return Result; } diff --git a/reactos/subsystems/win32/win32k/objects/region.c b/reactos/subsystems/win32/win32k/objects/region.c index 4df43808023..3cada964bdf 100644 --- a/reactos/subsystems/win32/win32k/objects/region.c +++ b/reactos/subsystems/win32/win32k/objects/region.c @@ -2936,7 +2936,7 @@ IntGdiPaintRgn( BrushOrigin.x = pdcattr->ptlBrushOrigin.x; BrushOrigin.y = pdcattr->ptlBrushOrigin.y; - psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); + psurf = dc->dclevel.pSurface; /* FIXME - Handle psurf == NULL !!!! */ bRet = IntEngPaint(&psurf->SurfObj, @@ -2945,7 +2945,6 @@ IntGdiPaintRgn( &BrushOrigin, 0xFFFF);//FIXME:don't know what to put here - SURFACE_UnlockSurface(psurf); REGION_UnlockRgn(visrgn); GreDeleteObject(tmpVisRgn);