From 299f58b5fa427f107f865356005bf926120e401e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 31 Jul 2012 18:53:17 +0000 Subject: [PATCH] [WIN32K] - Use a global trivial CLIPOBJ if a NULL one is passed - Don't pass a pointer to uninitialized memory to DrvBitBlt svn path=/trunk/; revision=57007 --- reactos/win32ss/gdi/eng/bitblt.c | 11 ++++++++++- reactos/win32ss/gdi/eng/bitblt_new.c | 9 ++++++--- reactos/win32ss/gdi/eng/engobjects.h | 5 +++++ reactos/win32ss/gdi/eng/transblt.c | 7 +++++-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/reactos/win32ss/gdi/eng/bitblt.c b/reactos/win32ss/gdi/eng/bitblt.c index a956cbf4530..3031a8952b8 100644 --- a/reactos/win32ss/gdi/eng/bitblt.c +++ b/reactos/win32ss/gdi/eng/bitblt.c @@ -12,6 +12,12 @@ #define NDEBUG #include +XCLIPOBJ gxcoTrivial = +{ + {0, {LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX}, DC_TRIVIAL, FC_RECT, TC_RECTANGLES, 0}, + 0, 0, 0 +}; + typedef BOOLEAN (APIENTRY *PBLTRECTFUNC)(SURFOBJ* OutputObj, SURFOBJ* InputObj, SURFOBJ* Mask, @@ -590,6 +596,8 @@ IntEngBitBlt( if (pco->iDComplexity == DC_RECT) pco = NULL; } + else + pco = &gxcoTrivial.ClipObj; if (ROP4_USES_SOURCE(Rop4)) { @@ -601,6 +609,7 @@ IntEngBitBlt( rclSrc.top = pptlSrc->y + rclClipped.top - prclTrg->top; rclSrc.right = rclSrc.left + rclClipped.right - rclClipped.left; rclSrc.bottom = rclSrc.top + rclClipped.bottom - rclClipped.top; + pptlSrc = (PPOINTL)&rclSrc; } else { @@ -647,7 +656,7 @@ IntEngBitBlt( pco, pxlo, &rclClipped, - (POINTL*)&rclSrc, + pptlSrc, pptlMask, pbo, pptlBrush ? &ptlBrush : NULL, diff --git a/reactos/win32ss/gdi/eng/bitblt_new.c b/reactos/win32ss/gdi/eng/bitblt_new.c index 9f4dc4024e0..6acd68570b4 100644 --- a/reactos/win32ss/gdi/eng/bitblt_new.c +++ b/reactos/win32ss/gdi/eng/bitblt_new.c @@ -5,9 +5,12 @@ DBG_DEFAULT_CHANNEL(GdiFont); #define SURFOBJ_flags(pso) (CONTAINING_RECORD(pso, SURFACE, SurfObj)->flags) -#define XCLIPOBJ CLIPGDI - -XCLIPOBJ gxcoTrivial; +// FIXME this needs to be updated, once we use the new structure +XCLIPOBJ gxcoTrivial = +{ + {0, {LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX}, DC_TRIVIAL, FC_RECT, TC_RECTANGLES, 0}, + 0, 0, 0 +}; static diff --git a/reactos/win32ss/gdi/eng/engobjects.h b/reactos/win32ss/gdi/eng/engobjects.h index 459b7a73266..12840a84a3d 100644 --- a/reactos/win32ss/gdi/eng/engobjects.h +++ b/reactos/win32ss/gdi/eng/engobjects.h @@ -75,6 +75,11 @@ typedef struct _CLIPGDI { ENUMRECTS EnumRects; } CLIPGDI, *PCLIPGDI; +// HACK, until we use the original structure +#define XCLIPOBJ CLIPGDI + +extern XCLIPOBJ gxcoTrivial; + /*ei What is this for? */ typedef struct _DRVFUNCTIONSGDI { HDEV hdev; diff --git a/reactos/win32ss/gdi/eng/transblt.c b/reactos/win32ss/gdi/eng/transblt.c index 9b19e461e54..0b931cd4212 100644 --- a/reactos/win32ss/gdi/eng/transblt.c +++ b/reactos/win32ss/gdi/eng/transblt.c @@ -1,4 +1,4 @@ -/* +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: GDI TransparentBlt Function @@ -226,6 +226,9 @@ IntEngTransparentBlt(SURFOBJ *psoDest, ASSERT(psurfDest); ASSERT(psurfSource); + /* If no clip object is given, use trivial one */ + if (!Clip) Clip = &gxcoTrivial.ClipObj; + InputClippedRect = *DestRect; if(InputClippedRect.right < InputClippedRect.left) { @@ -241,7 +244,7 @@ IntEngTransparentBlt(SURFOBJ *psoDest, InputRect = *SourceRect; /* Clip against the bounds of the clipping region so we won't try to write * outside the surface */ - if(Clip) + if (Clip->iDComplexity != DC_TRIVIAL) { if(!RECTL_bIntersectRect(&OutputRect, &InputClippedRect, &Clip->rclBounds)) {