Author: tkreuzer
Date: Tue Jul 31 20:44:56 2012
New Revision: 57008
URL:
http://svn.reactos.org/svn/reactos?rev=57008&view=rev
Log:
[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
Modified:
trunk/reactos/win32ss/gdi/eng/inteng.h
trunk/reactos/win32ss/gdi/eng/stretchblt.c
trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
trunk/reactos/win32ss/gdi/ntgdi/dc.h
trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
trunk/reactos/win32ss/user/ntuser/winsta.c
Modified: trunk/reactos/win32ss/gdi/eng/inteng.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/inteng.h?r…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/inteng.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/inteng.h [iso-8859-1] Tue Jul 31 20:44:56 2012
@@ -86,6 +86,7 @@
SURFOBJ *Mask,
CLIPOBJ *ClipRegion,
XLATEOBJ *ColorTranslation,
+ COLORADJUSTMENT *pca,
RECTL *DestRect,
RECTL *SourceRect,
POINTL *pMaskOrigin,
@@ -152,14 +153,16 @@
IN RECTL *prcl,
IN FLONG fl);
-BOOL APIENTRY
-IntEngAlphaBlend(IN SURFOBJ *Dest,
- IN SURFOBJ *Source,
- IN CLIPOBJ *ClipRegion,
- IN XLATEOBJ *ColorTranslation,
- IN PRECTL DestRect,
- IN PRECTL SourceRect,
- IN BLENDOBJ *BlendObj);
+BOOL
+APIENTRY
+IntEngAlphaBlend(
+ _Inout_ SURFOBJ *psoDest,
+ _In_ SURFOBJ *psoSource,
+ _In_opt_ CLIPOBJ *pco,
+ _In_opt_ XLATEOBJ *pxlo,
+ _In_ RECTL *prclDest,
+ _In_ RECTL *prclSrc,
+ _In_ BLENDOBJ *pBlendObj);
BOOL APIENTRY
IntEngCopyBits(SURFOBJ *psoDest,
Modified: trunk/reactos/win32ss/gdi/eng/stretchblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stretchblt…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] Tue Jul 31 20:44:56 2012
@@ -169,6 +169,7 @@
InputRect.right = OutputRect.right - OutputRect.left;
InputRect.top = 0;
InputRect.bottom = OutputRect.bottom - OutputRect.top;
+ psoInput = NULL;
}
if (NULL != ClipRegion)
@@ -364,6 +365,7 @@
SURFOBJ *MaskSurf,
CLIPOBJ *ClipRegion,
XLATEOBJ *ColorTranslation,
+ COLORADJUSTMENT *pca,
RECTL *DestRect,
RECTL *SourceRect,
POINTL *pMaskOrigin,
@@ -372,7 +374,6 @@
DWORD Rop4)
{
BOOLEAN ret;
- COLORADJUSTMENT ca;
POINTL MaskOrigin = {0, 0};
SURFACE *psurfDest;
//SURFACE *psurfSource = NULL;
@@ -383,9 +384,15 @@
LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
ASSERT(psoDest);
+ ASSERT(psoSource);
+ 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);
- ASSERT(psurfDest);
- ASSERT(DestRect);
/* Sanity check */
ASSERT(IS_VALID_ROP4(Rop4));
@@ -420,20 +427,17 @@
InputClippedRect.bottom = DestRect->top;
}
- if (UsesSource)
- {
- if (NULL == SourceRect || NULL == psoSource)
- {
- return FALSE;
- }
- InputRect = *SourceRect;
-
- if (InputRect.right < InputRect.left ||
- InputRect.bottom < InputRect.top)
- {
- /* Everything clipped away, nothing to do */
- return TRUE;
- }
+ if (NULL == SourceRect || NULL == psoSource)
+ {
+ return FALSE;
+ }
+ InputRect = *SourceRect;
+
+ if (InputRect.right < InputRect.left ||
+ InputRect.bottom < InputRect.top)
+ {
+ /* Everything clipped away, nothing to do */
+ return TRUE;
}
if (ClipRegion)
@@ -473,18 +477,17 @@
//psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
}
- /* Prepare color adjustment */
-
/* Call the driver's DrvStretchBlt if available */
if (psurfDest->flags & HOOK_STRETCHBLTROP)
{
/* Drv->StretchBltROP (look at
http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm ) */
ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest,
- (UsesSource) ? psoSource : NULL,
+ psoSource,
MaskSurf,
ClipRegion,
ColorTranslation,
- &ca, BrushOrigin,
+ pca,
+ BrushOrigin,
&OutputRect,
&InputRect,
&MaskOrigin,
@@ -496,11 +499,11 @@
if (! ret)
{
ret = EngStretchBltROP(psoDest,
- (UsesSource) ? psoSource : NULL,
+ psoSource,
MaskSurf,
ClipRegion,
ColorTranslation,
- &ca,
+ pca,
BrushOrigin,
&OutputRect,
&InputRect,
@@ -536,8 +539,12 @@
_SEH2_TRY
{
- ProbeForRead(pca, sizeof(COLORADJUSTMENT), 1);
- RtlCopyMemory(&ca,pca, sizeof(COLORADJUSTMENT));
+ if (pca)
+ {
+ ProbeForRead(pca, sizeof(COLORADJUSTMENT), 1);
+ RtlCopyMemory(&ca,pca, sizeof(COLORADJUSTMENT));
+ pca = &ca;
+ }
ProbeForRead(BrushOrigin, sizeof(POINTL), 1);
RtlCopyMemory(&lBrushOrigin, BrushOrigin, sizeof(POINTL));
@@ -558,7 +565,7 @@
}
_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 */
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Tue Jul 31 20:44:56 2012
@@ -67,7 +67,7 @@
return index;
default:
- DPRINT("Unsupported color type %d passed\n", crColor >> 24);
+ DPRINT("Unsupported color type %u passed\n", crColor >> 24);
crColor &= 0xFFFFFF;
}
@@ -122,7 +122,7 @@
ahDC[1] = hDCSrc ;
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);
return FALSE;
}
@@ -270,7 +270,7 @@
ahDC[1] = hdcSrc ;
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);
return FALSE;
}
@@ -424,7 +424,7 @@
ahDC[1] = UsesSource ? hdcSrc : NULL;
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);
return FALSE;
}
@@ -435,7 +435,7 @@
if (NULL == DCDest)
{
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;
}
@@ -486,6 +486,13 @@
SourceRect.top = SourcePoint.y;
SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left;
SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ;
+ }
+ else
+ {
+ SourceRect.left = 0;
+ SourceRect.top = 0;
+ SourceRect.right = 0;
+ SourceRect.bottom = 0;
}
/* Prepare blit */
@@ -619,7 +626,7 @@
ahDC[2] = UsesMask ? hDCMask : NULL;
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);
return FALSE;
}
@@ -728,10 +735,11 @@
/* Perform the bitblt operation */
Status = IntEngStretchBlt(&BitmapDest->SurfObj,
- &BitmapSrc->SurfObj,
+ BitmapSrc ? &BitmapSrc->SurfObj : NULL,
BitmapMask ? &BitmapMask->SurfObj : NULL,
DCDest->rosdc.CombinedClip,
XlateObj,
+ &DCDest->dclevel.ca,
&DestRect,
&SourceRect,
BitmapMask ? &MaskPoint : NULL,
Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dc.h?rev…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Tue Jul 31 20:44:56 2012
@@ -265,7 +265,7 @@
pdc->dclevel.ppal = ppal;
}
-extern PBRUSH pbrDefaultBrush ;
-extern PSURFACE psurfDefaultBitmap;
+extern _Notnull_ PBRUSH pbrDefaultBrush;
+extern _Notnull_ PSURFACE psurfDefaultBitmap;
#endif /* not __WIN32K_DC_H */
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Tue Jul 31 20:44:56 2012
@@ -439,16 +439,15 @@
EngSetLastError(ERROR_INVALID_HANDLE);
goto Exit2;
}
- if (pDC->dctype == DC_TYPE_INFO)
+
+ pSurf = pDC->dclevel.pSurface;
+ if ((pDC->dctype == DC_TYPE_INFO) || !pSurf)
{
DC_UnlockDc(pDC);
goto Exit2;
}
- pSurf = pDC->dclevel.pSurface;
- if(!pSurf) pSurf = psurfDefaultBitmap;
-
- pDestSurf = pSurf ? &pSurf->SurfObj : NULL;
+ pDestSurf = &pSurf->SurfObj;
ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan);
@@ -1175,6 +1174,7 @@
NULL,
pdc->rosdc.CombinedClip,
&exlo.xlo,
+ &pdc->dclevel.ca,
&rcDst,
&rcSrc,
NULL,
@@ -1474,7 +1474,7 @@
//SIZEL Size;
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->biSizeImage, bi->biClrUsed, usage == DIB_PAL_COLORS? "PAL"
: "RGB");
@@ -1608,7 +1608,7 @@
cleanup:
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)
{
// MmUnsecureVirtualMemory(hSecure); // FIXME: Implement this!
@@ -1677,7 +1677,7 @@
*size = header->biSizeImage;
return 1;
}
- DPRINT1("(%d): unknown/wrong size for header\n", header->biSize );
+ DPRINT1("(%u): unknown/wrong size for header\n", header->biSize );
return -1;
}
Modified: trunk/reactos/win32ss/user/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] Tue Jul 31 20:44:56 2012
@@ -61,19 +61,19 @@
}
else
{
- swprintf(wstrWindowStationsDir,
- L"%ws\\%ld%ws",
- SESSION_DIR,
- Peb->SessionId,
+ swprintf(wstrWindowStationsDir,
+ L"%ws\\%ld%ws",
+ SESSION_DIR,
+ Peb->SessionId,
WINSTA_OBJ_DIR);
RtlCreateUnicodeString( &gustrWindowStationsDir, wstrWindowStationsDir);
}
- InitializeObjectAttributes(&ObjectAttributes,
- &gustrWindowStationsDir,
- 0,
- NULL,
+ InitializeObjectAttributes(&ObjectAttributes,
+ &gustrWindowStationsDir,
+ 0,
+ NULL,
NULL);
Status = ZwCreateDirectoryObject(&hWinstaDir, 0, &ObjectAttributes);
if (!NT_SUCCESS(Status))
@@ -433,7 +433,7 @@
InitCursorImpl();
}
- TRACE("NtUserCreateWindowStation created object 0x%x with name %wZ handle
0x%x\n",
+ TRACE("NtUserCreateWindowStation created object 0x%x with name %wZ handle
0x%x\n",
WindowStation, &WindowStationObject->Name, WindowStation);
return WindowStation;
}
@@ -631,7 +631,7 @@
Status = IntValidateDesktopHandle(
hObject,
UserMode,
- 0,
+ 0,
&DesktopObject);
if (!NT_SUCCESS(Status))
{