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->ulDirty_ = 0; // Server side
Dc_Attr->iMapMode = MM_TEXT; Dc_Attr->iMapMode = MM_TEXT;
Dc_Attr->iGraphicsMode = GM_COMPATIBLE;
Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG! Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG!
Dc_Attr->szlWindowExt.cy = 1; Dc_Attr->szlWindowExt.cy = 1;

View file

@ -556,91 +556,95 @@ IntRectangle(PDC dc,
return PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect ); 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--;
DestRect.right = RightRect; DestRect.bottom--;
DestRect.top = TopRect; }
DestRect.bottom = BottomRect;
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; if ( FillBrushObj )
DestRect.right += dc->ptlDCOrig.x - 1; {
DestRect.top += dc->ptlDCOrig.y; if (!(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
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)
{ {
ret = FALSE; IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
goto cleanup; ret = IntEngBitBlt(&BitmapObj->SurfObj,
} NULL,
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); NULL,
if (!BitmapObj) dc->CombinedClip,
{ NULL,
ret = FALSE; &DestRect,
goto cleanup; NULL,
NULL,
&FillBrushInst.BrushObject,
NULL,
ROP3_TO_ROP4(PATCOPY));
} }
}
if ( FillBrushObj ) IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
{
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); // 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)) ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
{ dc->CombinedClip,
Mix = ROP2_TO_MIX(Dc_Attr->jROP2); &PenBrushInst.BrushObject,
ret = ret && IntEngLineTo(&BitmapObj->SurfObj, DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
dc->CombinedClip, &DestRect, // Bounding rectangle
&PenBrushInst.BrushObject, Mix);
DestRect.left, DestRect.top, DestRect.right, DestRect.top,
&DestRect, // Bounding rectangle
Mix);
ret = ret && IntEngLineTo(&BitmapObj->SurfObj, ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
dc->CombinedClip, dc->CombinedClip,
&PenBrushInst.BrushObject, &PenBrushInst.BrushObject,
DestRect.right, DestRect.top, DestRect.right, DestRect.bottom, DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); 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.left, DestRect.bottom, DestRect.left, DestRect.top,
&DestRect, // Bounding rectangle
Mix);
} }
cleanup: cleanup: