Author: fireball Date: Mon Jul 20 15:33:16 2009 New Revision: 42097
URL: http://svn.reactos.org/svn/reactos?rev=42097&view=rev Log: - Swap szWnd/szVport/ptWndOrg/ptVportOrg to two rectangles: Vport one, and DC one. The DC one is relative to the Vport one. - Set both DC and Vport rectangles from the winent driver. Setting them back to fullscreen is not supported now, but since only their origins (top,left) are used now - it's ok. - Offset all graphic operations by the Vport offset too. Now graphics is displayed at correct places inside windows, including text output too. - Silence font.c debug prints. - Add inlined functions for RECTL management (set, offset, check for emptyness) from the trunk's win32k.
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/gdi/misc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c branches/arwinss/reactos/subsystems/win32/win32k/gre/font.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/include/gre.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] Mon Jul 20 15:33:16 2009 @@ -191,7 +191,6 @@ INT CDECL RosDrv_ExtEscape( NTDRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data, INT out_count, LPVOID out_data ) { - RECT dc_rect; switch(escape) { case NTDRV_ESCAPE: @@ -203,14 +202,9 @@ if (in_count >= sizeof(struct ntdrv_escape_set_drawable)) { const struct ntdrv_escape_set_drawable *data = in_data; - dc_rect = data->dc_rect; - RosGdiSetDcRect(physDev->hKernelDC, &dc_rect); - //physDev->dc_rect = data->dc_rect; - //physDev->drawable = data->drawable; - //physDev->drawable_rect = data->drawable_rect; - //TRACE( "SET_DRAWABLE hdc %p drawable %lx gl_drawable %lx pf %u dc_rect %s drawable_rect %s\n", - // physDev->hdc, physDev->drawable, physDev->gl_drawable, physDev->current_pf, - // wine_dbgstr_rect(&physDev->dc_rect), wine_dbgstr_rect(&physDev->drawable_rect) ); + RosGdiSetDcRects(physDev->hKernelDC, &data->dc_rect, &data->drawable_rect); + TRACE( "SET_DRAWABLE hdc %p dc_rect %s drawable_rect %s\n", + physDev->hUserDC, wine_dbgstr_rect(&data->dc_rect), wine_dbgstr_rect(&data->drawable_rect) ); return TRUE; } break;
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] Mon Jul 20 15:33:16 2009 @@ -116,7 +116,7 @@ int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd); COLORREF APIENTRY RosGdiSetTextColor( HDC physDev, COLORREF color ); -VOID APIENTRY RosGdiSetDcRect( HDC physDev, RECT *rcDcRect ); +VOID APIENTRY RosGdiSetDcRects( HDC physDev, RECT *rcDcRect, RECT *rcVport );
/* enum.c */ int APIENTRY RosGdiChoosePixelFormat(HDC physDev,
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] Mon Jul 20 15:33:16 2009 @@ -113,22 +113,33 @@ /* Check if it's a compatible DC */ if (*pdev) { - DPRINT1("Creating a compatible with %x DC\n", *pdev); - slSize.cx = 1; slSize.cy = 1; - hStockBitmap = GreCreateBitmap(slSize, 1, 1, 0, NULL); - pNewDC->pBitmap = GDI_GetObjPtr(hStockBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP); - } - else if (dc->dwType == OBJ_MEMDC) + DPRINT1("Creating a compatible with %x DC!\n", *pdev); + } + + if (dc->dwType == OBJ_MEMDC) { DPRINT1("Creating a memory DC %x\n", hNewDC); slSize.cx = 1; slSize.cy = 1; hStockBitmap = GreCreateBitmap(slSize, 1, 1, 0, NULL); pNewDC->pBitmap = GDI_GetObjPtr(hStockBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP); + + /* Set DC rectangles */ + pNewDC->rcDcRect.left = 0; pNewDC->rcDcRect.top = 0; + pNewDC->rcDcRect.right = 1; pNewDC->rcDcRect.bottom = 1; + pNewDC->rcVport = pNewDC->rcDcRect; } else { DPRINT1("Creating a display DC %x\n", hNewDC); pNewDC->pBitmap = GDI_GetObjPtr(PrimarySurface.pSurface, (SHORT)GDI_OBJECT_TYPE_BITMAP); + + /* Set DC rectangles */ + pNewDC->rcVport.left = 0; + pNewDC->rcVport.top = 0; + pNewDC->rcVport.right = PrimarySurface.GDIInfo.ulHorzRes; + pNewDC->rcVport.bottom = PrimarySurface.GDIInfo.ulVertRes; + + pNewDC->rcDcRect = pNewDC->rcVport; }
/* Give handle to the caller */ @@ -187,6 +198,13 @@
/* Select it */ pDC->pBitmap = pSurface; + + /* Set DC rectangles */ + pDC->rcVport.left = 0; + pDC->rcVport.top = 0; + pDC->rcVport.right = pSurface->SurfObj.sizlBitmap.cx; + pDC->rcVport.bottom = pSurface->SurfObj.sizlBitmap.cy; + pDC->rcDcRect = pDC->rcVport;
/* Release the DC object */ GDI_ReleaseObj(physDev); @@ -379,7 +397,7 @@ return color; }
-VOID APIENTRY RosGdiSetDcRect( HDC physDev, RECT *rcDcRect ) +VOID APIENTRY RosGdiSetDcRects( HDC physDev, RECT *rcDcRect, RECT *rcVport ) { PDC pDC;
@@ -387,19 +405,23 @@ pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC);
/* Set DC rectangle */ - if (rcDcRect->left && rcDcRect->top && rcDcRect->right && rcDcRect->bottom) + if (rcDcRect) { pDC->rcDcRect = *rcDcRect; - } - else - { + +#if 0 /* Set back to full screen */ pDC->rcDcRect.top = 0; pDC->rcDcRect.left = 0; pDC->rcDcRect.right = pDC->szVportExt.cx; pDC->rcDcRect.top = pDC->szVportExt.cy; - - DPRINT1("right/top %d %d\n", pDC->szVportExt.cx, pDC->szVportExt.cy); +#endif + } + + /* Set viewport rectangle */ + if (rcVport) + { + pDC->rcVport = *rcVport; }
/* Release the object */
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -88,10 +88,10 @@ pt[1].x = x2; pt[1].y = y2;
/* Add DC origin */ - pt[0].x += pDC->ptVportOrg.x + pDC->rcDcRect.left; - pt[0].y += pDC->ptVportOrg.y + pDC->rcDcRect.top; - pt[1].x += pDC->ptVportOrg.x + pDC->rcDcRect.left; - pt[1].y += pDC->ptVportOrg.y + pDC->rcDcRect.top; + pt[0].x += pDC->rcVport.left + pDC->rcDcRect.left; + pt[0].y += pDC->rcVport.top + pDC->rcDcRect.top; + pt[1].x += pDC->rcVport.left + pDC->rcDcRect.left; + pt[1].y += pDC->rcVport.top + pDC->rcDcRect.top;
GreLineTo(&pDC->pBitmap->SurfObj, pClipObj,
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] Mon Jul 20 15:33:16 2009 @@ -172,10 +172,10 @@ // FIXME: LP->DP missing! //IntLPtoDP(pDest, (LPPOINT)&DestRect, 2);
- DestRect.left += pDest->ptVportOrg.x + pDest->rcDcRect.left; - DestRect.top += pDest->ptVportOrg.y + pDest->rcDcRect.top; - DestRect.right += pDest->ptVportOrg.x + pDest->rcDcRect.left; - DestRect.bottom += pDest->ptVportOrg.y + pDest->rcDcRect.top; + DestRect.left += pDest->rcVport.left + pDest->rcDcRect.left; + DestRect.top += pDest->rcVport.top + pDest->rcDcRect.top; + DestRect.right += pDest->rcVport.left + pDest->rcDcRect.left; + DestRect.bottom += pDest->rcVport.top + pDest->rcDcRect.top;
SourcePoint.x = XSrc; SourcePoint.y = YSrc; @@ -238,11 +238,10 @@ DestRect.bottom = YLeft + 1; }
- //IntLPtoDP(pDC, (LPPOINT)&DestRect, 2); - DestRect.left += pDC->ptVportOrg.x + pDC->rcDcRect.left; - DestRect.top += pDC->ptVportOrg.y + pDC->rcDcRect.top; - DestRect.right += pDC->ptVportOrg.x + pDC->rcDcRect.left; - DestRect.bottom += pDC->ptVportOrg.y + pDC->rcDcRect.top; + DestRect.left += pDC->rcVport.left + pDC->rcDcRect.left; + DestRect.top += pDC->rcVport.top + pDC->rcDcRect.top; + 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; @@ -300,12 +299,12 @@ DestRect.top = YOriginDest; DestRect.right = XOriginDest+WidthDest; DestRect.bottom = YOriginDest+HeightDest; - IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2); - - DestRect.left += DCDest->ptVportOrg.x + DCDest->rcDcRect.left; - DestRect.top += DCDest->ptVportOrg.y + DCDest->rcDcRect.top; - DestRect.right += DCDest->ptVportOrg.x + DCDest->rcDcRect.left; - DestRect.bottom += DCDest->ptVportOrg.y + DCDest->rcDcRect.top; + IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2); // FIXME: Why? + + DestRect.left += DCDest->rcVport.left + DCDest->rcDcRect.left; + DestRect.top += DCDest->rcVport.top + DCDest->rcDcRect.top; + DestRect.right += DCDest->rcVport.left + DCDest->rcDcRect.left; + DestRect.bottom += DCDest->rcVport.top + DCDest->rcDcRect.top;
SourceRect.left = XOriginSrc; SourceRect.top = YOriginSrc; @@ -316,10 +315,10 @@ { IntLPtoDP(DCSrc, (LPPOINT)&SourceRect, 2);
- SourceRect.left += DCSrc->ptVportOrg.x + DCSrc->rcDcRect.left; - SourceRect.top += DCSrc->ptVportOrg.y + DCSrc->rcDcRect.top; - SourceRect.right += DCSrc->ptVportOrg.x + DCSrc->rcDcRect.left; - SourceRect.bottom += DCSrc->ptVportOrg.y + DCSrc->rcDcRect.top; + SourceRect.left += DCSrc->rcVport.left + DCSrc->rcDcRect.left; + SourceRect.top += DCSrc->rcVport.top + DCSrc->rcDcRect.top; + SourceRect.right += DCSrc->rcVport.left + DCSrc->rcDcRect.left; + SourceRect.bottom += DCSrc->rcVport.top + DCSrc->rcDcRect.top; }
BrushOrigin.x = 0; @@ -348,8 +347,8 @@ }
/* Offset the brush */ - BrushOrigin.x += DCDest->ptVportOrg.x + DCDest->rcDcRect.left; - BrushOrigin.y += DCDest->ptVportOrg.y + DCDest->rcDcRect.top; + 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/font.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -9,7 +9,7 @@ /* INCLUDES ******************************************************************/
#include <win32k.h> -//#define NDEBUG +#define NDEBUG #include <debug.h>
/* PRIVATE FUNCTIONS *********************************************************/ @@ -59,10 +59,14 @@ } while (bits & bitsMask); rcBounds.left = xspan; rcBounds.top = y; rcBounds.right = xspan+lenspan; rcBounds.bottom = y+1; + RECTL_vOffsetRect(&rcBounds, physDev->rcVport.left, physDev->rcVport.top); GreLineTo(&physDev->pBitmap->SurfObj, NULL, &physDev->pLineBrush->BrushObj, - xspan, y, xspan+lenspan, y, + xspan + physDev->rcVport.left, + y + physDev->rcVport.top, + xspan + lenspan + physDev->rcVport.left, + y + physDev->rcVport.top, &rcBounds, 0); xspan += lenspan;
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] Mon Jul 20 15:33:16 2009 @@ -152,17 +152,6 @@ } }
- -VOID -NTAPI -RECTL_vSetEmptyRect(RECTL *prcl) -{ - prcl->left = 0; - prcl->top = 0; - prcl->right = 0; - prcl->bottom = 0; -} - BOOLEAN NTAPI RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2)
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] Mon Jul 20 15:33:16 2009 @@ -17,11 +17,8 @@ COLORREF crBackgroundClr;
/* Origins and extents */ - SIZE szVportExt; - POINT ptVportOrg; - SIZE szWndExt; - POINT ptWndOrg; - RECT rcDcRect; + RECT rcDcRect; /* Relative to Vport */ + RECT rcVport;
/* Combined clipping region */ CLIPOBJ *CombinedClip;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -98,11 +98,53 @@ const POINT *ptPoints, INT count);
-VOID NTAPI -RECTL_vSetEmptyRect(RECTL *prcl); - BOOLEAN NTAPI RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2); + +VOID +FORCEINLINE +RECTL_vSetRect(RECTL *prcl, LONG left, LONG top, LONG right, LONG bottom) +{ + prcl->left = left; + prcl->top = top; + prcl->right = right; + prcl->bottom = bottom; +} + +VOID +FORCEINLINE +RECTL_vSetEmptyRect(RECTL *prcl) +{ + prcl->left = 0; + prcl->top = 0; + prcl->right = 0; + prcl->bottom = 0; +} + +VOID +FORCEINLINE +RECTL_vOffsetRect(RECTL *prcl, INT cx, INT cy) +{ + prcl->left += cx; + prcl->right += cx; + prcl->top += cy; + prcl->bottom += cy; +} + +BOOL +FORCEINLINE +RECTL_bIsEmptyRect(const RECTL *prcl) +{ + return (prcl->left >= prcl->right || prcl->top >= prcl->bottom); +} + +BOOL +FORCEINLINE +RECTL_bPointInRect(const RECTL *prcl, INT x, INT y) +{ + return (x >= prcl->left && x <= prcl->right && + y >= prcl->top && y <= prcl->bottom); +}
/* Private Eng functions */ BOOL APIENTRY
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] Mon Jul 20 15:33:16 2009 @@ -30,7 +30,7 @@ RosGdiSetPixel 4 RosGdiSetPixelFormat 3 RosGdiSetTextColor 2 -RosGdiSetDcRect 2 +RosGdiSetDcRects 3 RosGdiChoosePixelFormat 2 RosGdiDescribePixelFormat 4 RosGdiEnumDeviceFonts 4