Implement clipping for bitblt operations

svn path=/trunk/; revision=4985
This commit is contained in:
Gé van Geldorp 2003-06-28 08:39:18 +00:00
parent 5e61f5b601
commit 9389c797ef
8 changed files with 253 additions and 104 deletions

View file

@ -7,6 +7,36 @@
#include "bitblt.h" #include "bitblt.h"
typedef BOOL (*PFN_VGABlt)(SURFOBJ*, SURFOBJ*, XLATEOBJ*, RECTL*, POINTL*); typedef BOOL (*PFN_VGABlt)(SURFOBJ*, SURFOBJ*, XLATEOBJ*, RECTL*, POINTL*);
typedef BOOL STDCALL (*PBLTRECTFUNC)(PSURFOBJ OutputObj,
PSURFOBJ InputObj,
PSURFOBJ Mask,
PXLATEOBJ ColorTranslation,
PRECTL OutputRect,
PPOINTL InputPoint,
PPOINTL MaskOrigin,
PBRUSHOBJ Brush,
PPOINTL BrushOrigin,
ROP4 Rop4);
static BOOL FASTCALL VGADDI_IntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
{
static const RECTL rclEmpty = { 0, 0, 0, 0 };
prcDst->left = max(prcSrc1->left, prcSrc2->left);
prcDst->right = min(prcSrc1->right, prcSrc2->right);
if (prcDst->left < prcDst->right)
{
prcDst->top = max(prcSrc1->top, prcSrc2->top);
prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom);
if (prcDst->top < prcDst->bottom) return(TRUE);
}
*prcDst = rclEmpty;
return(FALSE);
}
BOOL BOOL
DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation, DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
@ -164,8 +194,10 @@ VGAtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
} }
BOOL STDCALL BOOL STDCALL
VGADDI_BltBrush(SURFOBJ* Dest, XLATEOBJ* ColorTranslation, RECTL* DestRect, VGADDI_BltBrush(PSURFOBJ Dest, PSURFOBJ Source, PSURFOBJ MaskSurf,
BRUSHOBJ* Brush, POINTL* BrushPoint, ROP4 Rop4) PXLATEOBJ ColorTranslation, PRECT DestRect,
PPOINTL SourcePoint, PPOINTL MaskPoint,
PBRUSHOBJ Brush, PPOINTL BrushPoint, ROP4 Rop4)
{ {
UCHAR SolidColor; UCHAR SolidColor;
ULONG Left; ULONG Left;
@ -267,8 +299,9 @@ VGADDI_BltBrush(SURFOBJ* Dest, XLATEOBJ* ColorTranslation, RECTL* DestRect,
} }
BOOL STDCALL BOOL STDCALL
VGADDI_BltSrc(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation, VGADDI_BltSrc(PSURFOBJ Dest, PSURFOBJ Source, PSURFOBJ Mask,
RECTL *DestRect, POINTL *SourcePoint) PXLATEOBJ ColorTranslation, PRECTL DestRect, PPOINTL SourcePoint,
PPOINTL MaskOrigin, PBRUSHOBJ Brush, PPOINTL BrushOrigin, ROP4 Rop4)
{ {
RECT_ENUM RectEnum; RECT_ENUM RectEnum;
BOOL EnumMore; BOOL EnumMore;
@ -308,9 +341,10 @@ VGADDI_BltSrc(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
} }
BOOL STDCALL BOOL STDCALL
VGADDI_BltMask(SURFOBJ *Dest, SURFOBJ *Mask, XLATEOBJ *ColorTranslation, VGADDI_BltMask(PSURFOBJ Dest, PSURFOBJ Source, PSURFOBJ Mask,
RECTL *DestRect, POINTL *MaskPoint, BRUSHOBJ* Brush, PXLATEOBJ ColorTranslation, PRECTL DestRect,
POINTL* BrushPoint) PPOINTL SourcePoint, PPOINTL MaskPoint, BRUSHOBJ* Brush,
PPOINTL BrushPoint, ROP4 Rop4)
{ {
LONG i, j, dx, dy, idxColor, RGBulong = 0, c8; LONG i, j, dx, dy, idxColor, RGBulong = 0, c8;
BYTE *initial, *tMask, *lMask; BYTE *initial, *tMask, *lMask;
@ -355,36 +389,71 @@ DrvBitBlt(SURFOBJ *Dest,
POINTL *BrushPoint, POINTL *BrushPoint,
ROP4 rop4) ROP4 rop4)
{ {
/* Punt bitblts with complex clipping to the GDI. */ PBLTRECTFUNC BltRectFunc;
if (Clip != NULL) RECTL CombinedRect;
{ BOOL Ret;
return(FALSE); RECT_ENUM RectEnum;
} BOOL EnumMore;
unsigned i;
switch (rop4) switch (rop4)
{ {
case BLACKNESS: case BLACKNESS:
case PATCOPY: case PATCOPY:
case WHITENESS: case WHITENESS:
return(VGADDI_BltBrush(Dest, ColorTranslation, DestRect, Brush, BltRectFunc = VGADDI_BltBrush;
BrushPoint, rop4)); break;
case SRCCOPY: case SRCCOPY:
if (BMF_4BPP == Source->iBitmapFormat && BMF_4BPP == Dest->iBitmapFormat) if (BMF_4BPP == Source->iBitmapFormat && BMF_4BPP == Dest->iBitmapFormat)
{ {
return(VGADDI_BltSrc(Dest, Source, ColorTranslation, DestRect, BltRectFunc = VGADDI_BltSrc;
SourcePoint));
} }
else else
{ {
return FALSE; return FALSE;
} }
case 0xAACC: case 0xAACC:
return(VGADDI_BltMask(Dest, Mask, ColorTranslation, DestRect, BltRectFunc = VGADDI_BltMask;
MaskPoint, Brush, BrushPoint)); break;
default: default:
return(FALSE); return FALSE;
} }
switch(NULL == Clip ? DC_TRIVIAL : Clip->iDComplexity)
{
case DC_TRIVIAL:
Ret = (*BltRectFunc)(Dest, Source, Mask, ColorTranslation, DestRect,
SourcePoint, MaskPoint, Brush, BrushPoint,
rop4);
break;
case DC_RECT:
// Clip the blt to the clip rectangle
VGADDI_IntersectRect(&CombinedRect, DestRect, &(Clip->rclBounds));
Ret = (*BltRectFunc)(Dest, Source, Mask, ColorTranslation, &CombinedRect,
SourcePoint, MaskPoint, Brush, BrushPoint,
rop4);
break;
case DC_COMPLEX:
Ret = TRUE;
CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_ANY, ENUM_RECT_LIMIT);
do
{
EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c; i++)
{
VGADDI_IntersectRect(&CombinedRect, DestRect, RectEnum.arcl + i);
Ret = (*BltRectFunc)(Dest, Source, Mask, ColorTranslation, &CombinedRect,
SourcePoint, MaskPoint, Brush, BrushPoint, rop4) &&
Ret;
}
}
while (EnumMore);
break;
}
return Ret;
} }

View file

@ -98,6 +98,8 @@ typedef struct _DC
INT vportExtX; /* Viewport extent */ INT vportExtX; /* Viewport extent */
INT vportExtY; INT vportExtY;
CLIPOBJ *CombinedClip;
INT saveLevel; INT saveLevel;
WIN_DC_INFO w; WIN_DC_INFO w;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: bitblt.c,v 1.20 2003/05/18 17:16:17 ea Exp $ /* $Id: bitblt.c,v 1.21 2003/06/28 08:39:18 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -46,6 +46,19 @@
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
typedef BOOLEAN STDCALL (*PBLTRECTFUNC)(PSURFOBJ OutputObj,
PSURFGDI OutputGDI,
PSURFOBJ InputObj,
PSURFGDI InputGDI,
PSURFOBJ Mask,
PXLATEOBJ ColorTranslation,
PRECTL OutputRect,
PPOINTL InputPoint,
PPOINTL MaskOrigin,
PBRUSHOBJ Brush,
PPOINTL BrushOrigin,
ROP4 Rop4);
BOOL STDCALL EngIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2) BOOL STDCALL EngIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
{ {
static const RECTL rclEmpty = { 0, 0, 0, 0 }; static const RECTL rclEmpty = { 0, 0, 0, 0 };
@ -66,10 +79,19 @@ BOOL STDCALL EngIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
return(FALSE); return(FALSE);
} }
static BOOL STDCALL static BOOLEAN STDCALL
BltMask(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask, BltMask(PSURFOBJ Dest,
RECTL *DestRect, POINTL *MaskPoint, BRUSHOBJ* Brush, PSURFGDI DestGDI,
POINTL* BrushPoint) PSURFOBJ Source,
PSURFGDI SourceGDI,
PSURFOBJ Mask,
PXLATEOBJ ColorTranslation,
PRECTL DestRect,
PPOINTL SourcePoint,
PPOINTL MaskPoint,
PBRUSHOBJ Brush,
PPOINTL BrushPoint,
ROP4 Rop4)
{ {
LONG i, j, dx, dy, c8; LONG i, j, dx, dy, c8;
BYTE *tMask, *lMask; BYTE *tMask, *lMask;
@ -108,10 +130,19 @@ BltMask(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
} }
} }
static BOOL STDCALL static BOOLEAN STDCALL
BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask, BltPatCopy(PSURFOBJ Dest,
RECTL *DestRect, POINTL *MaskPoint, BRUSHOBJ* Brush, PSURFGDI DestGDI,
POINTL* BrushPoint) PSURFOBJ Source,
PSURFGDI SourceGDI,
PSURFOBJ Mask,
PXLATEOBJ ColorTranslation,
PRECTL DestRect,
PPOINTL SourcePoint,
PPOINTL MaskPoint,
PBRUSHOBJ Brush,
PPOINTL BrushPoint,
ROP4 Rop4)
{ {
// These functions are assigned if we're working with a DIB // These functions are assigned if we're working with a DIB
// The assigned functions depend on the bitsPerPixel of the DIB // The assigned functions depend on the bitsPerPixel of the DIB
@ -127,6 +158,23 @@ BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
return TRUE; return TRUE;
} }
static BOOLEAN STDCALL
CallDibBitBlt(PSURFOBJ OutputObj,
PSURFGDI OutputGDI,
PSURFOBJ InputObj,
PSURFGDI InputGDI,
PSURFOBJ Mask,
PXLATEOBJ ColorTranslation,
PRECTL OutputRect,
PPOINTL InputPoint,
PPOINTL MaskOrigin,
PBRUSHOBJ Brush,
PPOINTL BrushOrigin,
ROP4 Rop4)
{
return OutputGDI->DIB_BitBlt(OutputObj, InputObj, OutputGDI, InputGDI, OutputRect, InputPoint, ColorTranslation);
}
INT abs(INT nm); INT abs(INT nm);
BOOL STDCALL BOOL STDCALL
@ -140,12 +188,10 @@ EngBitBlt(SURFOBJ *DestObj,
POINTL *MaskOrigin, POINTL *MaskOrigin,
BRUSHOBJ *Brush, BRUSHOBJ *Brush,
POINTL *BrushOrigin, POINTL *BrushOrigin,
ROP4 rop4) ROP4 Rop4)
{ {
BOOLEAN ret;
BYTE clippingType; BYTE clippingType;
RECTL rclTmp; RECTL CombinedRect;
POINTL ptlTmp;
RECT_ENUM RectEnum; RECT_ENUM RectEnum;
BOOL EnumMore; BOOL EnumMore;
PSURFGDI OutputGDI, InputGDI; PSURFGDI OutputGDI, InputGDI;
@ -157,6 +203,10 @@ EngBitBlt(SURFOBJ *DestObj,
INTENG_ENTER_LEAVE EnterLeaveDest; INTENG_ENTER_LEAVE EnterLeaveDest;
PSURFOBJ InputObj; PSURFOBJ InputObj;
PSURFOBJ OutputObj; PSURFOBJ OutputObj;
PBLTRECTFUNC BltRectFunc;
BOOLEAN Ret;
RECTL ClipRect;
unsigned i;
/* Check for degenerate case: if height or width of DestRect is 0 pixels there's /* Check for degenerate case: if height or width of DestRect is 0 pixels there's
nothing to do */ nothing to do */
@ -222,7 +272,7 @@ EngBitBlt(SURFOBJ *DestObj,
/* The code currently assumes there will be a source bitmap. This is not true when, for example, using this function to /* The code currently assumes there will be a source bitmap. This is not true when, for example, using this function to
* paint a brush pattern on the destination. */ * paint a brush pattern on the destination. */
if (NULL == InputObj && 0xaacc != rop4 && PATCOPY != rop4) if (NULL == InputObj && 0xaacc != Rop4 && PATCOPY != Rop4)
{ {
DbgPrint("EngBitBlt: A source is currently required, even though not all operations require one (FIXME)\n"); DbgPrint("EngBitBlt: A source is currently required, even though not all operations require one (FIXME)\n");
return FALSE; return FALSE;
@ -236,79 +286,65 @@ EngBitBlt(SURFOBJ *DestObj,
clippingType = ClipRegion->iDComplexity; clippingType = ClipRegion->iDComplexity;
} }
if (0xaacc == rop4) if (0xaacc == Rop4)
{ {
ret = BltMask(OutputObj, OutputGDI, Mask, &OutputRect, MaskOrigin, Brush, BrushOrigin); BltRectFunc = BltMask;
IntEngLeave(&EnterLeaveDest); }
IntEngLeave(&EnterLeaveSource); else if (PATCOPY == Rop4)
return ret; {
} else if (PATCOPY == rop4) { BltRectFunc = BltPatCopy;
ret = BltPatCopy(OutputObj, OutputGDI, Mask, &OutputRect, MaskOrigin, Brush, BrushOrigin); }
IntEngLeave(&EnterLeaveDest); else
IntEngLeave(&EnterLeaveSource); {
return ret; BltRectFunc = CallDibBitBlt;
} }
// We don't handle color translation just yet [we dont have to.. REMOVE REMOVE REMOVE] // We don't handle color translation just yet [we dont have to.. REMOVE REMOVE REMOVE]
switch(clippingType) switch(clippingType)
{ {
case DC_TRIVIAL: case DC_TRIVIAL:
OutputGDI->DIB_BitBlt(OutputObj, InputObj, OutputGDI, InputGDI, &OutputRect, &InputPoint, ColorTranslation); Ret = (*BltRectFunc)(OutputObj, OutputGDI, InputObj, InputGDI, Mask, ColorTranslation,
&OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin, Rop4);
IntEngLeave(&EnterLeaveDest); break;
IntEngLeave(&EnterLeaveSource);
return(TRUE);
case DC_RECT: case DC_RECT:
// Clip the blt to the clip rectangle // Clip the blt to the clip rectangle
EngIntersectRect(&rclTmp, &OutputRect, &ClipRegion->rclBounds); ClipRect.left = ClipRegion->rclBounds.left + Translate.x;
ClipRect.right = ClipRegion->rclBounds.right + Translate.x;
ptlTmp.x = InputPoint.x + rclTmp.left - OutputRect.left; ClipRect.top = ClipRegion->rclBounds.top + Translate.y;
ptlTmp.y = InputPoint.y + rclTmp.top - OutputRect.top; ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect);
IntEngLeave(&EnterLeaveDest); Ret = (*BltRectFunc)(OutputObj, OutputGDI, InputObj, InputGDI, Mask, ColorTranslation,
IntEngLeave(&EnterLeaveSource); &CombinedRect, &InputPoint, MaskOrigin, Brush, BrushOrigin, Rop4);
break;
return(TRUE);
case DC_COMPLEX: case DC_COMPLEX:
Ret = TRUE;
CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, ENUM_RECT_LIMIT); CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, ENUM_RECT_LIMIT);
do
{
EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
do { for (i = 0; i < RectEnum.c; i++)
EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum), (PVOID) &RectEnum); {
ClipRect.left = RectEnum.arcl[i].left + Translate.x;
if (RectEnum.c > 0) ClipRect.right = RectEnum.arcl[i].right + Translate.x;
{ ClipRect.top = RectEnum.arcl[i].top + Translate.y;
RECTL* prclEnd = &RectEnum.arcl[RectEnum.c]; ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
RECTL* prcl = &RectEnum.arcl[0]; EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect);
Ret = (*BltRectFunc)(OutputObj, OutputGDI, InputObj, InputGDI, Mask, ColorTranslation,
do { &CombinedRect, &InputPoint, MaskOrigin, Brush, BrushOrigin, Rop4) &&
EngIntersectRect(prcl, prcl, &OutputRect); Ret;
}
ptlTmp.x = InputPoint.x + prcl->left - OutputRect.left; }
ptlTmp.y = InputPoint.y + prcl->top - OutputRect.top; while(EnumMore);
break;
prcl++;
} while (prcl < prclEnd);
}
} while(EnumMore);
IntEngLeave(&EnterLeaveDest);
IntEngLeave(&EnterLeaveSource);
return(TRUE);
} }
IntEngLeave(&EnterLeaveDest); IntEngLeave(&EnterLeaveDest);
IntEngLeave(&EnterLeaveSource); IntEngLeave(&EnterLeaveSource);
return(FALSE); return Ret;
} }
BOOL STDCALL BOOL STDCALL
@ -322,7 +358,7 @@ IntEngBitBlt(SURFOBJ *DestObj,
POINTL *MaskOrigin, POINTL *MaskOrigin,
BRUSHOBJ *Brush, BRUSHOBJ *Brush,
POINTL *BrushOrigin, POINTL *BrushOrigin,
ROP4 rop4) ROP4 Rop4)
{ {
BOOLEAN ret; BOOLEAN ret;
SURFGDI *DestGDI; SURFGDI *DestGDI;
@ -345,12 +381,12 @@ IntEngBitBlt(SURFOBJ *DestObj,
/* Call the driver's DrvBitBlt if available */ /* Call the driver's DrvBitBlt if available */
if (NULL != DestGDI->BitBlt) { if (NULL != DestGDI->BitBlt) {
ret = DestGDI->BitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation, ret = DestGDI->BitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, rop4); DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, Rop4);
} }
if (! ret) { if (! ret) {
ret = EngBitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation, ret = EngBitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, rop4); DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, Rop4);
} }
MouseSafetyOnDrawEnd(DestObj, DestGDI); MouseSafetyOnDrawEnd(DestObj, DestGDI);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: bitmaps.c,v 1.29 2003/06/06 10:17:44 gvg Exp $ */ /* $Id: bitmaps.c,v 1.30 2003/06/28 08:39:18 gvg Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <stdlib.h> #include <stdlib.h>
@ -110,7 +110,7 @@ BOOL STDCALL W32kBitBlt(HDC hDCDest,
// Perform the bitblt operation // Perform the bitblt operation
Status = IntEngBitBlt(SurfDest, SurfSrc, NULL, NULL, XlateObj, &DestRect, &SourcePoint, NULL, NULL, NULL, ROP); Status = IntEngBitBlt(SurfDest, SurfSrc, NULL, DCDest->CombinedClip, XlateObj, &DestRect, &SourcePoint, NULL, NULL, NULL, ROP);
if (XlateAlloc) EngDeleteXlate(XlateObj); if (XlateAlloc) EngDeleteXlate(XlateObj);
if (SurfDestAlloc) ExFreePool(SurfDest); if (SurfDestAlloc) ExFreePool(SurfDest);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: brush.c,v 1.20 2003/05/18 17:16:17 ea Exp $ /* $Id: brush.c,v 1.21 2003/06/28 08:39:18 gvg Exp $
*/ */
@ -28,6 +28,7 @@
//#include <win32k/debug.h> //#include <win32k/debug.h>
#include <include/object.h> #include <include/object.h>
#include <include/inteng.h> #include <include/inteng.h>
#include <include/error.h>
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
@ -211,6 +212,7 @@ BOOL STDCALL W32kPatBlt(HDC hDC,
if (dc == NULL) if (dc == NULL)
{ {
SetLastWin32Error(ERROR_INVALID_HANDLE);
return(FALSE); return(FALSE);
} }
@ -243,7 +245,7 @@ BOOL STDCALL W32kPatBlt(HDC hDC,
ret = IntEngBitBlt(SurfObj, ret = IntEngBitBlt(SurfObj,
NULL, NULL,
NULL, NULL,
NULL, dc->CombinedClip,
NULL, NULL,
&DestRect, &DestRect,
NULL, NULL,

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: cliprgn.c,v 1.16 2003/06/26 21:52:40 gvg Exp $ */ /* $Id: cliprgn.c,v 1.17 2003/06/28 08:39:18 gvg Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
@ -26,6 +26,7 @@
#include <win32k/cliprgn.h> #include <win32k/cliprgn.h>
#include <win32k/coord.h> #include <win32k/coord.h>
#include <include/error.h> #include <include/error.h>
#include "../eng/clip.h"
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
@ -33,6 +34,10 @@
VOID FASTCALL VOID FASTCALL
CLIPPING_UpdateGCRegion(DC* Dc) CLIPPING_UpdateGCRegion(DC* Dc)
{ {
HRGN Combined;
PROSRGNDATA CombinedRegion;
#ifndef TODO
if (Dc->w.hGCClipRgn == NULL) if (Dc->w.hGCClipRgn == NULL)
{ {
Dc->w.hGCClipRgn = W32kCreateRectRgn(0, 0, 0, 0); Dc->w.hGCClipRgn = W32kCreateRectRgn(0, 0, 0, 0);
@ -47,6 +52,36 @@ CLIPPING_UpdateGCRegion(DC* Dc)
W32kCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn, W32kCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn,
RGN_AND); RGN_AND);
} }
#endif
Combined = W32kCreateRectRgn(0, 0, 0, 0);
ASSERT(NULL != Combined);
if (Dc->w.hClipRgn == NULL)
{
W32kCombineRgn(Combined, Dc->w.hVisRgn, 0, RGN_COPY);
}
else
{
W32kCombineRgn(Combined, Dc->w.hClipRgn, Dc->w.hVisRgn,
RGN_AND);
}
CombinedRegion = RGNDATA_LockRgn(Combined);
ASSERT(NULL != CombinedRegion);
if (NULL != Dc->CombinedClip)
{
IntEngDeleteClipRegion(Dc->CombinedClip);
}
Dc->CombinedClip = IntEngCreateClipRegion(CombinedRegion->rdh.nCount,
CombinedRegion->Buffer,
CombinedRegion->rdh.rcBound);
ASSERT(NULL != Dc->CombinedClip);
RGNDATA_UnlockRgn(Combined);
W32kDeleteObject(Combined);
} }
HRGN WINAPI SaveVisRgn(HDC hdc) HRGN WINAPI SaveVisRgn(HDC hdc)
@ -196,7 +231,7 @@ int STDCALL W32kSelectClipRgn(HDC hDC,
W32kDeleteObject(Copy); W32kDeleteObject(Copy);
return ERROR; return ERROR;
} }
W32kOffsetRgn(Copy, dc->w.DCOrgX, dc->w.DCOrgX); W32kOffsetRgn(Copy, dc->w.DCOrgX, dc->w.DCOrgY);
} }
else else
{ {

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: dc.c,v 1.61 2003/06/21 14:25:30 gvg Exp $ /* $Id: dc.c,v 1.62 2003/06/28 08:39:18 gvg Exp $
* *
* DC.C - Device context functions * DC.C - Device context functions
* *
@ -37,6 +37,7 @@
#include <win32k/gdiobj.h> #include <win32k/gdiobj.h>
#include <win32k/pen.h> #include <win32k/pen.h>
#include <win32k/text.h> #include <win32k/text.h>
#include "../eng/clip.h"
#include "../eng/handle.h" #include "../eng/handle.h"
#include <include/inteng.h> #include <include/inteng.h>
#include <include/eng.h> #include <include/eng.h>
@ -534,6 +535,10 @@ BOOL STDCALL W32kDeleteDC(HDC DCHandle)
{ {
W32kDeleteObject (DCToDelete->w.hVisRgn); W32kDeleteObject (DCToDelete->w.hVisRgn);
} }
if (NULL != DCToDelete->CombinedClip)
{
IntEngDeleteClipRegion(DCToDelete->CombinedClip);
}
if (DCToDelete->w.hGCClipRgn) if (DCToDelete->w.hGCClipRgn)
{ {
W32kDeleteObject (DCToDelete->w.hGCClipRgn); W32kDeleteObject (DCToDelete->w.hGCClipRgn);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: text.c,v 1.33 2003/06/22 21:33:48 gvg Exp $ */ /* $Id: text.c,v 1.34 2003/06/28 08:39:18 gvg Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
@ -1062,7 +1062,7 @@ W32kTextOut(HDC hDC,
SourceGlyphSurf = (PSURFOBJ)AccessUserObject((ULONG) HSourceGlyph); SourceGlyphSurf = (PSURFOBJ)AccessUserObject((ULONG) HSourceGlyph);
// Use the font data as a mask to paint onto the DCs surface using a brush // Use the font data as a mask to paint onto the DCs surface using a brush
IntEngBitBlt(SurfObj, NULL, SourceGlyphSurf, NULL, NULL, &DestRect, &SourcePoint, &MaskRect, Brush, &BrushOrigin, 0xAACC); IntEngBitBlt(SurfObj, NULL, SourceGlyphSurf, dc->CombinedClip, NULL, &DestRect, &SourcePoint, &MaskRect, Brush, &BrushOrigin, 0xAACC);
EngDeleteSurface(HSourceGlyph); EngDeleteSurface(HSourceGlyph);