return TRUE;
}
- SURFACE_LockBitmapBits(psurfDest);
-
- if (psoSource != psoDest)
- SURFACE_LockBitmapBits(psurfSource);
-
/* Call the driver's DrvAlphaBlend if available */
if (psurfDest->flHooks & HOOK_ALPHABLEND)
{
DestRect, SourceRect, BlendObj);
}
- if (psoSource != psoDest)
- SURFACE_UnlockBitmapBits(psurfSource);
- SURFACE_UnlockBitmapBits(psurfDest);
-
return ret;
}
psurfSrc = NULL;
}
- if (bRemoveMouse)
- {
- SURFACE_LockBitmapBits(psurfTrg);
-
- if (psoSrc)
- {
- if (psoSrc != psoTrg)
- {
- SURFACE_LockBitmapBits(psurfSrc);
- }
- }
- }
-
/* Is the target surface device managed? */
if (psurfTrg->flHooks & HOOK_BITBLT)
{
// FIXME: cleanup temp surface!
- if (bRemoveMouse)
- {
- if (psoSrc)
- {
- if (psoSrc != psoTrg)
- {
- SURFACE_UnlockBitmapBits(psurfSrc);
- }
- }
- SURFACE_UnlockBitmapBits(psurfTrg);
- }
-
return bResult;
}
ASSERT(psoDest);
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
- SURFACE_LockBitmapBits(psurfDest);
-
/* Dummy BitBlt to let driver know that it should flush its changes.
This should really be done using a call to DrvSynchronizeSurface,
but the VMware driver doesn't hook that call. */
DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
R4_NOOP, FALSE);
- SURFACE_UnlockBitmapBits(psurfDest);
-
return ret;
}
ASSERT(psoDest != NULL && psoSource != NULL && DestRect != NULL && SourcePoint != NULL);
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
- SURFACE_LockBitmapBits(psurfSource);
-
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
- if (psoDest != psoSource)
- {
- SURFACE_LockBitmapBits(psurfDest);
- }
// FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead,
// mark the copy block function to be DrvCopyBits instead of the
}
cleanup:
- if (psoDest != psoSource)
- {
- SURFACE_UnlockBitmapBits(psurfDest);
- }
- SURFACE_UnlockBitmapBits(psurfSource);
-
return ret;
}
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
ASSERT(psurf);
- SURFACE_LockBitmapBits(psurf);
if(psurf->flHooks & HOOK_GRADIENTFILL)
{
Ret = GDIDEVFUNCS(psoDest).GradientFill(
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents,
pptlDitherOrg, ulMode);
}
- SURFACE_UnlockBitmapBits(psurf);
return Ret;
}
if (b.left == b.right) b.right++;
if (b.top == b.bottom) b.bottom++;
- SURFACE_LockBitmapBits(psurfDest);
-
if (psurfDest->flHooks & HOOK_LINETO)
{
/* Call the driver's DrvLineTo */
ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
}
- SURFACE_UnlockBitmapBits(psurfDest);
-
return ret;
}
IN LONG y,
IN RECTL *prcl)
{
- SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
PPDEVOBJ ppdev = (PPDEVOBJ)pso->hdev;
if(ppdev->SafetyRemoveLevel)
return ;
- SURFACE_LockBitmapBits(psurf);
+ EngAcquireSemaphore(ppdev->hsemDevLock);
ppdev->pfnMovePointer(pso, x, y, prcl);
- SURFACE_UnlockBitmapBits(psurf);
+ EngReleaseSemaphore(ppdev->hsemDevLock);
}
ULONG APIENTRY
IN FLONG fl)
{
ULONG ulResult = SPS_DECLINE;
- SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
PFN_DrvSetPointerShape pfnSetPointerShape;
PPDEVOBJ ppdev = GDIDEV(pso);
pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
- SURFACE_LockBitmapBits(psurf);
+ EngAcquireSemaphore(ppdev->hsemDevLock);
if (pfnSetPointerShape)
{
ulResult = pfnSetPointerShape(pso,
ppdev->pfnMovePointer = EngMovePointer;
}
- SURFACE_UnlockBitmapBits(psurf);
+ EngReleaseSemaphore(ppdev->hsemDevLock);
return ulResult;
}
#define NDEBUG
#include <debug.h>
-static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
+BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
{
LONG y;
ULONG LineWidth;
ASSERT(pso);
ASSERT(pRect);
psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
- MouseSafetyOnDrawStart(pso, pRect->left, pRect->top, pRect->right, pRect->bottom);
LineWidth = pRect->right - pRect->left;
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
for (y = pRect->top; y < pRect->bottom; y++)
DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_HLine(
pso, pRect->left, pRect->right, y, iColor);
}
- MouseSafetyOnDrawEnd(pso);
-
return TRUE;
}
-BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
-{
- SURFACE *psurf;
- BOOL Result;
- psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
- SURFACE_LockBitmapBits(psurf);
- Result = FillSolidUnlocked(pso, pRect, iColor);
- SURFACE_UnlockBitmapBits(psurf);
- return Result;
-}
-
BOOL APIENTRY
EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
BRUSHOBJ *BrushObj, POINTL *BrushPoint)
if (ClipRegion->iDComplexity == DC_RECT)
{
- FillSolidUnlocked(pso, &(ClipRegion->rclBounds), iColor);
+ FillSolid(pso, &(ClipRegion->rclBounds), iColor);
} else {
/* Enumerate all the rectangles and draw them */
do {
EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c; i++) {
- FillSolidUnlocked(pso, RectEnum.arcl + i, iColor);
+ FillSolid(pso, RectEnum.arcl + i, iColor);
}
} while (EnumMore);
}
if((pso->iType!=STYPE_BITMAP) && (psurf->flHooks & HOOK_PAINT))
{
// Call the driver's DrvPaint
- SURFACE_LockBitmapBits(psurf);
-
ret = GDIDEVFUNCS(pso).Paint(
pso, ClipRegion, Brush, BrushOrigin, Mix);
- SURFACE_UnlockBitmapBits(psurf);
return ret;
}
return EngPaint(pso, ClipRegion, Brush, BrushOrigin, Mix );
goto leave;
}
- ASSERT(pSurface->BitsLock);
-
/* 4. Get DirectDraw information */
/* 5. Enable DirectDraw Not traced */
/* 6. Copy old PDEV state to new PDEV instance */
/* 7. Switch the PDEVs */
PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
- ASSERT(ppdev->pSurface->BitsLock);
/* 8. Disable DirectDraw */
EngReleaseSemaphore(ghsemPDEV);
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
- ASSERT(ppdev->pSurface->BitsLock);
return retval;
}
/* No success yet */
ret = FALSE;
- SURFACE_LockBitmapBits(psurfDest);
if (UsesSource)
{
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
- if (psoSource != psoDest)
- {
- SURFACE_LockBitmapBits(psurfSource);
- }
}
/* Prepare color adjustment */
ROP);
}
- if (UsesSource)
- {
- if (psoSource != psoDest)
- {
- SURFACE_UnlockBitmapBits(psurfSource);
- }
- }
- SURFACE_UnlockBitmapBits(psurfDest);
-
return ret;
}
}
}
- if (NULL != psurf->BitsLock)
- {
- ExFreePoolWithTag(psurf->BitsLock, TAG_SURFACE);
- psurf->BitsLock = NULL;
- }
-
- return TRUE;
-}
-
-BOOL INTERNAL_CALL
-SURFACE_InitBitsLock(PSURFACE psurf)
-{
- psurf->BitsLock = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(FAST_MUTEX),
- TAG_SURFACE);
- if (NULL == psurf->BitsLock)
- {
- return FALSE;
- }
-
- ExInitializeFastMutex(psurf->BitsLock);
-
return TRUE;
}
-void INTERNAL_CALL
-SURFACE_CleanupBitsLock(PSURFACE psurf)
-{
- if (NULL != psurf->BitsLock)
- {
- ExFreePoolWithTag(psurf->BitsLock, TAG_SURFACE);
- psurf->BitsLock = NULL;
- }
-}
-
-
/*
* @implemented
*/
}
hbmp = psurf->BaseObject.hHmgr;
- if (! SURFACE_InitBitsLock(psurf))
- {
- SURFACE_UnlockSurface(psurf);
- SURFACE_FreeSurfaceByHandle(hbmp);
- return 0;
- }
pso = &psurf->SurfObj;
if (Format == BMF_4RLE)
psurf->flFlags = 0;
psurf->dimension.cx = 0;
psurf->dimension.cy = 0;
-
+
psurf->hSecure = NULL;
psurf->hDIBSection = NULL;
/* The height times the bytes for each scanline */
Size = BitmapInfo->Height * ScanLine;
}
-
+
if (Size)
{
/* Check for allocation flag */
return NULL;
}
- /* Lock down the surface */
- if (!SURFACE_InitBitsLock(psurf))
- {
- /* Bail out if that failed */
- SURFACE_UnlockSurface(psurf);
- SURFACE_FreeSurfaceByHandle(psurf->BaseObject.hHmgr);
- return NULL;
- }
-
/* We should now have our surface object */
pso = &psurf->SurfObj;
LocalSize.cx = BitmapInfo->Width;
pso->sizlBitmap = LocalSize;
pso->iType = STYPE_BITMAP;
-
+
/* Device-managed surface, no flags or dimension */
pso->dhsurf = 0;
pso->dhpdev = NULL;
psurf->hSecure = NULL;
psurf->hDIBSection = NULL;
psurf->flHooks = 0;
-
+
/* Set bits */
pso->pvBits = Bits;
-
+
/* Check for bitmap type */
if (!Compressed)
{
/* Compressed surfaces don't have scanlines! */
pso->lDelta = 0;
pso->cjBits = BitmapInfo->Size;
-
+
/* Check for JPG or PNG */
if ((BitmapInfo->Format != BMF_JPEG) && (BitmapInfo->Format != BMF_PNG))
{
ASSERT(FALSE); // ENGDDI shouldn't be creating PNGs for drivers ;-)
}
}
-
+
/* Finally set the handle and uniq */
pso->hsurf = (HSURF)psurf->BaseObject.hHmgr;
pso->iUniq = 0;
-
+
/* Unlock and return the surface */
SURFACE_UnlockSurface(psurf);
return pso;
{
SURFOBJ* Surface;
DEVBITMAPINFO BitmapInfo;
-
+
/* Capture the parameters */
BitmapInfo.Format = Format;
BitmapInfo.Width = Size.cx;
break;
}
}
-
+
/* Now create the surface */
Surface = SURFMEM_bCreateDib(&BitmapInfo, Bits);
if (!Surface) return 0;
hsurf = psurf->BaseObject.hHmgr;
GDIOBJ_SetOwnership(hsurf, NULL);
- if (!SURFACE_InitBitsLock(psurf))
- {
- SURFACE_UnlockSurface(psurf);
- SURFACE_FreeSurfaceByHandle(hsurf);
- return 0;
- }
pso = &psurf->SurfObj;
pso->dhsurf = dhsurf;
OutputRect = InputClippedRect;
}
- if(psoSource != psoDest)
- {
- SURFACE_LockBitmapBits(psurfSource);
- }
- SURFACE_LockBitmapBits(psurfDest);
-
if(psurfDest->flHooks & HOOK_TRANSPARENTBLT)
{
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
&OutputRect, &InputRect, iTransColor, Reserved);
}
- SURFACE_UnlockBitmapBits(psurfDest);
- if(psoSource != psoDest)
- {
- SURFACE_UnlockBitmapBits(psurfSource);
- }
-
return Ret;
}
to get width/height of bitmap, use
bitmap.bmWidth/bitmap.bmHeight for
that */
-
+
HDC hDC; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
ULONG cRef; // 0x064
HPALETTE hpalHint;
DWORD dwOffset;
/* reactos specific */
- PFAST_MUTEX BitsLock; /* You need to hold this lock before you touch
- the actual bits in the bitmap */
HPALETTE hDIBPalette;
DWORD dsBitfields[3]; // hack, should probably use palette instead
DWORD biClrUsed;
#define SURFACE_ShareUnlockSurface(pBMObj) \
GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj)
-#define SURFACE_LockBitmapBits(pBMObj) ExEnterCriticalRegionAndAcquireFastMutexUnsafe((pBMObj)->BitsLock)
-#define SURFACE_UnlockBitmapBits(pBMObj) ExReleaseFastMutexUnsafeAndLeaveCriticalRegion((pBMObj)->BitsLock)
-
BOOL INTERNAL_CALL SURFACE_Cleanup(PVOID ObjectBody);
-BOOL INTERNAL_CALL SURFACE_InitBitsLock(SURFACE *pBMObj);
-void INTERNAL_CALL SURFACE_CleanupBitsLock(SURFACE *pBMObj);
#define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
#define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions