Author: navaraf
Date: Wed Jun 21 12:33:27 2006
New Revision: 22448
URL:
http://svn.reactos.ru/svn/reactos?rev=22448&view=rev
Log:
Implement the isometric mapping mode and call the mapping functions for Ellipse and
Polygon drawing. Thanks MgW from IRC for testing. :)
Modified:
trunk/reactos/subsystems/win32/win32k/objects/coord.c
trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/coord.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/coord.c Wed Jun 21 12:33:27 2006
@@ -34,6 +34,24 @@
/* FUNCTIONS *****************************************************************/
+void FASTCALL
+IntFixIsotropicMapping(PDC dc)
+{
+ ULONG xdim = EngMulDiv(dc->vportExtX, dc->GDIInfo->ulHorzSize,
dc->GDIInfo->ulHorzRes) / dc->wndExtX;
+ ULONG ydim = EngMulDiv(dc->vportExtY, dc->GDIInfo->ulVertSize,
dc->GDIInfo->ulVertRes) / dc->wndExtY;
+
+ if (xdim > ydim)
+ {
+ dc->vportExtX = dc->vportExtX * abs(ydim / xdim);
+ if (!dc->vportExtX) dc->vportExtX = 1;
+ }
+ else
+ {
+ dc->vportExtY = dc->vportExtY * abs(xdim / ydim);
+ if (!dc->vportExtY) dc->vportExtY = 1;
+ }
+}
+
BOOL FASTCALL
IntGdiCombineTransform(LPXFORM XFormResult,
LPXFORM xform1,
@@ -668,7 +686,62 @@
}
PrevMapMode = dc->w.MapMode;
- dc->w.MapMode = MapMode;
+
+ if (MapMode != dc->w.MapMode || (MapMode != MM_ISOTROPIC && MapMode !=
MM_ANISOTROPIC))
+ {
+ dc->w.MapMode = MapMode;
+
+ switch (MapMode)
+ {
+ case MM_TEXT:
+ dc->wndExtX = 1;
+ dc->wndExtY = 1;
+ dc->vportExtX = 1;
+ dc->vportExtY = 1;
+ break;
+
+ case MM_LOMETRIC:
+ case MM_ISOTROPIC:
+ dc->wndExtX = dc->GDIInfo->ulHorzSize * 10;
+ dc->wndExtY = dc->GDIInfo->ulVertSize * 10;
+ dc->vportExtX = dc->GDIInfo->ulHorzRes;
+ dc->vportExtY = -dc->GDIInfo->ulVertRes;
+ break;
+
+ case MM_HIMETRIC:
+ dc->wndExtX = dc->GDIInfo->ulHorzSize * 100;
+ dc->wndExtY = dc->GDIInfo->ulVertSize * 100;
+ dc->vportExtX = dc->GDIInfo->ulHorzRes;
+ dc->vportExtY = -dc->GDIInfo->ulVertRes;
+ break;
+
+ case MM_LOENGLISH:
+ dc->wndExtX = EngMulDiv(1000, dc->GDIInfo->ulHorzSize, 254);
+ dc->wndExtY = EngMulDiv(1000, dc->GDIInfo->ulVertSize, 254);
+ dc->vportExtX = dc->GDIInfo->ulHorzRes;
+ dc->vportExtY = -dc->GDIInfo->ulVertRes;
+ break;
+
+ case MM_HIENGLISH:
+ dc->wndExtX = EngMulDiv(10000, dc->GDIInfo->ulHorzSize, 254);
+ dc->wndExtY = EngMulDiv(10000, dc->GDIInfo->ulVertSize, 254);
+ dc->vportExtX = dc->GDIInfo->ulHorzRes;
+ dc->vportExtY = -dc->GDIInfo->ulVertRes;
+ break;
+
+ case MM_TWIPS:
+ dc->wndExtX = EngMulDiv(14400, dc->GDIInfo->ulHorzSize, 254);
+ dc->wndExtY = EngMulDiv(14400, dc->GDIInfo->ulVertSize, 254);
+ dc->vportExtX = dc->GDIInfo->ulHorzRes;
+ dc->vportExtY = -dc->GDIInfo->ulVertRes;
+ break;
+
+ case MM_ANISOTROPIC:
+ break;
+ }
+
+ DC_UpdateXforms(dc);
+ }
DC_UnlockDc(dc);
@@ -737,6 +810,8 @@
dc->vportExtX = XExtent;
dc->vportExtY = YExtent;
+ if (dc->w.MapMode == MM_ISOTROPIC)
+ IntFixIsotropicMapping(dc);
DC_UpdateXforms(dc);
DC_UnlockDc(dc);
Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c Wed Jun 21 12:33:27 2006
@@ -66,6 +66,7 @@
ASSERT(BitmapObj);
/* Convert to screen coordinates */
+ IntLPtoDP(dc, UnsafePoints, Count);
for (CurrentPoint = 0; CurrentPoint < Count; CurrentPoint++)
{
UnsafePoints[CurrentPoint].x += dc->w.DCOrgX;
@@ -258,20 +259,22 @@
IntGdiInitBrushInstance(&FillBrushInst, FillBrush, dc->XlateBrush);
IntGdiInitBrushInstance(&PenBrushInst, PenBrush, dc->XlatePen);
- nLeftRect += dc->w.DCOrgX;
- nRightRect += dc->w.DCOrgX - 1;
- nTopRect += dc->w.DCOrgY;
- nBottomRect += dc->w.DCOrgY - 1;
-
- RadiusX = max((nRightRect - nLeftRect) >> 1, 1);
- RadiusY = max((nBottomRect - nTopRect) >> 1, 1);
- CenterX = nLeftRect + RadiusX;
- CenterY = nTopRect + RadiusY;
-
RectBounds.left = nLeftRect;
RectBounds.right = nRightRect;
RectBounds.top = nTopRect;
RectBounds.bottom = nBottomRect;
+
+ IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
+
+ RectBounds.left += dc->w.DCOrgX;
+ RectBounds.right += dc->w.DCOrgX;
+ RectBounds.top += dc->w.DCOrgY;
+ RectBounds.bottom += dc->w.DCOrgY;
+
+ RadiusX = max((RectBounds.right - RectBounds.left) >> 1, 1);
+ RadiusY = max((RectBounds.bottom - RectBounds.top) >> 1, 1);
+ CenterX = RectBounds.left + RadiusX;
+ CenterY = RectBounds.top + RadiusY;
if (RadiusX > RadiusY)
{