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
* 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
* PROJECT: ReactOS kernel
@ -426,9 +426,6 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
dc->vportOrgY += YOffset;
DC_UpdateXforms(dc);
dc->w.DCOrgX += XOffset;
dc->w.DCOrgY += YOffset;
DC_UnlockDc ( hDC );
return TRUE;
}
@ -469,6 +466,7 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
dc->wndOrgX += XOffset;
dc->wndOrgY += YOffset;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC);
return TRUE;
@ -608,6 +606,7 @@ NtGdiSetViewportExtEx(HDC hDC,
dc->vportExtX = XExtent;
dc->vportExtY = YExtent;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC);
return TRUE;
@ -703,6 +702,7 @@ NtGdiSetWindowExtEx(HDC hDC,
dc->wndExtX = XExtent;
dc->wndExtY = YExtent;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC);
return TRUE;
@ -744,6 +744,7 @@ NtGdiSetWindowOrgEx(HDC hDC,
dc->wndOrgX = X;
dc->wndOrgY = Y;
DC_UpdateXforms(dc);
DC_UnlockDc(hDC);
return TRUE;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
*
@ -2050,6 +2050,10 @@ DC_AllocDC(PUNICODE_STRING Driver)
NewDC->w.xformVport2World = NewDC->w.xformWorld2Wnd;
NewDC->w.vport2WorldValid = TRUE;
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);
TextIntRealizeFont(NewDC->w.hFont);
@ -2119,8 +2123,8 @@ DC_UpdateXforms(PDC dc)
FLOAT scaleX, scaleY;
/* Construct a transformation to do the window-to-viewport conversion */
scaleX = (dc->wndExtX ? (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX : 0.0);
scaleY = (dc->wndExtY ? (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY : 0.0);
scaleX = (dc->wndExtX ? (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX : 0.0f);
scaleY = (dc->wndExtY ? (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY : 0.0f);
xformWnd2Vport.eM11 = scaleX;
xformWnd2Vport.eM12 = 0.0;
xformWnd2Vport.eM21 = 0.0;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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>
// Some code from the WINE project source (www.winehq.com)
@ -55,6 +55,7 @@ IntGdiLineTo(DC *dc,
BOOL Ret;
PGDIBRUSHOBJ PenBrushObj;
RECTL Bounds;
POINT Points[2];
SurfObj = (SURFOBJ*)AccessUserObject ( (ULONG)dc->Surface );
if (NULL == SurfObj)
@ -76,30 +77,23 @@ IntGdiLineTo(DC *dc,
}
else
{
if (dc->w.CursPosX <= XEnd)
{
Bounds.left = dc->w.CursPosX;
Bounds.right = XEnd;
}
else
{
Bounds.left = XEnd;
Bounds.right = dc->w.CursPosX;
}
Bounds.left += dc->w.DCOrgX;
Bounds.right += dc->w.DCOrgX;
if (dc->w.CursPosY <= YEnd)
{
Bounds.top = dc->w.CursPosY;
Bounds.bottom = YEnd;
}
else
{
Bounds.top = YEnd;
Bounds.bottom = dc->w.CursPosY;
}
Bounds.top += dc->w.DCOrgY;
Bounds.bottom += dc->w.DCOrgY;
Points[0].x = dc->w.CursPosX;
Points[0].y = dc->w.CursPosY;
Points[1].x = XEnd;
Points[1].y = YEnd;
IntLPtoDP(dc, Points, 2);
/* FIXME: Is it correct to do this after the transformation? */
Points[0].x += dc->w.DCOrgX;
Points[0].y += dc->w.DCOrgY;
Points[1].x += dc->w.DCOrgX;
Points[1].y += dc->w.DCOrgY;
Bounds.left = min(Points[0].x, Points[1].x);
Bounds.top = min(Points[0].y, Points[1].y);
Bounds.right = max(Points[0].x, Points[1].x);
Bounds.bottom = max(Points[0].y, Points[1].y);
/* get BRUSHOBJ from current pen. */
PenBrushObj = PENOBJ_LockPen( dc->w.hPen );
@ -110,8 +104,8 @@ IntGdiLineTo(DC *dc,
Ret = IntEngLineTo(SurfObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
dc->w.DCOrgX + dc->w.CursPosX, dc->w.DCOrgY + dc->w.CursPosY,
dc->w.DCOrgX + XEnd, dc->w.DCOrgY + YEnd,
Points[0].x, Points[0].y,
Points[1].x, Points[1].y,
&Bounds,
dc->w.ROPmode);
}

View file

@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* 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 <ft2build.h>
@ -1493,7 +1493,8 @@ NtGdiExtTextOut(
FT_Render_Mode RenderMode;
BOOLEAN Render;
NTSTATUS Status;
INT *Dx = NULL;;
INT *Dx = NULL;
POINT Start;
dc = DC_LockDc(hDC);
if (!dc)
@ -1518,8 +1519,11 @@ NtGdiExtTextOut(
SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
XStart += dc->w.DCOrgX;
YStart += dc->w.DCOrgY;
Start.x = XStart; Start.y = YStart;
IntLPtoDP(dc, &Start, 1);
XStart = Start.x + dc->w.DCOrgX;
YStart = Start.y + dc->w.DCOrgY;
TextObj = TEXTOBJ_LockText(dc->w.hFont);