Author: jimtabor
Date: Sat Nov 15 07:37:26 2008
New Revision: 37372
URL:
http://svn.reactos.org/svn/reactos?rev=37372&view=rev
Log:
- Fix dirty bit support for select brush and pen, see bug 3863.
- Hack-plement part of NtGdiExtFloodFill. We need to fix our region and clip support so
ReactOS drawing functions do not over write other displayed windows. Open AbiWord than
type something and select another desktop, this is just one of them....
- Tested with Qemu and real hardware.
Modified:
trunk/reactos/dll/win32/gdi32/objects/dc.c
trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
trunk/reactos/subsystems/win32/win32k/objects/line.c
trunk/reactos/subsystems/win32/win32k/objects/path.c
trunk/reactos/subsystems/win32/win32k/objects/pen.c
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Sat Nov 15 07:37:26 2008
@@ -1561,23 +1561,19 @@
return NtGdiSelectBitmap(hDC, hGdiObj);
case GDI_OBJECT_TYPE_BRUSH:
-#if 0 // enable this when support is ready in win32k
hOldObj = pDc_Attr->hbrush;
pDc_Attr->ulDirty_ |= DC_BRUSH_DIRTY;
pDc_Attr->hbrush = hGdiObj;
return hOldObj;
-#endif
- return NtGdiSelectBrush(hDC, hGdiObj);
+// return NtGdiSelectBrush(hDC, hGdiObj);
case GDI_OBJECT_TYPE_PEN:
case GDI_OBJECT_TYPE_EXTPEN:
-#if 0 // enable this when support is ready in win32k
hOldObj = pDc_Attr->hpen;
pDc_Attr->ulDirty_ |= DC_PEN_DIRTY;
pDc_Attr->hpen = hGdiObj;
return hOldObj;
-#endif
- return NtGdiSelectPen(hDC, hGdiObj);
+// return NtGdiSelectPen(hDC, hGdiObj);
case GDI_OBJECT_TYPE_FONT:
hOldObj = pDc_Attr->hlfntNew;
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Sat Nov 15
07:37:26 2008
@@ -225,6 +225,9 @@
Dc_Attr = DCDest->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &DCDest->Dc_Attr;
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(DCDest,Dc_Attr->hbrush);
+
/* Offset the destination and source by the origin of their DCs. */
XDest += DCDest->ptlDCOrig.x;
YDest += DCDest->ptlDCOrig.y;
@@ -484,6 +487,7 @@
*
* Someone thought it would be faster to do it here and then switch back
* to GDI32. I dunno. Write a test and let me know.
+ * A. It should be in here!
*/
static __inline BYTE
@@ -781,6 +785,12 @@
}
}
+ Dc_Attr = DCDest->pDc_Attr;
+ if (!Dc_Attr) Dc_Attr = &DCDest->Dc_Attr;
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(DCDest,Dc_Attr->hbrush);
+
/* Offset the destination and source by the origin of their DCs. */
// FIXME: ptlDCOrig is in device coordinates!
XOriginDest += DCDest->ptlDCOrig.x;
@@ -880,8 +890,6 @@
if (UsesPattern)
{
- Dc_Attr = DCDest->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &DCDest->Dc_Attr;
BrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
if (NULL == BrushObj)
{
@@ -1008,6 +1016,7 @@
int i;
PPATRECT r;
PGDIBRUSHOBJ BrushObj;
+ PDC_ATTR Dc_Attr;
DC *dc;
dc = DC_LockDc(hDC);
@@ -1022,6 +1031,12 @@
/* Yes, Windows really returns TRUE in this case */
return TRUE;
}
+
+ Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
for (r = pRects, i = 0; i < cRects; i++)
{
@@ -1074,14 +1089,18 @@
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
- Dc_Attr = dc->pDc_Attr;
- if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (dc->DC_Type == DC_TYPE_INFO)
{
DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */
return TRUE;
}
+
+ Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
BrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
if (BrushObj == NULL)
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Sat Nov 15 07:37:26
2008
@@ -130,8 +130,8 @@
NewDC->DC_Type = DC_TYPE_MEMORY; // Always!
NewDC->w.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP);
NewDC->pPDev = OrigDC->pPDev;
-
- NewDC->DcLevel.hpal = OrigDC->DcLevel.hpal;
+ NewDC->DcLevel.hpal = OrigDC->DcLevel.hpal;
+
nDc_Attr->lTextAlign = oDc_Attr->lTextAlign;
nDc_Attr->ulForegroundClr = oDc_Attr->ulForegroundClr;
nDc_Attr->ulBackgroundClr = oDc_Attr->ulBackgroundClr;
@@ -1138,6 +1138,13 @@
}
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
+
switch(ObjectType)
{
case GDI_OBJECT_TYPE_EXTPEN:
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Sat Nov 15
07:37:26 2008
@@ -199,7 +199,7 @@
oldColor = Dc_Attr->crBackgroundClr;
Dc_Attr->crBackgroundClr = color;
Dc_Attr->ulBackgroundClr = (ULONG)color;
- Dc_Attr->ulDirty_ &= ~DIRTY_LINE; // Clear Flag if set.
+ Dc_Attr->ulDirty_ &= ~(DIRTY_BACKGROUND|DIRTY_LINE|DIRTY_FILL); // Clear Flag if
set.
hBrush = Dc_Attr->hbrush;
DC_UnlockDc(dc);
NtGdiSelectBrush(hDC, hBrush);
@@ -271,6 +271,7 @@
oldColor = Dc_Attr->crForegroundClr;
Dc_Attr->crForegroundClr = color;
hBrush = Dc_Attr->hbrush;
+ Dc_Attr->ulDirty_ &= ~(DIRTY_TEXT|DIRTY_LINE|DIRTY_FILL);
DC_UnlockDc( dc );
NtGdiSelectBrush(hDC, hBrush);
return oldColor;
Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Sat Nov 15
07:37:26 2008
@@ -94,6 +94,12 @@
DestRect.top = min(DestRect.top, Points[CurrentPoint].y);
DestRect.bottom = max(DestRect.bottom, Points[CurrentPoint].y);
}
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
/* Special locking order to avoid lock-ups */
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
@@ -242,6 +248,12 @@
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
+
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
if (NULL == PenBrushObj)
{
@@ -544,6 +556,12 @@
DestRect.bottom--;
}
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
+
/* Special locking order to avoid lock-ups! */
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
@@ -702,6 +720,12 @@
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
if (!PenBrushObj)
@@ -1024,10 +1048,95 @@
COLORREF Color,
UINT FillType)
{
- DPRINT1("FIXME: NtGdiExtFloodFill is UNIMPLEMENTED\n");
-
- /* lie and say we succeded */
- return TRUE;
+ PDC dc;
+ PDC_ATTR Dc_Attr;
+ BITMAPOBJ *BitmapObj = NULL;
+ PGDIBRUSHOBJ FillBrushObj = NULL;
+ GDIBRUSHINST FillBrushInst;
+ BOOL Ret = FALSE;
+ RECTL DestRect;
+ POINTL Pt;
+// MIX Mix;
+
+ DPRINT1("FIXME: NtGdiExtFloodFill is UNIMPLEMENTED\n");
+
+ dc = DC_LockDc(hDC);
+ if (!dc)
+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+ if (dc->DC_Type == DC_TYPE_INFO)
+ {
+ DC_UnlockDc(dc);
+ /* Yes, Windows really returns TRUE in this case */
+ return TRUE;
+ }
+
+ Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ Pt.x = XStart;
+ Pt.y = YStart;
+ IntLPtoDP(dc, (LPPOINT)&Pt, 1);
+
+ Ret = NtGdiPtInRegion(dc->w.hGCClipRgn, Pt.x, Pt.y);
+ if (Ret)
+ IntGdiGetRgnBox(dc->w.hGCClipRgn,(LPRECT)&DestRect);
+ else
+ goto cleanup;
+
+ FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
+ if (!FillBrushObj)
+ {
+ Ret = FALSE;
+ goto cleanup;
+ }
+ BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
+ if (!BitmapObj)
+ {
+ Ret = FALSE;
+ goto cleanup;
+ }
+
+ if ( FillBrushObj && (FillType == FLOODFILLBORDER))
+ {
+ if (!(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
+ {
+ FillBrushObj->BrushAttr.lbColor = Color;
+ IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
+ Ret = IntEngBitBlt(&BitmapObj->SurfObj,
+ NULL,
+ NULL,
+ dc->CombinedClip,
+ NULL,
+ &DestRect,
+ NULL,
+ NULL,
+ &FillBrushInst.BrushObject,
+ NULL,
+ ROP3_TO_ROP4(PATCOPY));
+ }
+ }
+ else
+ {
+ }
+
+cleanup:
+ if (FillBrushObj)
+ BRUSHOBJ_UnlockBrush(FillBrushObj);
+
+ if (BitmapObj)
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+
+ DC_UnlockDc(dc);
+ return Ret;
}
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/objects/line.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/line.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/line.c [iso-8859-1] Sat Nov 15 07:37:26
2008
@@ -115,6 +115,12 @@
}
else
{
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
+
BitmapObj = BITMAPOBJ_LockBitmap ( dc->w.hBitmap );
if (NULL == BitmapObj)
{
@@ -257,8 +263,15 @@
PDC_ATTR Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
if (PATH_IsPathOpen(dc->DcLevel))
return PATH_Polyline(dc, pt, Count);
+
+ if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,Dc_Attr->hbrush);
+
+ if (Dc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(dc,Dc_Attr->hpen);
/* Get BRUSHOBJ from current pen. */
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Sat Nov 15 07:37:26
2008
@@ -1329,7 +1329,9 @@
if (pPath->state != PATH_Closed)
return FALSE;
- if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+ if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+
/* Save the mapping mode info */
mapMode = Dc_Attr->iMapMode;
IntGetViewportExtEx(dc, &szViewportExt);
@@ -2265,8 +2267,9 @@
STDCALL
NtGdiFillPath(HDC hDC)
{
- BOOL ret = TRUE;
+ BOOL ret = FALSE;
PPATH pPath;
+ PDC_ATTR pDc_Attr;
PDC dc = DC_LockDc ( hDC );
if ( !dc )
@@ -2280,6 +2283,12 @@
DC_UnlockDc ( dc );
return FALSE;
}
+
+ pDc_Attr = dc->pDc_Attr;
+ if (!pDc_Attr) pDc_Attr = &dc->Dc_Attr;
+
+ if (pDc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(dc,pDc_Attr->hbrush);
ret = PATH_FillPath( dc, pPath );
if ( ret )
@@ -2534,6 +2543,7 @@
NtGdiStrokeAndFillPath(HDC hDC)
{
DC *pDc;
+ PDC_ATTR pDc_Attr;
PPATH pPath;
BOOL bRet = FALSE;
@@ -2550,6 +2560,15 @@
DC_UnlockDc ( pDc );
return FALSE;
}
+
+ pDc_Attr = pDc->pDc_Attr;
+ if (!pDc_Attr) pDc_Attr = &pDc->Dc_Attr;
+
+ if (pDc_Attr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(pDc,pDc_Attr->hbrush);
+ if (pDc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(pDc,pDc_Attr->hpen);
+
bRet = PATH_FillPath(pDc, pPath);
if (bRet) bRet = PATH_StrokePath(pDc, pPath);
if (bRet) PATH_EmptyPath(pPath);
@@ -2564,6 +2583,7 @@
NtGdiStrokePath(HDC hDC)
{
DC *pDc;
+ PDC_ATTR pDc_Attr;
PPATH pPath;
BOOL bRet = FALSE;
@@ -2580,6 +2600,12 @@
DC_UnlockDc ( pDc );
return FALSE;
}
+
+ pDc_Attr = pDc->pDc_Attr;
+ if (!pDc_Attr) pDc_Attr = &pDc->Dc_Attr;
+
+ if (pDc_Attr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(pDc,pDc_Attr->hpen);
bRet = PATH_StrokePath(pDc, pPath);
PATH_EmptyPath(pPath);
Modified: trunk/reactos/subsystems/win32/win32k/objects/pen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] Sat Nov 15 07:37:26
2008
@@ -260,6 +260,8 @@
XLATEOBJ *XlateObj;
BOOLEAN bFailed;
+ if (pDC == NULL || hPen == NULL) return NULL;
+
pDc_Attr = pDC->pDc_Attr;
if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr;