[PATCH 1/3] gdi32: Added EMFDRV_ArcTo, EMFDRV_PolyBezier,
EMFDRV_PolyBezierTo, EMFDRV_PolylineTo functions.
Fabian Franz
FabianFranz at gmx.de
Thu Feb 1 18:27:04 CST 2007
The following patchset adds support for the ArcTo, PolyBezier, PolyBezierTo
and PolylineTo functions.
In 2/3 also SetPixel is enabled in the functions table.
Signed-off-by: Fabian Franz <FabianFranz at gmx.de>
---
dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 9 +++-
dlls/gdi32/enhmfdrv/graphics.c | 92
+++++++++++++++++++++++++++++++---
2 files changed, 93 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
index 6d84d19..9578339 100644
--- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
+++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
@@ -60,6 +60,10 @@ extern BOOL EMFDRV_AbortPath( PHYSDEV dev );
extern BOOL EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend );
+extern BOOL EMFDRV_ArcTo( PHYSDEV dev, INT left, INT top, INT right,
+ INT bottom, INT xstart, INT ystart, INT xend,
+ INT yend );
+
extern BOOL EMFDRV_BeginPath( PHYSDEV dev );
extern BOOL EMFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst,
INT width, INT height, PHYSDEV devSrc,
@@ -104,8 +108,11 @@ extern BOOL EMFDRV_PolyPolygon( PHYSDEV dev, const
POINT* pt,
const INT* counts, UINT polys);
extern BOOL EMFDRV_PolyPolyline( PHYSDEV dev, const POINT* pt,
const DWORD* counts, DWORD polys);
-extern BOOL EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count );
extern BOOL EMFDRV_Polyline( PHYSDEV dev, const POINT* pt,INT count);
+extern BOOL EMFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD
count );
+extern BOOL EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count );
+extern BOOL EMFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD
count );
+extern BOOL EMFDRV_PolylineTo( PHYSDEV dev, const POINT* pt, DWORD
count);
extern BOOL EMFDRV_Rectangle( PHYSDEV dev, INT left, INT top,
INT right, INT bottom);
extern BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level );
diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index 4a695f2..7d027e6 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -80,7 +80,6 @@ EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
return TRUE;
}
-
/***********************************************************************
* EMFDRV_ArcChordPie
*/
@@ -197,6 +196,16 @@ EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
INT bottom,
}
/***********************************************************************
+ * EMFDRV_Arc
+ */
+BOOL
+EMFDRV_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
+ INT xstart, INT ystart, INT xend, INT yend )
+{
+ return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
+ xend, yend, EMR_ARCTO );
+}
+/***********************************************************************
* EMFDRV_Pie
*/
BOOL
@@ -351,6 +360,8 @@ EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF
color )
static BOOL
EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
{
+ EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
+ POINT tpt;
EMRPOLYLINE *emr;
DWORD size;
INT i;
@@ -362,10 +373,22 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT
count, DWORD iType )
emr->emr.iType = iType;
emr->emr.nSize = size;
- emr->rclBounds.left = emr->rclBounds.right = pt[0].x;
- emr->rclBounds.top = emr->rclBounds.bottom = pt[0].y;
+ if (iType == EMR_POLYLINETO || iType == EMR_POLYBEZIERTO)
+ {
+ i = 0;
+ GetCurrentPositionEx(physDev->hdc, &tpt);
+ emr->rclBounds.left = emr->rclBounds.right = tpt.x;
+ emr->rclBounds.top = emr->rclBounds.bottom = tpt.y;
+
+ }
+ else
+ {
+ i = 1;
+ emr->rclBounds.left = emr->rclBounds.right = pt[0].x;
+ emr->rclBounds.top = emr->rclBounds.bottom = pt[0].y;
+ }
- for(i = 1; i < count; i++) {
+ for(; i < count; i++) {
if(pt[i].x < emr->rclBounds.left)
emr->rclBounds.left = pt[i].x;
else if(pt[i].x > emr->rclBounds.right)
@@ -398,6 +421,8 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT
count, DWORD iType )
static BOOL
EMFDRV_Polylinegon16( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
{
+ EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
+ POINT tpt;
EMRPOLYLINE16 *emr;
DWORD size;
INT i;
@@ -416,10 +441,22 @@ EMFDRV_Polylinegon16( PHYSDEV dev, const POINT* pt, INT
count, DWORD iType )
emr->emr.iType = iType;
emr->emr.nSize = size;
- emr->rclBounds.left = emr->rclBounds.right = pt[0].x;
- emr->rclBounds.top = emr->rclBounds.bottom = pt[0].y;
+ if (iType == EMR_POLYLINETO16 || iType == EMR_POLYBEZIERTO16)
+ {
+ i = 0;
+ GetCurrentPositionEx(physDev->hdc, &tpt);
+ emr->rclBounds.left = emr->rclBounds.right = tpt.x;
+ emr->rclBounds.top = emr->rclBounds.bottom = tpt.y;
+
+ }
+ else
+ {
+ i = 1;
+ emr->rclBounds.left = emr->rclBounds.right = pt[0].x;
+ emr->rclBounds.top = emr->rclBounds.bottom = pt[0].y;
+ }
- for(i = 1; i < count; i++) {
+ for(; i < count; i++) {
if(pt[i].x < emr->rclBounds.left)
emr->rclBounds.left = pt[i].x;
else if(pt[i].x > emr->rclBounds.right)
@@ -456,6 +493,21 @@ EMFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT
count )
}
/**********************************************************************
+ * EMFDRV_PolyBezier
+ */
+
+/* FIXME: The BBox could be a bit too large, but there is no easy
approximation function
+ * known. */
+BOOL
+EMFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count )
+{
+ if(count < 4 || ((count-4) % 3) != 0) return FALSE;
+ if( EMFDRV_Polylinegon16( dev, pt, count, EMR_POLYBEZIER16 ) )
+ return TRUE;
+ return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYBEZIER );
+}
+
+/**********************************************************************
* EMFDRV_Polygon
*/
BOOL
@@ -467,6 +519,32 @@ EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYGON );
}
+/**********************************************************************
+ * EMFDRV_PolyBezierTo
+ */
+
+/* FIXME: The BBox could be a bit too large, but there is no easy
approximation function
+ * known. */
+BOOL
+EMFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD count )
+{
+ if(count < 3 || (count % 3) != 0) return FALSE;
+ if( EMFDRV_Polylinegon16( dev, pt, count, EMR_POLYBEZIERTO16 ) )
+ return TRUE;
+ return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYBEZIERTO );
+}
+
+
+/**********************************************************************
+ * EMFDRV_PolylineTo
+ */
+BOOL
+EMFDRV_PolylineTo( PHYSDEV dev, const POINT* pt, DWORD count )
+{
+ if( EMFDRV_Polylinegon16( dev, pt, count, EMR_POLYLINETO16 ) )
+ return TRUE;
+ return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYLINETO );
+}
/**********************************************************************
* EMFDRV_PolyPolylinegon
--
1.4.4.3
More information about the wine-patches
mailing list