mirror of
https://github.com/reactos/reactos.git
synced 2025-06-27 15:59:43 +00:00
[WIN32K]
- pass COLORADJUSTMENT to IntEngStretchBlt - IntEngStretchBlt, EngStretchBltROP, DrvStretchBltROP always use a source, ASSERT that - annotate pbrDefaultBrush and psurfDefaultBitmap as _Notnull_ - Don't use uninitialized psoInput in EngStretchBltROP - Use trivial CLIPOBJ instead of NULL in IntEngStretchBlt - Always pass a source surface to EngStretchBltROP svn path=/trunk/; revision=57008
This commit is contained in:
parent
299f58b5fa
commit
9fd18d4a19
6 changed files with 77 additions and 59 deletions
|
@ -86,6 +86,7 @@ IntEngStretchBlt(SURFOBJ *DestObj,
|
||||||
SURFOBJ *Mask,
|
SURFOBJ *Mask,
|
||||||
CLIPOBJ *ClipRegion,
|
CLIPOBJ *ClipRegion,
|
||||||
XLATEOBJ *ColorTranslation,
|
XLATEOBJ *ColorTranslation,
|
||||||
|
COLORADJUSTMENT *pca,
|
||||||
RECTL *DestRect,
|
RECTL *DestRect,
|
||||||
RECTL *SourceRect,
|
RECTL *SourceRect,
|
||||||
POINTL *pMaskOrigin,
|
POINTL *pMaskOrigin,
|
||||||
|
@ -152,14 +153,16 @@ IntEngSetPointerShape(
|
||||||
IN RECTL *prcl,
|
IN RECTL *prcl,
|
||||||
IN FLONG fl);
|
IN FLONG fl);
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL
|
||||||
IntEngAlphaBlend(IN SURFOBJ *Dest,
|
APIENTRY
|
||||||
IN SURFOBJ *Source,
|
IntEngAlphaBlend(
|
||||||
IN CLIPOBJ *ClipRegion,
|
_Inout_ SURFOBJ *psoDest,
|
||||||
IN XLATEOBJ *ColorTranslation,
|
_In_ SURFOBJ *psoSource,
|
||||||
IN PRECTL DestRect,
|
_In_opt_ CLIPOBJ *pco,
|
||||||
IN PRECTL SourceRect,
|
_In_opt_ XLATEOBJ *pxlo,
|
||||||
IN BLENDOBJ *BlendObj);
|
_In_ RECTL *prclDest,
|
||||||
|
_In_ RECTL *prclSrc,
|
||||||
|
_In_ BLENDOBJ *pBlendObj);
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
IntEngCopyBits(SURFOBJ *psoDest,
|
IntEngCopyBits(SURFOBJ *psoDest,
|
||||||
|
|
|
@ -169,6 +169,7 @@ EngStretchBltROP(
|
||||||
InputRect.right = OutputRect.right - OutputRect.left;
|
InputRect.right = OutputRect.right - OutputRect.left;
|
||||||
InputRect.top = 0;
|
InputRect.top = 0;
|
||||||
InputRect.bottom = OutputRect.bottom - OutputRect.top;
|
InputRect.bottom = OutputRect.bottom - OutputRect.top;
|
||||||
|
psoInput = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != ClipRegion)
|
if (NULL != ClipRegion)
|
||||||
|
@ -364,6 +365,7 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
SURFOBJ *MaskSurf,
|
SURFOBJ *MaskSurf,
|
||||||
CLIPOBJ *ClipRegion,
|
CLIPOBJ *ClipRegion,
|
||||||
XLATEOBJ *ColorTranslation,
|
XLATEOBJ *ColorTranslation,
|
||||||
|
COLORADJUSTMENT *pca,
|
||||||
RECTL *DestRect,
|
RECTL *DestRect,
|
||||||
RECTL *SourceRect,
|
RECTL *SourceRect,
|
||||||
POINTL *pMaskOrigin,
|
POINTL *pMaskOrigin,
|
||||||
|
@ -372,7 +374,6 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
DWORD Rop4)
|
DWORD Rop4)
|
||||||
{
|
{
|
||||||
BOOLEAN ret;
|
BOOLEAN ret;
|
||||||
COLORADJUSTMENT ca;
|
|
||||||
POINTL MaskOrigin = {0, 0};
|
POINTL MaskOrigin = {0, 0};
|
||||||
SURFACE *psurfDest;
|
SURFACE *psurfDest;
|
||||||
//SURFACE *psurfSource = NULL;
|
//SURFACE *psurfSource = NULL;
|
||||||
|
@ -383,9 +384,15 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
|
LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
|
||||||
|
|
||||||
ASSERT(psoDest);
|
ASSERT(psoDest);
|
||||||
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
ASSERT(psoSource);
|
||||||
ASSERT(psurfDest);
|
|
||||||
ASSERT(DestRect);
|
ASSERT(DestRect);
|
||||||
|
ASSERT(SourceRect);
|
||||||
|
ASSERT(!RECTL_bIsEmptyRect(SourceRect));
|
||||||
|
|
||||||
|
/* If no clip object is given, use trivial one */
|
||||||
|
if (!ClipRegion) ClipRegion = &gxcoTrivial.ClipObj;
|
||||||
|
|
||||||
|
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
ASSERT(IS_VALID_ROP4(Rop4));
|
ASSERT(IS_VALID_ROP4(Rop4));
|
||||||
|
@ -420,8 +427,6 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
InputClippedRect.bottom = DestRect->top;
|
InputClippedRect.bottom = DestRect->top;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
if (NULL == SourceRect || NULL == psoSource)
|
if (NULL == SourceRect || NULL == psoSource)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -434,7 +439,6 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
/* Everything clipped away, nothing to do */
|
/* Everything clipped away, nothing to do */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ClipRegion)
|
if (ClipRegion)
|
||||||
{
|
{
|
||||||
|
@ -473,18 +477,17 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
//psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
//psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare color adjustment */
|
|
||||||
|
|
||||||
/* Call the driver's DrvStretchBlt if available */
|
/* Call the driver's DrvStretchBlt if available */
|
||||||
if (psurfDest->flags & HOOK_STRETCHBLTROP)
|
if (psurfDest->flags & HOOK_STRETCHBLTROP)
|
||||||
{
|
{
|
||||||
/* Drv->StretchBltROP (look at http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm ) */
|
/* Drv->StretchBltROP (look at http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm ) */
|
||||||
ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest,
|
ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest,
|
||||||
(UsesSource) ? psoSource : NULL,
|
psoSource,
|
||||||
MaskSurf,
|
MaskSurf,
|
||||||
ClipRegion,
|
ClipRegion,
|
||||||
ColorTranslation,
|
ColorTranslation,
|
||||||
&ca, BrushOrigin,
|
pca,
|
||||||
|
BrushOrigin,
|
||||||
&OutputRect,
|
&OutputRect,
|
||||||
&InputRect,
|
&InputRect,
|
||||||
&MaskOrigin,
|
&MaskOrigin,
|
||||||
|
@ -496,11 +499,11 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
if (! ret)
|
if (! ret)
|
||||||
{
|
{
|
||||||
ret = EngStretchBltROP(psoDest,
|
ret = EngStretchBltROP(psoDest,
|
||||||
(UsesSource) ? psoSource : NULL,
|
psoSource,
|
||||||
MaskSurf,
|
MaskSurf,
|
||||||
ClipRegion,
|
ClipRegion,
|
||||||
ColorTranslation,
|
ColorTranslation,
|
||||||
&ca,
|
pca,
|
||||||
BrushOrigin,
|
BrushOrigin,
|
||||||
&OutputRect,
|
&OutputRect,
|
||||||
&InputRect,
|
&InputRect,
|
||||||
|
@ -535,9 +538,13 @@ NtGdiEngStretchBlt(
|
||||||
POINTL lMaskOrigin;
|
POINTL lMaskOrigin;
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
if (pca)
|
||||||
{
|
{
|
||||||
ProbeForRead(pca, sizeof(COLORADJUSTMENT), 1);
|
ProbeForRead(pca, sizeof(COLORADJUSTMENT), 1);
|
||||||
RtlCopyMemory(&ca,pca, sizeof(COLORADJUSTMENT));
|
RtlCopyMemory(&ca,pca, sizeof(COLORADJUSTMENT));
|
||||||
|
pca = &ca;
|
||||||
|
}
|
||||||
|
|
||||||
ProbeForRead(BrushOrigin, sizeof(POINTL), 1);
|
ProbeForRead(BrushOrigin, sizeof(POINTL), 1);
|
||||||
RtlCopyMemory(&lBrushOrigin, BrushOrigin, sizeof(POINTL));
|
RtlCopyMemory(&lBrushOrigin, BrushOrigin, sizeof(POINTL));
|
||||||
|
@ -558,7 +565,7 @@ NtGdiEngStretchBlt(
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
return EngStretchBlt(psoDest, psoSource, Mask, ClipRegion, ColorTranslation, &ca, &lBrushOrigin, &rclDest, &rclSrc, &lMaskOrigin, Mode);
|
return EngStretchBlt(psoDest, psoSource, Mask, ClipRegion, ColorTranslation, pca, &lBrushOrigin, &rclDest, &rclSrc, &lMaskOrigin, Mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -67,7 +67,7 @@ TranslateCOLORREF(PDC pdc, COLORREF crColor)
|
||||||
return index;
|
return index;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DPRINT("Unsupported color type %d passed\n", crColor >> 24);
|
DPRINT("Unsupported color type %u passed\n", crColor >> 24);
|
||||||
crColor &= 0xFFFFFF;
|
crColor &= 0xFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ NtGdiAlphaBlend(
|
||||||
ahDC[1] = hDCSrc ;
|
ahDC[1] = hDCSrc ;
|
||||||
if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
|
DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ NtGdiTransparentBlt(
|
||||||
ahDC[1] = hdcSrc ;
|
ahDC[1] = hdcSrc ;
|
||||||
if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc);
|
DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc);
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ NtGdiMaskBlt(
|
||||||
ahDC[1] = UsesSource ? hdcSrc : NULL;
|
ahDC[1] = UsesSource ? hdcSrc : NULL;
|
||||||
if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDest, hdcSrc);
|
DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hdcDest, hdcSrc);
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ NtGdiMaskBlt(
|
||||||
if (NULL == DCDest)
|
if (NULL == DCDest)
|
||||||
{
|
{
|
||||||
if(DCSrc) DC_UnlockDc(DCSrc);
|
if(DCSrc) DC_UnlockDc(DCSrc);
|
||||||
DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hdcDest);
|
DPRINT("Invalid destination dc handle (0x%p) passed to NtGdiBitBlt\n", hdcDest);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +487,13 @@ NtGdiMaskBlt(
|
||||||
SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left;
|
SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left;
|
||||||
SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ;
|
SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SourceRect.left = 0;
|
||||||
|
SourceRect.top = 0;
|
||||||
|
SourceRect.right = 0;
|
||||||
|
SourceRect.bottom = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Prepare blit */
|
/* Prepare blit */
|
||||||
DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect);
|
DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect);
|
||||||
|
@ -619,7 +626,7 @@ GreStretchBltMask(
|
||||||
ahDC[2] = UsesMask ? hDCMask : NULL;
|
ahDC[2] = UsesMask ? hDCMask : NULL;
|
||||||
if (!GDIOBJ_bLockMultipleObjects(3, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
if (!GDIOBJ_bLockMultipleObjects(3, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
|
DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -728,10 +735,11 @@ GreStretchBltMask(
|
||||||
|
|
||||||
/* Perform the bitblt operation */
|
/* Perform the bitblt operation */
|
||||||
Status = IntEngStretchBlt(&BitmapDest->SurfObj,
|
Status = IntEngStretchBlt(&BitmapDest->SurfObj,
|
||||||
&BitmapSrc->SurfObj,
|
BitmapSrc ? &BitmapSrc->SurfObj : NULL,
|
||||||
BitmapMask ? &BitmapMask->SurfObj : NULL,
|
BitmapMask ? &BitmapMask->SurfObj : NULL,
|
||||||
DCDest->rosdc.CombinedClip,
|
DCDest->rosdc.CombinedClip,
|
||||||
XlateObj,
|
XlateObj,
|
||||||
|
&DCDest->dclevel.ca,
|
||||||
&DestRect,
|
&DestRect,
|
||||||
&SourceRect,
|
&SourceRect,
|
||||||
BitmapMask ? &MaskPoint : NULL,
|
BitmapMask ? &MaskPoint : NULL,
|
||||||
|
|
|
@ -265,7 +265,7 @@ DC_vSelectPalette(PDC pdc, PPALETTE ppal)
|
||||||
pdc->dclevel.ppal = ppal;
|
pdc->dclevel.ppal = ppal;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern PBRUSH pbrDefaultBrush ;
|
extern _Notnull_ PBRUSH pbrDefaultBrush;
|
||||||
extern PSURFACE psurfDefaultBitmap;
|
extern _Notnull_ PSURFACE psurfDefaultBitmap;
|
||||||
|
|
||||||
#endif /* not __WIN32K_DC_H */
|
#endif /* not __WIN32K_DC_H */
|
||||||
|
|
|
@ -439,16 +439,15 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
goto Exit2;
|
goto Exit2;
|
||||||
}
|
}
|
||||||
if (pDC->dctype == DC_TYPE_INFO)
|
|
||||||
|
pSurf = pDC->dclevel.pSurface;
|
||||||
|
if ((pDC->dctype == DC_TYPE_INFO) || !pSurf)
|
||||||
{
|
{
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
goto Exit2;
|
goto Exit2;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSurf = pDC->dclevel.pSurface;
|
pDestSurf = &pSurf->SurfObj;
|
||||||
if(!pSurf) pSurf = psurfDefaultBitmap;
|
|
||||||
|
|
||||||
pDestSurf = pSurf ? &pSurf->SurfObj : NULL;
|
|
||||||
|
|
||||||
ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan);
|
ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan);
|
||||||
|
|
||||||
|
@ -1175,6 +1174,7 @@ NtGdiStretchDIBitsInternal(
|
||||||
NULL,
|
NULL,
|
||||||
pdc->rosdc.CombinedClip,
|
pdc->rosdc.CombinedClip,
|
||||||
&exlo.xlo,
|
&exlo.xlo,
|
||||||
|
&pdc->dclevel.ca,
|
||||||
&rcDst,
|
&rcDst,
|
||||||
&rcSrc,
|
&rcSrc,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1474,7 +1474,7 @@ DIB_CreateDIBSection(
|
||||||
//SIZEL Size;
|
//SIZEL Size;
|
||||||
HANDLE hSecure;
|
HANDLE hSecure;
|
||||||
|
|
||||||
DPRINT("format (%ld,%ld), planes %d, bpp %d, size %ld, colors %ld (%s)\n",
|
DPRINT("format (%ld,%ld), planes %u, bpp %u, size %lu, colors %lu (%s)\n",
|
||||||
bi->biWidth, bi->biHeight, bi->biPlanes, bi->biBitCount,
|
bi->biWidth, bi->biHeight, bi->biPlanes, bi->biBitCount,
|
||||||
bi->biSizeImage, bi->biClrUsed, usage == DIB_PAL_COLORS? "PAL" : "RGB");
|
bi->biSizeImage, bi->biClrUsed, usage == DIB_PAL_COLORS? "PAL" : "RGB");
|
||||||
|
|
||||||
|
@ -1608,7 +1608,7 @@ DIB_CreateDIBSection(
|
||||||
cleanup:
|
cleanup:
|
||||||
if (!res || !bmp || !bm.bmBits)
|
if (!res || !bmp || !bm.bmBits)
|
||||||
{
|
{
|
||||||
DPRINT("Got an error res=%08x, bmp=%p, bm.bmBits=%p\n", res, bmp, bm.bmBits);
|
DPRINT("Got an error res=%p, bmp=%p, bm.bmBits=%p\n", res, bmp, bm.bmBits);
|
||||||
if (bm.bmBits)
|
if (bm.bmBits)
|
||||||
{
|
{
|
||||||
// MmUnsecureVirtualMemory(hSecure); // FIXME: Implement this!
|
// MmUnsecureVirtualMemory(hSecure); // FIXME: Implement this!
|
||||||
|
@ -1677,7 +1677,7 @@ DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
|
||||||
*size = header->biSizeImage;
|
*size = header->biSizeImage;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
DPRINT1("(%d): unknown/wrong size for header\n", header->biSize );
|
DPRINT1("(%u): unknown/wrong size for header\n", header->biSize );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue