mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[WIN32K]
Modify EBRUSHOBJ_pvGetEngBrush to return a pointer to the SURFOBJ, instead of a handle, this simplifies the code svn path=/trunk/; revision=56220
This commit is contained in:
parent
4ffc097ef2
commit
a0dbbba584
5 changed files with 52 additions and 64 deletions
|
@ -39,16 +39,13 @@ BltMask(SURFOBJ* psoDest,
|
|||
BYTE *pjMskLine, *pjMskCurrent;
|
||||
BYTE fjMaskBit0, fjMaskBit;
|
||||
/* Pattern brushes */
|
||||
PEBRUSHOBJ pebo = NULL;
|
||||
SURFOBJ *psoPattern = NULL;
|
||||
PSURFACE psurfPattern;
|
||||
SURFOBJ *psoPattern;
|
||||
ULONG PatternWidth = 0, PatternHeight = 0;
|
||||
LONG PatternX0 = 0, PatternX = 0, PatternY = 0;
|
||||
LONG SrcX = 0, SrcY = 0;
|
||||
PFN_DIB_PutPixel fnDest_PutPixel = NULL;
|
||||
PFN_DIB_GetPixel fnPattern_GetPixel = NULL, fnSrc_GetPixel = NULL, fnDest_GetPixel;
|
||||
ULONG Pattern = 0, Source = 0, Dest = 0;
|
||||
HBITMAP hbmPattern;
|
||||
DWORD fgndRop, bkgndRop;
|
||||
|
||||
ASSERT(IS_VALID_ROP4(Rop4));
|
||||
|
@ -61,20 +58,16 @@ BltMask(SURFOBJ* psoDest,
|
|||
/* Determine pattern */
|
||||
if (pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
||||
{
|
||||
pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
||||
|
||||
hbmPattern = EBRUSHOBJ_pvGetEngBrush(pebo);
|
||||
psurfPattern = SURFACE_ShareLockSurface(hbmPattern);
|
||||
if (psurfPattern != NULL)
|
||||
psoPattern = BRUSHOBJ_psoPattern(pbo);
|
||||
if (psoPattern)
|
||||
{
|
||||
psoPattern = &psurfPattern->SurfObj;
|
||||
PatternWidth = psoPattern->sizlBitmap.cx;
|
||||
PatternHeight = psoPattern->sizlBitmap.cy;
|
||||
fnPattern_GetPixel = DibFunctionsForBitmapFormat[psoPattern->iBitmapFormat].DIB_GetPixel;
|
||||
}
|
||||
}
|
||||
else
|
||||
psurfPattern = NULL;
|
||||
psoPattern = NULL;
|
||||
|
||||
pjMskLine = (PBYTE)psoMask->pvScan0 + pptlMask->y * psoMask->lDelta + (pptlMask->x >> 3);
|
||||
fjMaskBit0 = 0x80 >> (pptlMask->x & 0x07);
|
||||
|
@ -92,7 +85,7 @@ BltMask(SURFOBJ* psoDest,
|
|||
SrcX = pptlSource->x;
|
||||
}
|
||||
|
||||
if (psurfPattern)
|
||||
if (psoPattern)
|
||||
{
|
||||
PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
|
||||
if (PatternY < 0)
|
||||
|
@ -120,7 +113,7 @@ BltMask(SURFOBJ* psoDest,
|
|||
{
|
||||
Rop4 = (*pjMskCurrent & fjMaskBit) ? fgndRop : bkgndRop;
|
||||
|
||||
if(psurfPattern)
|
||||
if(psoPattern)
|
||||
{
|
||||
if(ROP4_USES_PATTERN(Rop4))
|
||||
Pattern = fnPattern_GetPixel(psoPattern, PatternX, PatternY);
|
||||
|
@ -152,7 +145,7 @@ BltMask(SURFOBJ* psoDest,
|
|||
pjMskCurrent += (fjMaskBit >> 7);
|
||||
}
|
||||
pjMskLine += psoMask->lDelta;
|
||||
if(psurfPattern)
|
||||
if(psoPattern)
|
||||
{
|
||||
PatternY++;
|
||||
PatternY %= PatternHeight;
|
||||
|
@ -165,12 +158,11 @@ BltMask(SURFOBJ* psoDest,
|
|||
}
|
||||
}
|
||||
|
||||
if (psurfPattern)
|
||||
SURFACE_ShareUnlockSurface(psurfPattern);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifndef _USE_DIBLIB_
|
||||
|
||||
static BOOLEAN APIENTRY
|
||||
BltPatCopy(SURFOBJ* Dest,
|
||||
SURFOBJ* Source,
|
||||
|
@ -204,10 +196,8 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
|||
ROP4 Rop4)
|
||||
{
|
||||
BLTINFO BltInfo;
|
||||
PEBRUSHOBJ GdiBrush = NULL;
|
||||
SURFACE *psurfPattern;
|
||||
SURFOBJ *psoPattern;
|
||||
BOOLEAN Result;
|
||||
HBITMAP hbmPattern;
|
||||
|
||||
BltInfo.DestSurface = OutputObj;
|
||||
BltInfo.SourceSurface = InputObj;
|
||||
|
@ -226,12 +216,10 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
|||
/* Pattern brush */
|
||||
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
||||
{
|
||||
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
||||
hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
|
||||
psurfPattern = SURFACE_ShareLockSurface(hbmPattern);
|
||||
if (psurfPattern)
|
||||
psoPattern = BRUSHOBJ_psoPattern(pbo);
|
||||
if (psoPattern)
|
||||
{
|
||||
BltInfo.PatternSurface = &psurfPattern->SurfObj;
|
||||
BltInfo.PatternSurface = psoPattern;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -240,17 +228,11 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
|||
}
|
||||
else
|
||||
{
|
||||
psurfPattern = NULL;
|
||||
psoPattern = NULL;
|
||||
}
|
||||
|
||||
Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
|
||||
|
||||
/* Pattern brush */
|
||||
if (psurfPattern)
|
||||
{
|
||||
SURFACE_ShareUnlockSurface(psurfPattern);
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -649,6 +631,7 @@ IntEngBitBlt(
|
|||
return bResult;
|
||||
}
|
||||
|
||||
#endif // !_USE_DIBLIB_
|
||||
|
||||
/**** REACTOS FONT RENDERING CODE *********************************************/
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
|
|||
/* Check if there's a GDI realisation */
|
||||
if (pebo->pengbrush)
|
||||
{
|
||||
EngDeleteSurface(pebo->pengbrush);
|
||||
/* Unlock the bitmap again */
|
||||
SURFACE_ShareUnlockSurface(pebo->pengbrush);
|
||||
pebo->pengbrush = NULL;
|
||||
}
|
||||
|
||||
|
@ -139,6 +140,7 @@ EngRealizeBrush(
|
|||
EBRUSHOBJ *pebo;
|
||||
HBITMAP hbmpRealize;
|
||||
SURFOBJ *psoRealize;
|
||||
PSURFACE psurfRealize;
|
||||
POINTL ptlSrc = {0, 0};
|
||||
RECTL rclDest;
|
||||
ULONG lWidth;
|
||||
|
@ -159,10 +161,13 @@ EngRealizeBrush(
|
|||
}
|
||||
|
||||
/* Lock the bitmap */
|
||||
psoRealize = EngLockSurface(hbmpRealize);
|
||||
if (!psoRealize)
|
||||
{
|
||||
psurfRealize = SURFACE_ShareLockSurface(hbmpRealize);
|
||||
|
||||
/* Already delete the pattern bitmap (will be kept until dereferenced) */
|
||||
EngDeleteSurface(hbmpRealize);
|
||||
|
||||
if (!psurfRealize)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -170,13 +175,12 @@ EngRealizeBrush(
|
|||
rclDest.left = rclDest.top = 0;
|
||||
rclDest.right = psoPattern->sizlBitmap.cx;
|
||||
rclDest.bottom = psoPattern->sizlBitmap.cy;
|
||||
psoRealize = &psurfRealize->SurfObj;
|
||||
EngCopyBits(psoRealize, psoPattern, NULL, pxlo, &rclDest, &ptlSrc);
|
||||
|
||||
/* Unlock the bitmap again */
|
||||
EngUnlockSurface(psoRealize);
|
||||
|
||||
pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
||||
pebo->pengbrush = (PVOID)hbmpRealize;
|
||||
pebo->pengbrush = (PVOID)psurfRealize;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -258,6 +262,17 @@ EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo)
|
|||
return pebo->pengbrush;
|
||||
}
|
||||
|
||||
SURFOBJ*
|
||||
NTAPI
|
||||
EBRUSHOBJ_psoPattern(EBRUSHOBJ *pebo)
|
||||
{
|
||||
PSURFACE psurfPattern;
|
||||
|
||||
psurfPattern = EBRUSHOBJ_pvGetEngBrush(pebo);
|
||||
|
||||
return psurfPattern ? &psurfPattern->SurfObj : NULL;
|
||||
}
|
||||
|
||||
|
||||
/** Exported DDI functions ****************************************************/
|
||||
|
||||
|
|
|
@ -35,11 +35,8 @@ CallDibStretchBlt(SURFOBJ* psoDest,
|
|||
ROP4 Rop4)
|
||||
{
|
||||
POINTL RealBrushOrigin;
|
||||
SURFACE* psurfPattern;
|
||||
PEBRUSHOBJ GdiBrush = NULL;
|
||||
SURFOBJ* PatternSurface = NULL;
|
||||
SURFOBJ* psoPattern;
|
||||
BOOL bResult;
|
||||
HBITMAP hbmPattern;
|
||||
|
||||
if (BrushOrigin == NULL)
|
||||
{
|
||||
|
@ -53,34 +50,20 @@ CallDibStretchBlt(SURFOBJ* psoDest,
|
|||
/* Pattern brush */
|
||||
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
||||
{
|
||||
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
||||
hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
|
||||
psurfPattern = SURFACE_ShareLockSurface(hbmPattern);
|
||||
if (psurfPattern)
|
||||
{
|
||||
PatternSurface = &psurfPattern->SurfObj;
|
||||
psoPattern = BRUSHOBJ_psoPattern(pbo);
|
||||
|
||||
if (!psoPattern) return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: What to do here? */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
psurfPattern = NULL;
|
||||
psoPattern = NULL;
|
||||
}
|
||||
|
||||
bResult = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
|
||||
psoDest, psoSource, Mask, PatternSurface,
|
||||
psoDest, psoSource, Mask, psoPattern,
|
||||
OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin,
|
||||
ColorTranslation, Rop4);
|
||||
|
||||
/* Pattern brush */
|
||||
if (psurfPattern)
|
||||
{
|
||||
SURFACE_ShareUnlockSurface(psurfPattern);
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,13 @@ PVOID
|
|||
NTAPI
|
||||
EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo);
|
||||
|
||||
SURFOBJ*
|
||||
NTAPI
|
||||
EBRUSHOBJ_psoPattern(EBRUSHOBJ *pebo);
|
||||
|
||||
#define BRUSHOBJ_psoPattern(pbo) \
|
||||
EBRUSHOBJ_psoPattern(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject))
|
||||
|
||||
BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD);
|
||||
BOOL FASTCALL GreSetBrushOwner(HBRUSH,DWORD);
|
||||
|
||||
|
|
Loading…
Reference in a new issue