DC_AllocDc:

- Set DC's iGraphicsMode to GM_COMPATIBLE when creating a DC
NtGdiRectangle:
- only exclude bottom/right pixels if dc is GM_COMPATIBLE
- fix indentation

svn path=/trunk/; revision=34553
This commit is contained in:
Timo Kreuzer 2008-07-16 19:48:19 +00:00
parent 4a5e93fab1
commit a8f3f89717
2 changed files with 78 additions and 73 deletions

View file

@ -2485,6 +2485,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
Dc_Attr->ulDirty_ = 0; // Server side
Dc_Attr->iMapMode = MM_TEXT;
Dc_Attr->iGraphicsMode = GM_COMPATIBLE;
Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG!
Dc_Attr->szlWindowExt.cy = 1;

View file

@ -556,91 +556,95 @@ IntRectangle(PDC dc,
return PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
}
DestRect.left = LeftRect;
DestRect.right = RightRect;
DestRect.top = TopRect;
DestRect.bottom = BottomRect;
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
DestRect.left += dc->ptlDCOrig.x;
DestRect.right += dc->ptlDCOrig.x;
DestRect.top += dc->ptlDCOrig.y;
DestRect.bottom += dc->ptlDCOrig.y;
/* In GM_COMPATIBLE, don't include bottom and right edges */
if (IntGetGraphicsMode(dc) == GM_COMPATIBLE)
{
DestRect.left = LeftRect;
DestRect.right = RightRect;
DestRect.top = TopRect;
DestRect.bottom = BottomRect;
DestRect.right--;
DestRect.bottom--;
}
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
/* Special locking order to avoid lock-ups! */
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
if (!PenBrushObj)
{
ret = FALSE;
goto cleanup;
}
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
if (!BitmapObj)
{
ret = FALSE;
goto cleanup;
}
DestRect.left += dc->ptlDCOrig.x;
DestRect.right += dc->ptlDCOrig.x - 1;
DestRect.top += dc->ptlDCOrig.y;
DestRect.bottom += dc->ptlDCOrig.y - 1;
/* Special locking order to avoid lock-ups! */
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
if (!PenBrushObj)
if ( FillBrushObj )
{
if (!(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
{
ret = FALSE;
goto cleanup;
}
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
if (!BitmapObj)
{
ret = FALSE;
goto cleanup;
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
ret = IntEngBitBlt(&BitmapObj->SurfObj,
NULL,
NULL,
dc->CombinedClip,
NULL,
&DestRect,
NULL,
NULL,
&FillBrushInst.BrushObject,
NULL,
ROP3_TO_ROP4(PATCOPY));
}
}
if ( FillBrushObj )
{
if (!(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
{
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
ret = IntEngBitBlt(&BitmapObj->SurfObj,
NULL,
NULL,
dc->CombinedClip,
NULL,
&DestRect,
NULL,
NULL,
&FillBrushInst.BrushObject,
NULL,
ROP3_TO_ROP4(PATCOPY));
}
}
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
// Draw the rectangle with the current pen
// Draw the rectangle with the current pen
ret = TRUE; // change default to success
ret = TRUE; // change default to success
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
{
Mix = ROP2_TO_MIX(Dc_Attr->jROP2);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.left, DestRect.top, DestRect.right, DestRect.top,
&DestRect, // Bounding rectangle
Mix);
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
{
Mix = ROP2_TO_MIX(Dc_Attr->jROP2);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.left, DestRect.top, DestRect.right, DestRect.top,
&DestRect, // Bounding rectangle
Mix);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
&DestRect, // Bounding rectangle
Mix);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
&DestRect, // Bounding rectangle
Mix);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
&DestRect, // Bounding rectangle
Mix);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.left, DestRect.bottom, DestRect.left, DestRect.top,
&DestRect, // Bounding rectangle
Mix);
}
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
&DestRect, // Bounding rectangle
Mix);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip,
&PenBrushInst.BrushObject,
DestRect.left, DestRect.bottom, DestRect.left, DestRect.top,
&DestRect, // Bounding rectangle
Mix);
}
cleanup: