Author: fireball Date: Thu Aug 13 22:51:14 2009 New Revision: 42658
URL: http://svn.reactos.org/svn/reactos?rev=42658&view=rev Log: - Add a brush origin point to DC structure and update it before doing any operation potentially involving a brush origin (some unimplemented operations lack this). Partially fixes hatch brushes drawing.
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/include/psdk/ntrosgdi.h branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -44,7 +44,7 @@ INT width, INT height, NTDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, DWORD rop ) { - POINT pts[2]; + POINT pts[2], ptBrush;
/* map source coordinates */ if (physDevSrc) @@ -67,6 +67,10 @@ LPtoDP(physDevDst->hUserDC, pts, 1); xDst = pts[0].x; yDst = pts[0].y; + + /* Update brush origin */ + GetBrushOrgEx(physDevDst->hUserDC, &ptBrush); + RosGdiSetBrushOrg(physDevDst->hKernelDC, ptBrush.x, ptBrush.y);
return RosGdiBitBlt(physDevDst->hKernelDC, xDst, yDst, width, height, physDevSrc->hKernelDC, xSrc, ySrc, rop); @@ -402,7 +406,7 @@
BOOL CDECL RosDrv_PatBlt( NTDRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop ) { - POINT pts[2]; + POINT pts[2], ptBrush;
/* Map coordinates */ pts[0].x = left; @@ -416,6 +420,10 @@ left = pts[0].x; top = pts[0].y;
+ /* Update brush origin */ + GetBrushOrgEx(physDev->hUserDC, &ptBrush); + RosGdiSetBrushOrg(physDev->hKernelDC, ptBrush.x, ptBrush.y); + return RosGdiPatBlt(physDev->hKernelDC, left, top, width, height, rop); }
@@ -442,6 +450,7 @@ { register int i; POINT *points; + POINT ptBrush;
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count+1) ))) { @@ -457,6 +466,10 @@ } points[count] = points[0];
+ /* Update brush origin */ + GetBrushOrgEx(physDev->hUserDC, &ptBrush); + RosGdiSetBrushOrg(physDev->hKernelDC, ptBrush.x, ptBrush.y); + /* Call kernel mode */ RosGdiPolygon(physDev->hKernelDC, points, count+1);
@@ -503,6 +516,7 @@
BOOL CDECL RosDrv_Rectangle(NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom) { + POINT ptBrush; RECT rc;
/* Convert coordinates */ @@ -513,6 +527,10 @@
if (rc.right < rc.left) { INT tmp = rc.right; rc.right = rc.left; rc.left = tmp; } if (rc.bottom < rc.top) { INT tmp = rc.bottom; rc.bottom = rc.top; rc.top = tmp; } + + /* Update brush origin */ + GetBrushOrgEx(physDev->hUserDC, &ptBrush); + RosGdiSetBrushOrg(physDev->hKernelDC, ptBrush.x, ptBrush.y);
RosGdiRectangle(physDev->hKernelDC, &rc);
@@ -731,7 +749,7 @@ NTDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop ) { - POINT pts[2]; + POINT pts[2], ptBrush;
/* map source coordinates */ if (physDevSrc) @@ -759,6 +777,10 @@ xDst = pts[0].x; yDst = pts[0].y;
+ /* Update brush origin */ + GetBrushOrgEx(physDevDst->hUserDC, &ptBrush); + RosGdiSetBrushOrg(physDevDst->hKernelDC, ptBrush.x, ptBrush.y); + return RosGdiStretchBlt(physDevDst->hKernelDC, xDst, yDst, widthDst, heightDst, physDevSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, rop); }
Modified: branches/arwinss/reactos/include/psdk/ntrosgdi.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/ntr... ============================================================================== --- branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -108,6 +108,7 @@ COLORREF APIENTRY RosGdiSetBkColor( HDC physDev, COLORREF color ); COLORREF APIENTRY RosGdiSetDCBrushColor( HDC physDev, COLORREF crColor ); DWORD APIENTRY RosGdiSetDCOrg( HDC physDev, INT x, INT y ); +VOID APIENTRY RosGdiSetBrushOrg( HDC physDev, INT x, INT y ); COLORREF APIENTRY RosGdiSetDCPenColor( HDC physDev, COLORREF crColor ); void APIENTRY RosGdiSetDeviceClipping( HDC physDev, UINT count, PRECTL pRects, PRECTL rcBounds ); BOOL APIENTRY RosGdiSetDeviceGammaRamp(HDC physDev, LPVOID ramp);
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -423,6 +423,21 @@ return 0; }
+VOID APIENTRY RosGdiSetBrushOrg( HDC physDev, INT x, INT y ) +{ + PDC pDC; + + /* Get a pointer to the DC */ + pDC = DC_Lock(physDev); + + /* Set brush origin */ + pDC->ptBrushOrg.x = x; + pDC->ptBrushOrg.y = y; + + /* Release the object */ + DC_Unlock(pDC); +} + COLORREF APIENTRY RosGdiSetDCPenColor( HDC physDev, COLORREF crColor ) { UNIMPLEMENTED;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -200,8 +200,7 @@ INT XSrc, INT YSrc, DWORD rop) { BOOLEAN bRet; - POINT BrushOrigin = {0,0}; - POINT SourcePoint; + POINT SourcePoint, BrushOrigin; RECTL DestRect; XLATEOBJ *XlateObj = NULL; BOOL UsesSource = ROP3_USES_SOURCE(rop); @@ -238,6 +237,9 @@ return FALSE; } } + + BrushOrigin.x = pDest->ptBrushOrg.x + pDest->rcDcRect.left; + BrushOrigin.y = pDest->ptBrushOrg.y + pDest->rcDcRect.top;
/* Perform the bitblt operation */ bRet = GrepBitBltEx( @@ -302,8 +304,8 @@ DestRect.right += pDC->rcVport.left + pDC->rcDcRect.left; DestRect.bottom += pDC->rcVport.top + pDC->rcDcRect.top;
- //BrushOrigin.x = BrushObj->ptOrigin.x + pDC->ptVportOrg.x; - //BrushOrigin.y = BrushObj->ptOrigin.y + pDC->ptVportOrg.y; + BrushOrigin.x = pDC->ptBrushOrg.x + pDC->rcDcRect.left; + BrushOrigin.y = pDC->ptBrushOrg.y + pDC->rcDcRect.top;
bRet = GrepBitBltEx( &pDC->pBitmap->SurfObj, @@ -377,8 +379,8 @@ SourceRect.bottom += DCSrc->rcVport.top + DCSrc->rcDcRect.top; }
- BrushOrigin.x = 0; - BrushOrigin.y = 0; + BrushOrigin.x = DCDest->ptBrushOrg.x + DCDest->rcDcRect.left; + BrushOrigin.y = DCDest->ptBrushOrg.y + DCDest->rcDcRect.top;
/* Determine surfaces to be used in the bitblt */ BitmapDest = DCDest->pBitmap; @@ -401,10 +403,6 @@ goto failed; } } - - /* Offset the brush */ - BrushOrigin.x += DCDest->rcVport.left + DCDest->rcDcRect.left; - BrushOrigin.y += DCDest->rcVport.top + DCDest->rcDcRect.top;
/* Make mask surface for source surface */ if (BitmapSrc && DCMask)
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -27,21 +27,21 @@ BOOLEAN bRet; RECTL DestRect; MIX Mix; - POINT BrushOrigin = {0, 0}; + POINT BrushOrigin;
DestRect.left = LeftRect + pDC->rcDcRect.left + pDC->rcVport.left; DestRect.right = RightRect + pDC->rcDcRect.left + pDC->rcVport.left; DestRect.top = TopRect + pDC->rcDcRect.top + pDC->rcVport.top; DestRect.bottom = BottomRect + pDC->rcDcRect.top + pDC->rcVport.top;
+ BrushOrigin.x = pDC->ptBrushOrg.x + pDC->rcDcRect.left; + BrushOrigin.y = pDC->ptBrushOrg.y + pDC->rcDcRect.top; + /* Draw brush-based rectangle */ if (pDC->pFillBrush) { if (!(pDC->pFillBrush->flAttrs & GDIBRUSH_IS_NULL)) { - //BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin); - //BrushOrigin.x += dc->ptlDCOrig.x; - //BrushOrigin.y += dc->ptlDCOrig.y; bRet = GrepBitBltEx(&pDC->pBitmap->SurfObj, NULL, NULL, @@ -102,7 +102,7 @@ RECTL DestRect; MIX Mix; INT i; - POINT BrushOrigin = {0, 0}; + POINT BrushOrigin;
// HACK DestRect.left = 0; @@ -110,14 +110,14 @@ DestRect.bottom = PrimarySurface.GDIInfo.ulVertRes; DestRect.right = PrimarySurface.GDIInfo.ulHorzRes;
+ BrushOrigin.x = pDC->ptBrushOrg.x + pDC->rcDcRect.left; + BrushOrigin.y = pDC->ptBrushOrg.y + pDC->rcDcRect.top; + /* Draw brush-based polygon */ if (pDC->pFillBrush) { if (!(pDC->pFillBrush->flAttrs & GDIBRUSH_IS_NULL)) { - //BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin); - //BrushOrigin.x += dc->ptlDCOrig.x; - //BrushOrigin.y += dc->ptlDCOrig.y; GrepFillPolygon(pDC, &pDC->pBitmap->SurfObj, &pDC->pFillBrush->BrushObj,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -14,8 +14,9 @@ COLORREF crBackgroundClr;
/* Origins and extents */ - RECT rcDcRect; /* Relative to Vport */ - RECT rcVport; + RECT rcDcRect; /* Relative to Vport */ + RECT rcVport; + POINT ptBrushOrg;
/* Combined clipping region */ CLIPOBJ *CombinedClip;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Thu Aug 13 22:51:14 2009 @@ -24,6 +24,7 @@ RosGdiSetBkColor 2 RosGdiSetDCBrushColor 2 RosGdiSetDCOrg 3 +RosGdiSetBrushOrg 3 RosGdiSetDCPenColor 2 RosGdiSetDeviceClipping 4 RosGdiSetDeviceGammaRamp 2