Changelog:

- Don't change DC origin in NtGdiOffsetViewportOrgEx
- Update transformation matrix in NtGdiSetViewportExtEx,
  NtGdiSetWindowExtEx, NtGdiSetWindowOrgEx, NtGdiOffsetWindowOrgEx
- When creating new DC initialize the Viewport/Window extensions.
- Transform logical coordinates to device ones in NtGdiExtTextOut
  and NtGdiLineTo.

svn path=/trunk/; revision=9703
This commit is contained in:
Filip Navara 2004-06-18 15:18:58 +00:00
parent 9ba82f014d
commit 80799cc3c8
4 changed files with 41 additions and 38 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: coord.c,v 1.24 2004/06/14 20:58:51 navaraf Exp $ /* $Id: coord.c,v 1.25 2004/06/18 15:18:54 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -426,9 +426,6 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
dc->vportOrgY += YOffset; dc->vportOrgY += YOffset;
DC_UpdateXforms(dc); DC_UpdateXforms(dc);
dc->w.DCOrgX += XOffset;
dc->w.DCOrgY += YOffset;
DC_UnlockDc ( hDC ); DC_UnlockDc ( hDC );
return TRUE; return TRUE;
} }
@ -469,6 +466,7 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
dc->wndOrgX += XOffset; dc->wndOrgX += XOffset;
dc->wndOrgY += YOffset; dc->wndOrgY += YOffset;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC); DC_UnlockDc(hDC);
return TRUE; return TRUE;
@ -608,6 +606,7 @@ NtGdiSetViewportExtEx(HDC hDC,
dc->vportExtX = XExtent; dc->vportExtX = XExtent;
dc->vportExtY = YExtent; dc->vportExtY = YExtent;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC); DC_UnlockDc(hDC);
return TRUE; return TRUE;
@ -703,6 +702,7 @@ NtGdiSetWindowExtEx(HDC hDC,
dc->wndExtX = XExtent; dc->wndExtX = XExtent;
dc->wndExtY = YExtent; dc->wndExtY = YExtent;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC); DC_UnlockDc(hDC);
return TRUE; return TRUE;
@ -744,6 +744,7 @@ NtGdiSetWindowOrgEx(HDC hDC,
dc->wndOrgX = X; dc->wndOrgX = X;
dc->wndOrgY = Y; dc->wndOrgY = Y;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC); DC_UnlockDc(hDC);
return TRUE; return TRUE;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: dc.c,v 1.137 2004/05/30 14:01:13 weiden Exp $ /* $Id: dc.c,v 1.138 2004/06/18 15:18:56 navaraf Exp $
* *
* DC.C - Device context functions * DC.C - Device context functions
* *
@ -2050,6 +2050,10 @@ DC_AllocDC(PUNICODE_STRING Driver)
NewDC->w.xformVport2World = NewDC->w.xformWorld2Wnd; NewDC->w.xformVport2World = NewDC->w.xformWorld2Wnd;
NewDC->w.vport2WorldValid = TRUE; NewDC->w.vport2WorldValid = TRUE;
NewDC->w.MapMode = MM_TEXT; NewDC->w.MapMode = MM_TEXT;
NewDC->wndExtX = 1.0f;
NewDC->wndExtY = 1.0f;
NewDC->vportExtX = 1.0f;
NewDC->vportExtY = 1.0f;
NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT); NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT);
TextIntRealizeFont(NewDC->w.hFont); TextIntRealizeFont(NewDC->w.hFont);
@ -2119,8 +2123,8 @@ DC_UpdateXforms(PDC dc)
FLOAT scaleX, scaleY; FLOAT scaleX, scaleY;
/* Construct a transformation to do the window-to-viewport conversion */ /* Construct a transformation to do the window-to-viewport conversion */
scaleX = (dc->wndExtX ? (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX : 0.0); scaleX = (dc->wndExtX ? (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX : 0.0f);
scaleY = (dc->wndExtY ? (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY : 0.0); scaleY = (dc->wndExtY ? (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY : 0.0f);
xformWnd2Vport.eM11 = scaleX; xformWnd2Vport.eM11 = scaleX;
xformWnd2Vport.eM12 = 0.0; xformWnd2Vport.eM12 = 0.0;
xformWnd2Vport.eM21 = 0.0; xformWnd2Vport.eM21 = 0.0;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: line.c,v 1.31 2004/05/14 16:55:18 navaraf Exp $ */ /* $Id: line.c,v 1.32 2004/06/18 15:18:57 navaraf Exp $ */
#include <w32k.h> #include <w32k.h>
// Some code from the WINE project source (www.winehq.com) // Some code from the WINE project source (www.winehq.com)
@ -55,6 +55,7 @@ IntGdiLineTo(DC *dc,
BOOL Ret; BOOL Ret;
PGDIBRUSHOBJ PenBrushObj; PGDIBRUSHOBJ PenBrushObj;
RECTL Bounds; RECTL Bounds;
POINT Points[2];
SurfObj = (SURFOBJ*)AccessUserObject ( (ULONG)dc->Surface ); SurfObj = (SURFOBJ*)AccessUserObject ( (ULONG)dc->Surface );
if (NULL == SurfObj) if (NULL == SurfObj)
@ -76,30 +77,23 @@ IntGdiLineTo(DC *dc,
} }
else else
{ {
if (dc->w.CursPosX <= XEnd) Points[0].x = dc->w.CursPosX;
{ Points[0].y = dc->w.CursPosY;
Bounds.left = dc->w.CursPosX; Points[1].x = XEnd;
Bounds.right = XEnd; Points[1].y = YEnd;
}
else IntLPtoDP(dc, Points, 2);
{
Bounds.left = XEnd; /* FIXME: Is it correct to do this after the transformation? */
Bounds.right = dc->w.CursPosX; Points[0].x += dc->w.DCOrgX;
} Points[0].y += dc->w.DCOrgY;
Bounds.left += dc->w.DCOrgX; Points[1].x += dc->w.DCOrgX;
Bounds.right += dc->w.DCOrgX; Points[1].y += dc->w.DCOrgY;
if (dc->w.CursPosY <= YEnd)
{ Bounds.left = min(Points[0].x, Points[1].x);
Bounds.top = dc->w.CursPosY; Bounds.top = min(Points[0].y, Points[1].y);
Bounds.bottom = YEnd; Bounds.right = max(Points[0].x, Points[1].x);
} Bounds.bottom = max(Points[0].y, Points[1].y);
else
{
Bounds.top = YEnd;
Bounds.bottom = dc->w.CursPosY;
}
Bounds.top += dc->w.DCOrgY;
Bounds.bottom += dc->w.DCOrgY;
/* get BRUSHOBJ from current pen. */ /* get BRUSHOBJ from current pen. */
PenBrushObj = PENOBJ_LockPen( dc->w.hPen ); PenBrushObj = PENOBJ_LockPen( dc->w.hPen );
@ -110,8 +104,8 @@ IntGdiLineTo(DC *dc,
Ret = IntEngLineTo(SurfObj, Ret = IntEngLineTo(SurfObj,
dc->CombinedClip, dc->CombinedClip,
&PenBrushObj->BrushObject, &PenBrushObj->BrushObject,
dc->w.DCOrgX + dc->w.CursPosX, dc->w.DCOrgY + dc->w.CursPosY, Points[0].x, Points[0].y,
dc->w.DCOrgX + XEnd, dc->w.DCOrgY + YEnd, Points[1].x, Points[1].y,
&Bounds, &Bounds,
dc->w.ROPmode); dc->w.ROPmode);
} }

View file

@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: text.c,v 1.95 2004/05/30 14:51:45 jfilby Exp $ */ /* $Id: text.c,v 1.96 2004/06/18 15:18:58 navaraf Exp $ */
#include <w32k.h> #include <w32k.h>
#include <ft2build.h> #include <ft2build.h>
@ -1493,7 +1493,8 @@ NtGdiExtTextOut(
FT_Render_Mode RenderMode; FT_Render_Mode RenderMode;
BOOLEAN Render; BOOLEAN Render;
NTSTATUS Status; NTSTATUS Status;
INT *Dx = NULL;; INT *Dx = NULL;
POINT Start;
dc = DC_LockDc(hDC); dc = DC_LockDc(hDC);
if (!dc) if (!dc)
@ -1518,8 +1519,11 @@ NtGdiExtTextOut(
SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface); SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
XStart += dc->w.DCOrgX; Start.x = XStart; Start.y = YStart;
YStart += dc->w.DCOrgY; IntLPtoDP(dc, &Start, 1);
XStart = Start.x + dc->w.DCOrgX;
YStart = Start.y + dc->w.DCOrgY;
TextObj = TEXTOBJ_LockText(dc->w.hFont); TextObj = TEXTOBJ_LockText(dc->w.hFont);