2 * Graphics paths (BeginPath, EndPath etc.)
4 * Copyright 1997, 1998 Martin Boehme
6 * Copyright 2005 Dmitry Timoshkov
7 * Copyright 2011 Alexandre Julliard
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
36 #include "ntgdi_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
41 /* Notes on the implementation
43 * The implementation is based on dynamically resizable arrays of points and
44 * flags. I dithered for a bit before deciding on this implementation, and
45 * I had even done a bit of work on a linked list version before switching
46 * to arrays. It's a bit of a tradeoff. When you use linked lists, the
47 * implementation of FlattenPath is easier, because you can rip the
48 * PT_BEZIERTO entries out of the middle of the list and link the
49 * corresponding PT_LINETO entries in. However, when you use arrays,
50 * PathToRegion becomes easier, since you can essentially just pass your array
51 * of points to CreatePolyPolygonRgn. Also, if I'd used linked lists, I would
52 * have had the extra effort of creating a chunk-based allocation scheme
53 * in order to use memory effectively. That's why I finally decided to use
54 * arrays. Note by the way that the array based implementation has the same
55 * linear time complexity that linked lists would have since the arrays grow
58 * The points are stored in the path in device coordinates. This is
59 * consistent with the way Windows does things (for instance, see the Win32
60 * SDK documentation for GetPath).
62 * The word "stroke" appears in several places (e.g. in the flag
63 * GdiPath.newStroke). A stroke consists of a PT_MOVETO followed by one or
64 * more PT_LINETOs or PT_BEZIERTOs, up to, but not including, the next
65 * PT_MOVETO. Note that this is not the same as the definition of a figure;
66 * a figure can contain several strokes.
71 #define NUM_ENTRIES_INITIAL 16 /* Initial size of points / flags arrays */
73 /* A floating point version of the POINT structure */
74 typedef struct tagFLOAT_POINT
86 POINT pos
; /* current cursor position */
87 POINT points_buf
[NUM_ENTRIES_INITIAL
];
88 BYTE flags_buf
[NUM_ENTRIES_INITIAL
];
93 struct gdi_physdev dev
;
94 struct gdi_path
*path
;
97 static inline struct path_physdev
*get_path_physdev( PHYSDEV dev
)
99 return CONTAINING_RECORD( dev
, struct path_physdev
, dev
);
102 void free_gdi_path( struct gdi_path
*path
)
104 if (path
->points
!= path
->points_buf
)
105 HeapFree( GetProcessHeap(), 0, path
->points
);
106 HeapFree( GetProcessHeap(), 0, path
);
109 static struct gdi_path
*alloc_gdi_path( int count
)
111 struct gdi_path
*path
= HeapAlloc( GetProcessHeap(), 0, sizeof(*path
) );
115 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
118 count
= max( NUM_ENTRIES_INITIAL
, count
);
119 if (count
> NUM_ENTRIES_INITIAL
)
121 path
->points
= HeapAlloc( GetProcessHeap(), 0,
122 count
* (sizeof(path
->points
[0]) + sizeof(path
->flags
[0])) );
125 HeapFree( GetProcessHeap(), 0, path
);
126 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
129 path
->flags
= (BYTE
*)(path
->points
+ count
);
133 path
->points
= path
->points_buf
;
134 path
->flags
= path
->flags_buf
;
137 path
->allocated
= count
;
138 path
->newStroke
= TRUE
;
139 path
->pos
.x
= path
->pos
.y
= 0;
143 static struct gdi_path
*copy_gdi_path( const struct gdi_path
*src_path
)
145 struct gdi_path
*path
= alloc_gdi_path( src_path
->count
);
147 if (!path
) return NULL
;
149 path
->count
= src_path
->count
;
150 path
->newStroke
= src_path
->newStroke
;
151 path
->pos
= src_path
->pos
;
152 memcpy( path
->points
, src_path
->points
, path
->count
* sizeof(*path
->points
) );
153 memcpy( path
->flags
, src_path
->flags
, path
->count
* sizeof(*path
->flags
) );
157 /* Performs a world-to-viewport transformation on the specified point (which
158 * is in floating point format).
160 static inline void INTERNAL_LPTODP_FLOAT( DC
*dc
, FLOAT_POINT
*point
, int count
)
168 point
->x
= x
* dc
->xformWorld2Vport
.eM11
+ y
* dc
->xformWorld2Vport
.eM21
+ dc
->xformWorld2Vport
.eDx
;
169 point
->y
= x
* dc
->xformWorld2Vport
.eM12
+ y
* dc
->xformWorld2Vport
.eM22
+ dc
->xformWorld2Vport
.eDy
;
174 static inline INT
int_from_fixed(FIXED f
)
176 return (f
.fract
>= 0x8000) ? (f
.value
+ 1) : f
.value
;
180 /* PATH_ReserveEntries
182 * Ensures that at least "numEntries" entries (for points and flags) have
183 * been allocated; allocates larger arrays and copies the existing entries
184 * to those arrays, if necessary. Returns TRUE if successful, else FALSE.
186 static BOOL
PATH_ReserveEntries(struct gdi_path
*path
, INT count
)
193 /* Do we have to allocate more memory? */
194 if (count
> path
->allocated
)
196 /* Find number of entries to allocate. We let the size of the array
197 * grow exponentially, since that will guarantee linear time
199 count
= max( path
->allocated
* 2, count
);
200 size
= count
* (sizeof(path
->points
[0]) + sizeof(path
->flags
[0]));
202 if (path
->points
== path
->points_buf
)
204 pts_new
= HeapAlloc( GetProcessHeap(), 0, size
);
205 if (!pts_new
) return FALSE
;
206 memcpy( pts_new
, path
->points
, path
->count
* sizeof(path
->points
[0]) );
207 memcpy( pts_new
+ count
, path
->flags
, path
->count
* sizeof(path
->flags
[0]) );
211 pts_new
= HeapReAlloc( GetProcessHeap(), 0, path
->points
, size
);
212 if (!pts_new
) return FALSE
;
213 memmove( pts_new
+ count
, pts_new
+ path
->allocated
, path
->count
* sizeof(path
->flags
[0]) );
216 path
->points
= pts_new
;
217 path
->flags
= (BYTE
*)(pts_new
+ count
);
218 path
->allocated
= count
;
225 * Adds an entry to the path. For "flags", pass either PT_MOVETO, PT_LINETO
226 * or PT_BEZIERTO, optionally ORed with PT_CLOSEFIGURE. Returns TRUE if
227 * successful, FALSE otherwise (e.g. if not enough memory was available).
229 static BOOL
PATH_AddEntry(struct gdi_path
*pPath
, const POINT
*pPoint
, BYTE flags
)
231 /* FIXME: If newStroke is true, perhaps we want to check that we're
232 * getting a PT_MOVETO
234 TRACE("(%d,%d) - %d\n", pPoint
->x
, pPoint
->y
, flags
);
236 /* Reserve enough memory for an extra path entry */
237 if(!PATH_ReserveEntries(pPath
, pPath
->count
+1))
240 /* Store information in path entry */
241 pPath
->points
[pPath
->count
]=*pPoint
;
242 pPath
->flags
[pPath
->count
]=flags
;
249 /* add a number of points, converting them to device coords */
250 /* return a pointer to the first type byte so it can be fixed up if necessary */
251 static BYTE
*add_log_points( DC
*dc
, struct gdi_path
*path
, const POINT
*points
,
252 DWORD count
, BYTE type
)
256 if (!PATH_ReserveEntries( path
, path
->count
+ count
)) return NULL
;
258 ret
= &path
->flags
[path
->count
];
259 memcpy( &path
->points
[path
->count
], points
, count
* sizeof(*points
) );
260 lp_to_dp( dc
, &path
->points
[path
->count
], count
);
261 memset( ret
, type
, count
);
262 path
->count
+= count
;
266 /* add a number of points that are already in device coords */
267 /* return a pointer to the first type byte so it can be fixed up if necessary */
268 static BYTE
*add_points( struct gdi_path
*path
, const POINT
*points
, DWORD count
, BYTE type
)
272 if (!PATH_ReserveEntries( path
, path
->count
+ count
)) return NULL
;
274 ret
= &path
->flags
[path
->count
];
275 memcpy( &path
->points
[path
->count
], points
, count
* sizeof(*points
) );
276 memset( ret
, type
, count
);
277 path
->count
+= count
;
281 /* reverse the order of an array of points */
282 static void reverse_points( POINT
*points
, UINT count
)
285 for (i
= 0; i
< count
/ 2; i
++)
287 POINT pt
= points
[i
];
288 points
[i
] = points
[count
- i
- 1];
289 points
[count
- i
- 1] = pt
;
293 /* start a new path stroke if necessary */
294 static BOOL
start_new_stroke( struct gdi_path
*path
)
296 if (!path
->newStroke
&& path
->count
&&
297 !(path
->flags
[path
->count
- 1] & PT_CLOSEFIGURE
) &&
298 path
->points
[path
->count
- 1].x
== path
->pos
.x
&&
299 path
->points
[path
->count
- 1].y
== path
->pos
.y
)
302 path
->newStroke
= FALSE
;
303 return add_points( path
, &path
->pos
, 1, PT_MOVETO
) != NULL
;
306 /* set current position to the last point that was added to the path */
307 static void update_current_pos( struct gdi_path
*path
)
309 assert( path
->count
);
310 path
->pos
= path
->points
[path
->count
- 1];
313 /* close the current figure */
314 static void close_figure( struct gdi_path
*path
)
316 assert( path
->count
);
317 path
->flags
[path
->count
- 1] |= PT_CLOSEFIGURE
;
320 /* add a number of points, starting a new stroke if necessary */
321 static BOOL
add_log_points_new_stroke( DC
*dc
, struct gdi_path
*path
, const POINT
*points
,
322 DWORD count
, BYTE type
)
324 if (!start_new_stroke( path
)) return FALSE
;
325 if (!add_log_points( dc
, path
, points
, count
, type
)) return FALSE
;
326 update_current_pos( path
);
330 /* convert a (flattened) path to a region */
331 static HRGN
path_to_region( const struct gdi_path
*path
, int mode
)
333 int i
, pos
, polygons
, *counts
;
336 if (!path
->count
) return 0;
338 if (!(counts
= HeapAlloc( GetProcessHeap(), 0, (path
->count
/ 2) * sizeof(*counts
) ))) return 0;
341 assert( path
->flags
[0] == PT_MOVETO
);
342 for (i
= 1; i
< path
->count
; i
++)
344 if (path
->flags
[i
] != PT_MOVETO
) continue;
345 counts
[polygons
++] = i
- pos
;
348 if (i
> pos
+ 1) counts
[polygons
++] = i
- pos
;
350 assert( polygons
<= path
->count
/ 2 );
351 hrgn
= CreatePolyPolygonRgn( path
->points
, counts
, polygons
, mode
);
352 HeapFree( GetProcessHeap(), 0, counts
);
358 * Helper function for RoundRect() and Rectangle()
360 static BOOL
PATH_CheckCorners( DC
*dc
, POINT corners
[], INT x1
, INT y1
, INT x2
, INT y2
)
364 /* Convert points to device coordinates */
369 lp_to_dp( dc
, corners
, 2 );
371 /* Make sure first corner is top left and second corner is bottom right */
372 if(corners
[0].x
>corners
[1].x
)
375 corners
[0].x
=corners
[1].x
;
378 if(corners
[0].y
>corners
[1].y
)
381 corners
[0].y
=corners
[1].y
;
385 /* In GM_COMPATIBLE, don't include bottom and right edges */
386 if (dc
->GraphicsMode
== GM_COMPATIBLE
)
388 if (corners
[0].x
== corners
[1].x
) return FALSE
;
389 if (corners
[0].y
== corners
[1].y
) return FALSE
;
396 /* PATH_AddFlatBezier
398 static BOOL
PATH_AddFlatBezier(struct gdi_path
*pPath
, POINT
*pt
, BOOL closed
)
404 pts
= GDI_Bezier( pt
, 4, &no
);
405 if(!pts
) return FALSE
;
407 ret
= (add_points( pPath
, pts
+ 1, no
- 1, PT_LINETO
) != NULL
);
408 if (ret
&& closed
) close_figure( pPath
);
409 HeapFree( GetProcessHeap(), 0, pts
);
415 * Replaces Beziers with line segments
418 static struct gdi_path
*PATH_FlattenPath(const struct gdi_path
*pPath
)
420 struct gdi_path
*new_path
;
423 if (!(new_path
= alloc_gdi_path( pPath
->count
))) return NULL
;
425 for(srcpt
= 0; srcpt
< pPath
->count
; srcpt
++) {
426 switch(pPath
->flags
[srcpt
] & ~PT_CLOSEFIGURE
) {
429 if (!PATH_AddEntry(new_path
, &pPath
->points
[srcpt
], pPath
->flags
[srcpt
]))
431 free_gdi_path( new_path
);
436 if (!PATH_AddFlatBezier(new_path
, &pPath
->points
[srcpt
-1],
437 pPath
->flags
[srcpt
+2] & PT_CLOSEFIGURE
))
439 free_gdi_path( new_path
);
449 /* PATH_ScaleNormalizedPoint
451 * Scales a normalized point (x, y) with respect to the box whose corners are
452 * passed in "corners". The point is stored in "*pPoint". The normalized
453 * coordinates (-1.0, -1.0) correspond to corners[0], the coordinates
454 * (1.0, 1.0) correspond to corners[1].
456 static void PATH_ScaleNormalizedPoint(FLOAT_POINT corners
[], double x
,
457 double y
, POINT
*pPoint
)
459 pPoint
->x
= GDI_ROUND( corners
[0].x
+ (corners
[1].x
-corners
[0].x
)*0.5*(x
+1.0) );
460 pPoint
->y
= GDI_ROUND( corners
[0].y
+ (corners
[1].y
-corners
[0].y
)*0.5*(y
+1.0) );
463 /* PATH_NormalizePoint
465 * Normalizes a point with respect to the box whose corners are passed in
466 * "corners". The normalized coordinates are stored in "*pX" and "*pY".
468 static void PATH_NormalizePoint(FLOAT_POINT corners
[],
469 const FLOAT_POINT
*pPoint
,
470 double *pX
, double *pY
)
472 *pX
= (pPoint
->x
-corners
[0].x
)/(corners
[1].x
-corners
[0].x
) * 2.0 - 1.0;
473 *pY
= (pPoint
->y
-corners
[0].y
)/(corners
[1].y
-corners
[0].y
) * 2.0 - 1.0;
478 * Creates a Bezier spline that corresponds to part of an arc and appends the
479 * corresponding points to the path. The start and end angles are passed in
480 * "angleStart" and "angleEnd"; these angles should span a quarter circle
481 * at most. If "startEntryType" is non-zero, an entry of that type for the first
482 * control point is added to the path; otherwise, it is assumed that the current
483 * position is equal to the first control point.
485 static BOOL
PATH_DoArcPart(struct gdi_path
*pPath
, FLOAT_POINT corners
[],
486 double angleStart
, double angleEnd
, BYTE startEntryType
)
489 double xNorm
[4], yNorm
[4];
494 assert(fabs(angleEnd
-angleStart
)<=M_PI_2
);
496 /* FIXME: Is there an easier way of computing this? */
498 /* Compute control points */
499 halfAngle
=(angleEnd
-angleStart
)/2.0;
500 if(fabs(halfAngle
)>1e-8)
502 a
=4.0/3.0*(1-cos(halfAngle
))/sin(halfAngle
);
503 xNorm
[0]=cos(angleStart
);
504 yNorm
[0]=sin(angleStart
);
505 xNorm
[1]=xNorm
[0] - a
*yNorm
[0];
506 yNorm
[1]=yNorm
[0] + a
*xNorm
[0];
507 xNorm
[3]=cos(angleEnd
);
508 yNorm
[3]=sin(angleEnd
);
509 xNorm
[2]=xNorm
[3] + a
*yNorm
[3];
510 yNorm
[2]=yNorm
[3] - a
*xNorm
[3];
515 xNorm
[i
]=cos(angleStart
);
516 yNorm
[i
]=sin(angleStart
);
519 /* Add starting point to path if desired */
520 start
= !startEntryType
;
521 for (i
= start
; i
< 4; i
++) PATH_ScaleNormalizedPoint(corners
, xNorm
[i
], yNorm
[i
], &points
[i
]);
522 if (!(type
= add_points( pPath
, points
+ start
, 4 - start
, PT_BEZIERTO
))) return FALSE
;
523 if (!start
) type
[0] = startEntryType
;
527 /* retrieve a flattened path in device coordinates, and optionally its region */
528 /* the DC path is deleted; the returned data must be freed by caller using free_gdi_path() */
529 /* helper for stroke_and_fill_path in the DIB driver */
530 struct gdi_path
*get_gdi_flat_path( DC
*dc
, HRGN
*rgn
)
532 struct gdi_path
*ret
= NULL
;
536 ret
= PATH_FlattenPath( dc
->path
);
538 free_gdi_path( dc
->path
);
540 if (ret
&& rgn
) *rgn
= path_to_region( ret
, dc
->polyFillMode
);
542 else SetLastError( ERROR_CAN_NOT_COMPLETE
);
547 int get_gdi_path_data( struct gdi_path
*path
, POINT
**pts
, BYTE
**flags
)
550 *flags
= path
->flags
;
554 /***********************************************************************
555 * BeginPath (GDI32.@)
557 BOOL WINAPI
BeginPath(HDC hdc
)
560 DC
*dc
= get_dc_ptr( hdc
);
564 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pBeginPath
);
565 ret
= physdev
->funcs
->pBeginPath( physdev
);
566 release_dc_ptr( dc
);
572 /***********************************************************************
575 BOOL WINAPI
EndPath(HDC hdc
)
578 DC
*dc
= get_dc_ptr( hdc
);
582 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pEndPath
);
583 ret
= physdev
->funcs
->pEndPath( physdev
);
584 release_dc_ptr( dc
);
590 /******************************************************************************
591 * AbortPath [GDI32.@]
592 * Closes and discards paths from device context
595 * Check that SetLastError is being called correctly
598 * hdc [I] Handle to device context
604 BOOL WINAPI
AbortPath( HDC hdc
)
607 DC
*dc
= get_dc_ptr( hdc
);
611 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pAbortPath
);
612 ret
= physdev
->funcs
->pAbortPath( physdev
);
613 release_dc_ptr( dc
);
619 /***********************************************************************
620 * CloseFigure (GDI32.@)
622 * FIXME: Check that SetLastError is being called correctly
624 BOOL WINAPI
CloseFigure(HDC hdc
)
627 DC
*dc
= get_dc_ptr( hdc
);
631 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pCloseFigure
);
632 ret
= physdev
->funcs
->pCloseFigure( physdev
);
633 release_dc_ptr( dc
);
639 /***********************************************************************
642 INT WINAPI
GetPath(HDC hdc
, LPPOINT pPoints
, LPBYTE pTypes
, INT nSize
)
645 DC
*dc
= get_dc_ptr( hdc
);
651 SetLastError(ERROR_CAN_NOT_COMPLETE
);
656 ret
= dc
->path
->count
;
657 else if(nSize
<dc
->path
->count
)
659 SetLastError(ERROR_INVALID_PARAMETER
);
664 memcpy(pPoints
, dc
->path
->points
, sizeof(POINT
)*dc
->path
->count
);
665 memcpy(pTypes
, dc
->path
->flags
, sizeof(BYTE
)*dc
->path
->count
);
667 /* Convert the points to logical coordinates */
668 if(!dp_to_lp(dc
, pPoints
, dc
->path
->count
))
670 /* FIXME: Is this the correct value? */
671 SetLastError(ERROR_CAN_NOT_COMPLETE
);
674 else ret
= dc
->path
->count
;
677 release_dc_ptr( dc
);
682 /***********************************************************************
683 * PathToRegion (GDI32.@)
685 HRGN WINAPI
PathToRegion(HDC hdc
)
688 DC
*dc
= get_dc_ptr( hdc
);
694 struct gdi_path
*path
= PATH_FlattenPath( dc
->path
);
696 free_gdi_path( dc
->path
);
700 ret
= path_to_region( path
, dc
->polyFillMode
);
701 free_gdi_path( path
);
704 else SetLastError( ERROR_CAN_NOT_COMPLETE
);
706 release_dc_ptr( dc
);
711 /***********************************************************************
715 * Check that SetLastError is being called correctly
717 BOOL WINAPI
FillPath(HDC hdc
)
720 DC
*dc
= get_dc_ptr( hdc
);
724 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pFillPath
);
725 ret
= physdev
->funcs
->pFillPath( physdev
);
726 release_dc_ptr( dc
);
732 /***********************************************************************
733 * SelectClipPath (GDI32.@)
735 BOOL WINAPI
SelectClipPath(HDC hdc
, INT iMode
)
738 DC
*dc
= get_dc_ptr( hdc
);
742 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pSelectClipPath
);
743 ret
= physdev
->funcs
->pSelectClipPath( physdev
, iMode
);
744 release_dc_ptr( dc
);
750 /***********************************************************************
753 static BOOL CDECL
pathdrv_BeginPath( PHYSDEV dev
)
755 /* path already open, nothing to do */
760 /***********************************************************************
763 static BOOL CDECL
pathdrv_AbortPath( PHYSDEV dev
)
765 DC
*dc
= get_physdev_dc( dev
);
767 path_driver
.pDeleteDC( pop_dc_driver( dc
, &path_driver
));
772 /***********************************************************************
775 static BOOL CDECL
pathdrv_EndPath( PHYSDEV dev
)
777 struct path_physdev
*physdev
= get_path_physdev( dev
);
778 DC
*dc
= get_physdev_dc( dev
);
780 dc
->path
= physdev
->path
;
781 pop_dc_driver( dc
, &path_driver
);
782 HeapFree( GetProcessHeap(), 0, physdev
);
787 /***********************************************************************
790 static BOOL CDECL
pathdrv_CreateDC( PHYSDEV
*dev
, LPCWSTR driver
, LPCWSTR device
,
791 LPCWSTR output
, const DEVMODEW
*devmode
)
793 struct path_physdev
*physdev
= HeapAlloc( GetProcessHeap(), 0, sizeof(*physdev
) );
795 if (!physdev
) return FALSE
;
796 push_dc_driver( dev
, &physdev
->dev
, &path_driver
);
801 /*************************************************************
804 static BOOL CDECL
pathdrv_DeleteDC( PHYSDEV dev
)
806 struct path_physdev
*physdev
= get_path_physdev( dev
);
808 free_gdi_path( physdev
->path
);
809 HeapFree( GetProcessHeap(), 0, physdev
);
814 BOOL
PATH_SavePath( DC
*dst
, DC
*src
)
820 if (!(dst
->path
= copy_gdi_path( src
->path
))) return FALSE
;
822 else if ((dev
= find_dc_driver( src
, &path_driver
)))
824 struct path_physdev
*physdev
= get_path_physdev( dev
);
825 if (!(dst
->path
= copy_gdi_path( physdev
->path
))) return FALSE
;
826 dst
->path_open
= TRUE
;
828 else dst
->path
= NULL
;
832 BOOL
PATH_RestorePath( DC
*dst
, DC
*src
)
835 struct path_physdev
*physdev
;
837 if ((dev
= pop_dc_driver( dst
, &path_driver
)))
839 physdev
= get_path_physdev( dev
);
840 free_gdi_path( physdev
->path
);
841 HeapFree( GetProcessHeap(), 0, physdev
);
844 if (src
->path
&& src
->path_open
)
846 if (!path_driver
.pCreateDC( &dst
->physDev
, NULL
, NULL
, NULL
, NULL
)) return FALSE
;
847 physdev
= get_path_physdev( find_dc_driver( dst
, &path_driver
));
848 physdev
->path
= src
->path
;
849 src
->path_open
= FALSE
;
853 if (dst
->path
) free_gdi_path( dst
->path
);
854 dst
->path
= src
->path
;
860 /*************************************************************
863 static BOOL CDECL
pathdrv_MoveTo( PHYSDEV dev
, INT x
, INT y
)
865 struct path_physdev
*physdev
= get_path_physdev( dev
);
866 DC
*dc
= get_physdev_dc( dev
);
868 physdev
->path
->newStroke
= TRUE
;
869 physdev
->path
->pos
.x
= x
;
870 physdev
->path
->pos
.y
= y
;
871 lp_to_dp( dc
, &physdev
->path
->pos
, 1 );
876 /*************************************************************
879 static BOOL CDECL
pathdrv_LineTo( PHYSDEV dev
, INT x
, INT y
)
881 struct path_physdev
*physdev
= get_path_physdev( dev
);
882 DC
*dc
= get_physdev_dc( dev
);
887 return add_log_points_new_stroke( dc
, physdev
->path
, &point
, 1, PT_LINETO
);
891 /*************************************************************
894 static BOOL CDECL
pathdrv_Rectangle( PHYSDEV dev
, INT x1
, INT y1
, INT x2
, INT y2
)
896 struct path_physdev
*physdev
= get_path_physdev( dev
);
897 DC
*dc
= get_physdev_dc( dev
);
898 POINT corners
[2], points
[4];
901 if (!PATH_CheckCorners( dc
, corners
, x1
, y1
, x2
, y2
)) return TRUE
;
903 points
[0].x
= corners
[1].x
;
904 points
[0].y
= corners
[0].y
;
905 points
[1] = corners
[0];
906 points
[2].x
= corners
[0].x
;
907 points
[2].y
= corners
[1].y
;
908 points
[3] = corners
[1];
909 if (dc
->ArcDirection
== AD_CLOCKWISE
) reverse_points( points
, 4 );
911 if (!(type
= add_points( physdev
->path
, points
, 4, PT_LINETO
))) return FALSE
;
913 close_figure( physdev
->path
);
918 /*************************************************************
921 static BOOL CDECL
pathdrv_RoundRect( PHYSDEV dev
, INT x1
, INT y1
, INT x2
, INT y2
, INT ell_width
, INT ell_height
)
923 const double factor
= 0.55428475; /* 4 / 3 * (sqrt(2) - 1) */
924 struct path_physdev
*physdev
= get_path_physdev( dev
);
925 DC
*dc
= get_physdev_dc( dev
);
926 POINT corners
[2], ellipse
[2], points
[16];
928 double width
, height
;
930 if (!ell_width
|| !ell_height
) return pathdrv_Rectangle( dev
, x1
, y1
, x2
, y2
);
932 if (!PATH_CheckCorners( dc
, corners
, x1
, y1
, x2
, y2
)) return TRUE
;
934 ellipse
[0].x
= ellipse
[0].y
= 0;
935 ellipse
[1].x
= ell_width
;
936 ellipse
[1].y
= ell_height
;
937 lp_to_dp( dc
, (POINT
*)&ellipse
, 2 );
938 ell_width
= min( abs( ellipse
[1].x
- ellipse
[0].x
), corners
[1].x
- corners
[0].x
);
939 ell_height
= min( abs( ellipse
[1].y
- ellipse
[0].y
), corners
[1].y
- corners
[0].y
);
940 width
= ell_width
/ 2.0;
941 height
= ell_height
/ 2.0;
944 points
[0].x
= corners
[1].x
;
945 points
[0].y
= corners
[0].y
+ GDI_ROUND( height
);
947 points
[1].x
= corners
[1].x
;
948 points
[1].y
= corners
[0].y
+ GDI_ROUND( height
* (1 - factor
) );
949 points
[2].x
= corners
[1].x
- GDI_ROUND( width
* (1 - factor
) );
950 points
[2].y
= corners
[0].y
;
951 points
[3].x
= corners
[1].x
- GDI_ROUND( width
);
952 points
[3].y
= corners
[0].y
;
953 /* horizontal line */
954 points
[4].x
= corners
[0].x
+ GDI_ROUND( width
);
955 points
[4].y
= corners
[0].y
;
957 points
[5].x
= corners
[0].x
+ GDI_ROUND( width
* (1 - factor
) );
958 points
[5].y
= corners
[0].y
;
959 points
[6].x
= corners
[0].x
;
960 points
[6].y
= corners
[0].y
+ GDI_ROUND( height
* (1 - factor
) );
961 points
[7].x
= corners
[0].x
;
962 points
[7].y
= corners
[0].y
+ GDI_ROUND( height
);
964 points
[8].x
= corners
[0].x
;
965 points
[8].y
= corners
[1].y
- GDI_ROUND( height
);
967 points
[9].x
= corners
[0].x
;
968 points
[9].y
= corners
[1].y
- GDI_ROUND( height
* (1 - factor
) );
969 points
[10].x
= corners
[0].x
+ GDI_ROUND( width
* (1 - factor
) );
970 points
[10].y
= corners
[1].y
;
971 points
[11].x
= corners
[0].x
+ GDI_ROUND( width
);
972 points
[11].y
= corners
[1].y
;
973 /* horizontal line */
974 points
[12].x
= corners
[1].x
- GDI_ROUND( width
);
975 points
[12].y
= corners
[1].y
;
977 points
[13].x
= corners
[1].x
- GDI_ROUND( width
* (1 - factor
) );
978 points
[13].y
= corners
[1].y
;
979 points
[14].x
= corners
[1].x
;
980 points
[14].y
= corners
[1].y
- GDI_ROUND( height
* (1 - factor
) );
981 points
[15].x
= corners
[1].x
;
982 points
[15].y
= corners
[1].y
- GDI_ROUND( height
);
984 if (dc
->ArcDirection
== AD_CLOCKWISE
) reverse_points( points
, 16 );
985 if (!(type
= add_points( physdev
->path
, points
, 16, PT_BEZIERTO
))) return FALSE
;
987 type
[4] = type
[8] = type
[12] = PT_LINETO
;
988 close_figure( physdev
->path
);
993 /*************************************************************
996 static BOOL CDECL
pathdrv_Ellipse( PHYSDEV dev
, INT x1
, INT y1
, INT x2
, INT y2
)
998 const double factor
= 0.55428475; /* 4 / 3 * (sqrt(2) - 1) */
999 struct path_physdev
*physdev
= get_path_physdev( dev
);
1000 DC
*dc
= get_physdev_dc( dev
);
1001 POINT corners
[2], points
[13];
1003 double width
, height
;
1005 if (!PATH_CheckCorners( dc
, corners
, x1
, y1
, x2
, y2
)) return TRUE
;
1007 width
= (corners
[1].x
- corners
[0].x
) / 2.0;
1008 height
= (corners
[1].y
- corners
[0].y
) / 2.0;
1010 /* starting point */
1011 points
[0].x
= corners
[1].x
;
1012 points
[0].y
= corners
[0].y
+ GDI_ROUND( height
);
1014 points
[1].x
= corners
[1].x
;
1015 points
[1].y
= corners
[0].y
+ GDI_ROUND( height
* (1 - factor
) );
1016 points
[2].x
= corners
[1].x
- GDI_ROUND( width
* (1 - factor
) );
1017 points
[2].y
= corners
[0].y
;
1018 points
[3].x
= corners
[0].x
+ GDI_ROUND( width
);
1019 points
[3].y
= corners
[0].y
;
1021 points
[4].x
= corners
[0].x
+ GDI_ROUND( width
* (1 - factor
) );
1022 points
[4].y
= corners
[0].y
;
1023 points
[5].x
= corners
[0].x
;
1024 points
[5].y
= corners
[0].y
+ GDI_ROUND( height
* (1 - factor
) );
1025 points
[6].x
= corners
[0].x
;
1026 points
[6].y
= corners
[0].y
+ GDI_ROUND( height
);
1028 points
[7].x
= corners
[0].x
;
1029 points
[7].y
= corners
[1].y
- GDI_ROUND( height
* (1 - factor
) );
1030 points
[8].x
= corners
[0].x
+ GDI_ROUND( width
* (1 - factor
) );
1031 points
[8].y
= corners
[1].y
;
1032 points
[9].x
= corners
[0].x
+ GDI_ROUND( width
);
1033 points
[9].y
= corners
[1].y
;
1035 points
[10].x
= corners
[1].x
- GDI_ROUND( width
* (1 - factor
) );
1036 points
[10].y
= corners
[1].y
;
1037 points
[11].x
= corners
[1].x
;
1038 points
[11].y
= corners
[1].y
- GDI_ROUND( height
* (1 - factor
) );
1039 points
[12].x
= corners
[1].x
;
1040 points
[12].y
= corners
[1].y
- GDI_ROUND( height
);
1042 if (dc
->ArcDirection
== AD_CLOCKWISE
) reverse_points( points
, 13 );
1043 if (!(type
= add_points( physdev
->path
, points
, 13, PT_BEZIERTO
))) return FALSE
;
1044 type
[0] = PT_MOVETO
;
1045 close_figure( physdev
->path
);
1052 * Should be called when a call to Arc is performed on a DC that has
1053 * an open path. This adds up to five Bezier splines representing the arc
1054 * to the path. When 'lines' is 1, we add 1 extra line to get a chord,
1055 * when 'lines' is 2, we add 2 extra lines to get a pie, and when 'lines' is
1056 * -1 we add 1 extra line from the current DC position to the starting position
1057 * of the arc before drawing the arc itself (arcto). Returns TRUE if successful,
1060 static BOOL
PATH_Arc( PHYSDEV dev
, INT x1
, INT y1
, INT x2
, INT y2
,
1061 INT xStart
, INT yStart
, INT xEnd
, INT yEnd
, int direction
, int lines
)
1063 DC
*dc
= get_physdev_dc( dev
);
1064 struct path_physdev
*physdev
= get_path_physdev( dev
);
1065 double angleStart
, angleEnd
, angleStartQuadrant
, angleEndQuadrant
=0.0;
1066 /* Initialize angleEndQuadrant to silence gcc's warning */
1068 FLOAT_POINT corners
[2], pointStart
, pointEnd
;
1073 /* FIXME: Do we have to respect newStroke? */
1075 /* Check for zero height / width */
1076 /* FIXME: Only in GM_COMPATIBLE? */
1077 if(x1
==x2
|| y1
==y2
)
1080 /* Convert points to device coordinates */
1085 pointStart
.x
= xStart
;
1086 pointStart
.y
= yStart
;
1089 INTERNAL_LPTODP_FLOAT(dc
, corners
, 2);
1090 INTERNAL_LPTODP_FLOAT(dc
, &pointStart
, 1);
1091 INTERNAL_LPTODP_FLOAT(dc
, &pointEnd
, 1);
1093 /* Make sure first corner is top left and second corner is bottom right */
1094 if(corners
[0].x
>corners
[1].x
)
1097 corners
[0].x
=corners
[1].x
;
1100 if(corners
[0].y
>corners
[1].y
)
1103 corners
[0].y
=corners
[1].y
;
1107 /* Compute start and end angle */
1108 PATH_NormalizePoint(corners
, &pointStart
, &x
, &y
);
1109 angleStart
=atan2(y
, x
);
1110 PATH_NormalizePoint(corners
, &pointEnd
, &x
, &y
);
1111 angleEnd
=atan2(y
, x
);
1113 /* Make sure the end angle is "on the right side" of the start angle */
1114 if (direction
== AD_CLOCKWISE
)
1116 if(angleEnd
<=angleStart
)
1119 assert(angleEnd
>=angleStart
);
1124 if(angleEnd
>=angleStart
)
1127 assert(angleEnd
<=angleStart
);
1131 /* In GM_COMPATIBLE, don't include bottom and right edges */
1132 if (dc
->GraphicsMode
== GM_COMPATIBLE
)
1138 /* arcto: Add a PT_MOVETO only if this is the first entry in a stroke */
1139 if (lines
== -1 && !start_new_stroke( physdev
->path
)) return FALSE
;
1141 /* Add the arc to the path with one Bezier spline per quadrant that the
1147 /* Determine the start and end angles for this quadrant */
1150 angleStartQuadrant
=angleStart
;
1151 if (direction
== AD_CLOCKWISE
)
1152 angleEndQuadrant
=(floor(angleStart
/M_PI_2
)+1.0)*M_PI_2
;
1154 angleEndQuadrant
=(ceil(angleStart
/M_PI_2
)-1.0)*M_PI_2
;
1158 angleStartQuadrant
=angleEndQuadrant
;
1159 if (direction
== AD_CLOCKWISE
)
1160 angleEndQuadrant
+=M_PI_2
;
1162 angleEndQuadrant
-=M_PI_2
;
1165 /* Have we reached the last part of the arc? */
1166 if((direction
== AD_CLOCKWISE
&& angleEnd
<angleEndQuadrant
) ||
1167 (direction
== AD_COUNTERCLOCKWISE
&& angleEnd
>angleEndQuadrant
))
1169 /* Adjust the end angle for this quadrant */
1170 angleEndQuadrant
=angleEnd
;
1174 /* Add the Bezier spline to the path */
1175 PATH_DoArcPart(physdev
->path
, corners
, angleStartQuadrant
, angleEndQuadrant
,
1176 start
? (lines
==-1 ? PT_LINETO
: PT_MOVETO
) : 0);
1180 /* chord: close figure. pie: add line and close figure */
1184 update_current_pos( physdev
->path
);
1187 close_figure( physdev
->path
);
1190 centre
.x
= (corners
[0].x
+corners
[1].x
)/2;
1191 centre
.y
= (corners
[0].y
+corners
[1].y
)/2;
1192 if(!PATH_AddEntry(physdev
->path
, ¢re
, PT_LINETO
| PT_CLOSEFIGURE
))
1200 /*************************************************************
1203 static BOOL CDECL
pathdrv_AngleArc( PHYSDEV dev
, INT x
, INT y
, DWORD radius
, FLOAT eStartAngle
, FLOAT eSweepAngle
)
1205 int x1
= GDI_ROUND( x
+ cos(eStartAngle
*M_PI
/180) * radius
);
1206 int y1
= GDI_ROUND( y
- sin(eStartAngle
*M_PI
/180) * radius
);
1207 int x2
= GDI_ROUND( x
+ cos((eStartAngle
+eSweepAngle
)*M_PI
/180) * radius
);
1208 int y2
= GDI_ROUND( y
- sin((eStartAngle
+eSweepAngle
)*M_PI
/180) * radius
);
1209 return PATH_Arc( dev
, x
-radius
, y
-radius
, x
+radius
, y
+radius
, x1
, y1
, x2
, y2
,
1210 eSweepAngle
>= 0 ? AD_COUNTERCLOCKWISE
: AD_CLOCKWISE
, -1 );
1214 /*************************************************************
1217 static BOOL CDECL
pathdrv_Arc( PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
,
1218 INT xstart
, INT ystart
, INT xend
, INT yend
)
1220 DC
*dc
= get_physdev_dc( dev
);
1221 return PATH_Arc( dev
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
,
1222 dc
->ArcDirection
, 0 );
1226 /*************************************************************
1229 static BOOL CDECL
pathdrv_ArcTo( PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
,
1230 INT xstart
, INT ystart
, INT xend
, INT yend
)
1232 DC
*dc
= get_physdev_dc( dev
);
1233 return PATH_Arc( dev
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
,
1234 dc
->ArcDirection
, -1 );
1238 /*************************************************************
1241 static BOOL CDECL
pathdrv_Chord( PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
,
1242 INT xstart
, INT ystart
, INT xend
, INT yend
)
1244 DC
*dc
= get_physdev_dc( dev
);
1245 return PATH_Arc( dev
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
,
1246 dc
->ArcDirection
, 1 );
1250 /*************************************************************
1253 static BOOL CDECL
pathdrv_Pie( PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
,
1254 INT xstart
, INT ystart
, INT xend
, INT yend
)
1256 DC
*dc
= get_physdev_dc( dev
);
1257 return PATH_Arc( dev
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
,
1258 dc
->ArcDirection
, 2 );
1262 /*************************************************************
1263 * pathdrv_PolyBezierTo
1265 static BOOL CDECL
pathdrv_PolyBezierTo( PHYSDEV dev
, const POINT
*pts
, DWORD cbPoints
)
1267 struct path_physdev
*physdev
= get_path_physdev( dev
);
1268 DC
*dc
= get_physdev_dc( dev
);
1270 return add_log_points_new_stroke( dc
, physdev
->path
, pts
, cbPoints
, PT_BEZIERTO
);
1274 /*************************************************************
1275 * pathdrv_PolyBezier
1277 static BOOL CDECL
pathdrv_PolyBezier( PHYSDEV dev
, const POINT
*pts
, DWORD cbPoints
)
1279 struct path_physdev
*physdev
= get_path_physdev( dev
);
1280 DC
*dc
= get_physdev_dc( dev
);
1281 BYTE
*type
= add_log_points( dc
, physdev
->path
, pts
, cbPoints
, PT_BEZIERTO
);
1283 if (!type
) return FALSE
;
1284 type
[0] = PT_MOVETO
;
1289 /*************************************************************
1292 static BOOL CDECL
pathdrv_PolyDraw( PHYSDEV dev
, const POINT
*pts
, const BYTE
*types
, DWORD cbPoints
)
1294 struct path_physdev
*physdev
= get_path_physdev( dev
);
1295 struct gdi_path
*path
= physdev
->path
;
1296 DC
*dc
= get_physdev_dc( dev
);
1298 INT i
, lastmove
= 0;
1300 for (i
= 0; i
< path
->count
; i
++) if (path
->flags
[i
] == PT_MOVETO
) lastmove
= i
;
1301 orig_pos
= path
->pos
;
1303 for(i
= 0; i
< cbPoints
; i
++)
1308 path
->newStroke
= TRUE
;
1310 lp_to_dp( dc
, &path
->pos
, 1 );
1311 lastmove
= path
->count
;
1314 case PT_LINETO
| PT_CLOSEFIGURE
:
1315 if (!add_log_points_new_stroke( dc
, path
, &pts
[i
], 1, PT_LINETO
)) return FALSE
;
1318 if ((i
+ 2 < cbPoints
) && (types
[i
+ 1] == PT_BEZIERTO
) &&
1319 (types
[i
+ 2] & ~PT_CLOSEFIGURE
) == PT_BEZIERTO
)
1321 if (!add_log_points_new_stroke( dc
, path
, &pts
[i
], 3, PT_BEZIERTO
)) return FALSE
;
1327 /* restore original position */
1328 path
->pos
= orig_pos
;
1332 if (types
[i
] & PT_CLOSEFIGURE
)
1334 close_figure( path
);
1335 path
->pos
= path
->points
[lastmove
];
1342 /*************************************************************
1345 static BOOL CDECL
pathdrv_Polyline( PHYSDEV dev
, const POINT
*pts
, INT count
)
1347 struct path_physdev
*physdev
= get_path_physdev( dev
);
1348 DC
*dc
= get_physdev_dc( dev
);
1351 if (count
< 2) return FALSE
;
1352 if (!(type
= add_log_points( dc
, physdev
->path
, pts
, count
, PT_LINETO
))) return FALSE
;
1353 type
[0] = PT_MOVETO
;
1358 /*************************************************************
1359 * pathdrv_PolylineTo
1361 static BOOL CDECL
pathdrv_PolylineTo( PHYSDEV dev
, const POINT
*pts
, INT count
)
1363 struct path_physdev
*physdev
= get_path_physdev( dev
);
1364 DC
*dc
= get_physdev_dc( dev
);
1366 if (count
< 1) return FALSE
;
1367 return add_log_points_new_stroke( dc
, physdev
->path
, pts
, count
, PT_LINETO
);
1371 /*************************************************************
1374 static BOOL CDECL
pathdrv_Polygon( PHYSDEV dev
, const POINT
*pts
, INT count
)
1376 struct path_physdev
*physdev
= get_path_physdev( dev
);
1377 DC
*dc
= get_physdev_dc( dev
);
1380 if (count
< 2) return FALSE
;
1381 if (!(type
= add_log_points( dc
, physdev
->path
, pts
, count
, PT_LINETO
))) return FALSE
;
1382 type
[0] = PT_MOVETO
;
1383 type
[count
- 1] = PT_LINETO
| PT_CLOSEFIGURE
;
1388 /*************************************************************
1389 * pathdrv_PolyPolygon
1391 static BOOL CDECL
pathdrv_PolyPolygon( PHYSDEV dev
, const POINT
* pts
, const INT
* counts
, UINT polygons
)
1393 struct path_physdev
*physdev
= get_path_physdev( dev
);
1394 DC
*dc
= get_physdev_dc( dev
);
1398 if (!polygons
) return FALSE
;
1399 for (poly
= count
= 0; poly
< polygons
; poly
++)
1401 if (counts
[poly
] < 2) return FALSE
;
1402 count
+= counts
[poly
];
1405 type
= add_log_points( dc
, physdev
->path
, pts
, count
, PT_LINETO
);
1406 if (!type
) return FALSE
;
1408 /* make the first point of each polyline a PT_MOVETO, and close the last one */
1409 for (poly
= 0; poly
< polygons
; type
+= counts
[poly
++])
1411 type
[0] = PT_MOVETO
;
1412 type
[counts
[poly
] - 1] = PT_LINETO
| PT_CLOSEFIGURE
;
1418 /*************************************************************
1419 * pathdrv_PolyPolyline
1421 static BOOL CDECL
pathdrv_PolyPolyline( PHYSDEV dev
, const POINT
* pts
, const DWORD
* counts
, DWORD polylines
)
1423 struct path_physdev
*physdev
= get_path_physdev( dev
);
1424 DC
*dc
= get_physdev_dc( dev
);
1428 if (!polylines
) return FALSE
;
1429 for (poly
= count
= 0; poly
< polylines
; poly
++)
1431 if (counts
[poly
] < 2) return FALSE
;
1432 count
+= counts
[poly
];
1435 type
= add_log_points( dc
, physdev
->path
, pts
, count
, PT_LINETO
);
1436 if (!type
) return FALSE
;
1438 /* make the first point of each polyline a PT_MOVETO */
1439 for (poly
= 0; poly
< polylines
; type
+= counts
[poly
++]) *type
= PT_MOVETO
;
1444 /**********************************************************************
1447 * internally used by PATH_add_outline
1449 static void PATH_BezierTo(struct gdi_path
*pPath
, POINT
*lppt
, INT n
)
1455 PATH_AddEntry(pPath
, &lppt
[1], PT_LINETO
);
1459 add_points( pPath
, lppt
, 3, PT_BEZIERTO
);
1473 pt
[2].x
= (lppt
[i
+2].x
+ lppt
[i
+1].x
) / 2;
1474 pt
[2].y
= (lppt
[i
+2].y
+ lppt
[i
+1].y
) / 2;
1475 add_points( pPath
, pt
, 3, PT_BEZIERTO
);
1483 add_points( pPath
, pt
, 3, PT_BEZIERTO
);
1487 static BOOL
PATH_add_outline(struct path_physdev
*physdev
, INT x
, INT y
,
1488 TTPOLYGONHEADER
*header
, DWORD size
)
1490 TTPOLYGONHEADER
*start
;
1495 while ((char *)header
< (char *)start
+ size
)
1499 if (header
->dwType
!= TT_POLYGON_TYPE
)
1501 FIXME("Unknown header type %d\n", header
->dwType
);
1505 pt
.x
= x
+ int_from_fixed(header
->pfxStart
.x
);
1506 pt
.y
= y
- int_from_fixed(header
->pfxStart
.y
);
1507 PATH_AddEntry(physdev
->path
, &pt
, PT_MOVETO
);
1509 curve
= (TTPOLYCURVE
*)(header
+ 1);
1511 while ((char *)curve
< (char *)header
+ header
->cb
)
1513 /*TRACE("curve->wType %d\n", curve->wType);*/
1515 switch(curve
->wType
)
1521 for (i
= 0; i
< curve
->cpfx
; i
++)
1523 pt
.x
= x
+ int_from_fixed(curve
->apfx
[i
].x
);
1524 pt
.y
= y
- int_from_fixed(curve
->apfx
[i
].y
);
1525 PATH_AddEntry(physdev
->path
, &pt
, PT_LINETO
);
1530 case TT_PRIM_QSPLINE
:
1531 case TT_PRIM_CSPLINE
:
1535 POINT
*pts
= HeapAlloc(GetProcessHeap(), 0, (curve
->cpfx
+ 1) * sizeof(POINT
));
1537 if (!pts
) return FALSE
;
1539 ptfx
= *(POINTFX
*)((char *)curve
- sizeof(POINTFX
));
1541 pts
[0].x
= x
+ int_from_fixed(ptfx
.x
);
1542 pts
[0].y
= y
- int_from_fixed(ptfx
.y
);
1544 for(i
= 0; i
< curve
->cpfx
; i
++)
1546 pts
[i
+ 1].x
= x
+ int_from_fixed(curve
->apfx
[i
].x
);
1547 pts
[i
+ 1].y
= y
- int_from_fixed(curve
->apfx
[i
].y
);
1550 PATH_BezierTo(physdev
->path
, pts
, curve
->cpfx
+ 1);
1552 HeapFree(GetProcessHeap(), 0, pts
);
1557 FIXME("Unknown curve type %04x\n", curve
->wType
);
1561 curve
= (TTPOLYCURVE
*)&curve
->apfx
[curve
->cpfx
];
1564 header
= (TTPOLYGONHEADER
*)((char *)header
+ header
->cb
);
1567 close_figure( physdev
->path
);
1571 /*************************************************************
1572 * pathdrv_ExtTextOut
1574 static BOOL CDECL
pathdrv_ExtTextOut( PHYSDEV dev
, INT x
, INT y
, UINT flags
, const RECT
*lprc
,
1575 LPCWSTR str
, UINT count
, const INT
*dx
)
1577 struct path_physdev
*physdev
= get_path_physdev( dev
);
1578 unsigned int idx
, ggo_flags
= GGO_NATIVE
;
1579 POINT offset
= {0, 0};
1581 if (!count
) return TRUE
;
1582 if (flags
& ETO_GLYPH_INDEX
) ggo_flags
|= GGO_GLYPH_INDEX
;
1584 for (idx
= 0; idx
< count
; idx
++)
1586 static const MAT2 identity
= { {0,1},{0,0},{0,0},{0,1} };
1591 dwSize
= GetGlyphOutlineW(dev
->hdc
, str
[idx
], ggo_flags
, &gm
, 0, NULL
, &identity
);
1592 if (dwSize
== GDI_ERROR
) continue;
1594 /* add outline only if char is printable */
1597 outline
= HeapAlloc(GetProcessHeap(), 0, dwSize
);
1598 if (!outline
) return FALSE
;
1600 GetGlyphOutlineW(dev
->hdc
, str
[idx
], ggo_flags
, &gm
, dwSize
, outline
, &identity
);
1601 PATH_add_outline(physdev
, x
+ offset
.x
, y
+ offset
.y
, outline
, dwSize
);
1603 HeapFree(GetProcessHeap(), 0, outline
);
1610 offset
.x
+= dx
[idx
* 2];
1611 offset
.y
+= dx
[idx
* 2 + 1];
1614 offset
.x
+= dx
[idx
];
1618 offset
.x
+= gm
.gmCellIncX
;
1619 offset
.y
+= gm
.gmCellIncY
;
1626 /*************************************************************
1627 * pathdrv_CloseFigure
1629 static BOOL CDECL
pathdrv_CloseFigure( PHYSDEV dev
)
1631 struct path_physdev
*physdev
= get_path_physdev( dev
);
1633 /* Set PT_CLOSEFIGURE on the last entry and start a new stroke */
1634 /* It is not necessary to draw a line, PT_CLOSEFIGURE is a virtual closing line itself */
1635 if (physdev
->path
->count
) close_figure( physdev
->path
);
1640 /*******************************************************************
1641 * FlattenPath [GDI32.@]
1645 BOOL WINAPI
FlattenPath(HDC hdc
)
1648 DC
*dc
= get_dc_ptr( hdc
);
1652 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pFlattenPath
);
1653 ret
= physdev
->funcs
->pFlattenPath( physdev
);
1654 release_dc_ptr( dc
);
1660 #define round(x) ((int)((x)>0?(x)+0.5:(x)-0.5))
1662 static struct gdi_path
*PATH_WidenPath(DC
*dc
)
1664 INT i
, j
, numStrokes
, penWidth
, penWidthIn
, penWidthOut
, size
, penStyle
;
1665 struct gdi_path
*flat_path
, *pNewPath
, **pStrokes
= NULL
, *pUpPath
, *pDownPath
;
1668 DWORD obj_type
, joint
, endcap
, penType
;
1670 size
= GetObjectW( dc
->hPen
, 0, NULL
);
1672 SetLastError(ERROR_CAN_NOT_COMPLETE
);
1676 elp
= HeapAlloc( GetProcessHeap(), 0, size
);
1677 GetObjectW( dc
->hPen
, size
, elp
);
1679 obj_type
= GetObjectType(dc
->hPen
);
1680 if(obj_type
== OBJ_PEN
) {
1681 penStyle
= ((LOGPEN
*)elp
)->lopnStyle
;
1683 else if(obj_type
== OBJ_EXTPEN
) {
1684 penStyle
= elp
->elpPenStyle
;
1687 SetLastError(ERROR_CAN_NOT_COMPLETE
);
1688 HeapFree( GetProcessHeap(), 0, elp
);
1692 penWidth
= elp
->elpWidth
;
1693 HeapFree( GetProcessHeap(), 0, elp
);
1695 endcap
= (PS_ENDCAP_MASK
& penStyle
);
1696 joint
= (PS_JOIN_MASK
& penStyle
);
1697 penType
= (PS_TYPE_MASK
& penStyle
);
1699 /* The function cannot apply to cosmetic pens */
1700 if(obj_type
== OBJ_EXTPEN
&& penType
== PS_COSMETIC
) {
1701 SetLastError(ERROR_CAN_NOT_COMPLETE
);
1705 if (!(flat_path
= PATH_FlattenPath( dc
->path
))) return NULL
;
1707 penWidthIn
= penWidth
/ 2;
1708 penWidthOut
= penWidth
/ 2;
1709 if(penWidthIn
+ penWidthOut
< penWidth
)
1714 for(i
= 0, j
= 0; i
< flat_path
->count
; i
++, j
++) {
1716 if((i
== 0 || (flat_path
->flags
[i
-1] & PT_CLOSEFIGURE
)) &&
1717 (flat_path
->flags
[i
] != PT_MOVETO
)) {
1718 ERR("Expected PT_MOVETO %s, got path flag %c\n",
1719 i
== 0 ? "as first point" : "after PT_CLOSEFIGURE",
1720 flat_path
->flags
[i
]);
1721 free_gdi_path( flat_path
);
1724 switch(flat_path
->flags
[i
]) {
1729 pStrokes
= HeapAlloc(GetProcessHeap(), 0, sizeof(*pStrokes
));
1731 pStrokes
= HeapReAlloc(GetProcessHeap(), 0, pStrokes
, numStrokes
* sizeof(*pStrokes
));
1734 free_gdi_path(flat_path
);
1737 pStrokes
[numStrokes
- 1] = alloc_gdi_path(0);
1740 case (PT_LINETO
| PT_CLOSEFIGURE
):
1741 point
.x
= flat_path
->points
[i
].x
;
1742 point
.y
= flat_path
->points
[i
].y
;
1743 PATH_AddEntry(pStrokes
[numStrokes
- 1], &point
, flat_path
->flags
[i
]);
1746 /* should never happen because of the FlattenPath call */
1747 ERR("Should never happen\n");
1750 ERR("Got path flag %c\n", flat_path
->flags
[i
]);
1751 for(i
= 0; i
< numStrokes
; i
++) free_gdi_path(pStrokes
[i
]);
1752 HeapFree(GetProcessHeap(), 0, pStrokes
);
1753 free_gdi_path(flat_path
);
1758 pNewPath
= alloc_gdi_path( flat_path
->count
);
1760 for(i
= 0; i
< numStrokes
; i
++) {
1761 pUpPath
= alloc_gdi_path( pStrokes
[i
]->count
);
1762 pDownPath
= alloc_gdi_path( pStrokes
[i
]->count
);
1764 for(j
= 0; j
< pStrokes
[i
]->count
; j
++) {
1765 /* Beginning or end of the path if not closed */
1766 if((!(pStrokes
[i
]->flags
[pStrokes
[i
]->count
- 1] & PT_CLOSEFIGURE
)) && (j
== 0 || j
== pStrokes
[i
]->count
- 1) ) {
1767 /* Compute segment angle */
1768 double xo
, yo
, xa
, ya
, theta
;
1770 FLOAT_POINT corners
[2];
1772 xo
= pStrokes
[i
]->points
[j
].x
;
1773 yo
= pStrokes
[i
]->points
[j
].y
;
1774 xa
= pStrokes
[i
]->points
[1].x
;
1775 ya
= pStrokes
[i
]->points
[1].y
;
1778 xa
= pStrokes
[i
]->points
[j
- 1].x
;
1779 ya
= pStrokes
[i
]->points
[j
- 1].y
;
1780 xo
= pStrokes
[i
]->points
[j
].x
;
1781 yo
= pStrokes
[i
]->points
[j
].y
;
1783 theta
= atan2( ya
- yo
, xa
- xo
);
1785 case PS_ENDCAP_SQUARE
:
1786 pt
.x
= xo
+ round(sqrt(2) * penWidthOut
* cos(M_PI_4
+ theta
));
1787 pt
.y
= yo
+ round(sqrt(2) * penWidthOut
* sin(M_PI_4
+ theta
));
1788 PATH_AddEntry(pUpPath
, &pt
, (j
== 0 ? PT_MOVETO
: PT_LINETO
) );
1789 pt
.x
= xo
+ round(sqrt(2) * penWidthIn
* cos(- M_PI_4
+ theta
));
1790 pt
.y
= yo
+ round(sqrt(2) * penWidthIn
* sin(- M_PI_4
+ theta
));
1791 PATH_AddEntry(pUpPath
, &pt
, PT_LINETO
);
1793 case PS_ENDCAP_FLAT
:
1794 pt
.x
= xo
+ round( penWidthOut
* cos(theta
+ M_PI_2
) );
1795 pt
.y
= yo
+ round( penWidthOut
* sin(theta
+ M_PI_2
) );
1796 PATH_AddEntry(pUpPath
, &pt
, (j
== 0 ? PT_MOVETO
: PT_LINETO
));
1797 pt
.x
= xo
- round( penWidthIn
* cos(theta
+ M_PI_2
) );
1798 pt
.y
= yo
- round( penWidthIn
* sin(theta
+ M_PI_2
) );
1799 PATH_AddEntry(pUpPath
, &pt
, PT_LINETO
);
1801 case PS_ENDCAP_ROUND
:
1803 corners
[0].x
= xo
- penWidthIn
;
1804 corners
[0].y
= yo
- penWidthIn
;
1805 corners
[1].x
= xo
+ penWidthOut
;
1806 corners
[1].y
= yo
+ penWidthOut
;
1807 PATH_DoArcPart(pUpPath
,corners
, theta
+ M_PI_2
, theta
+ 3 * M_PI_4
, (j
== 0 ? PT_MOVETO
: 0));
1808 PATH_DoArcPart(pUpPath
,corners
, theta
+ 3 * M_PI_4
, theta
+ M_PI
, 0);
1809 PATH_DoArcPart(pUpPath
,corners
, theta
+ M_PI
, theta
+ 5 * M_PI_4
, 0);
1810 PATH_DoArcPart(pUpPath
,corners
, theta
+ 5 * M_PI_4
, theta
+ 3 * M_PI_2
, 0);
1814 /* Corpse of the path */
1818 double xa
, ya
, xb
, yb
, xo
, yo
;
1819 double alpha
, theta
, miterWidth
;
1820 DWORD _joint
= joint
;
1822 struct gdi_path
*pInsidePath
, *pOutsidePath
;
1823 if(j
> 0 && j
< pStrokes
[i
]->count
- 1) {
1828 previous
= pStrokes
[i
]->count
- 1;
1835 xo
= pStrokes
[i
]->points
[j
].x
;
1836 yo
= pStrokes
[i
]->points
[j
].y
;
1837 xa
= pStrokes
[i
]->points
[previous
].x
;
1838 ya
= pStrokes
[i
]->points
[previous
].y
;
1839 xb
= pStrokes
[i
]->points
[next
].x
;
1840 yb
= pStrokes
[i
]->points
[next
].y
;
1841 theta
= atan2( yo
- ya
, xo
- xa
);
1842 alpha
= atan2( yb
- yo
, xb
- xo
) - theta
;
1843 if (alpha
> 0) alpha
-= M_PI
;
1845 if(_joint
== PS_JOIN_MITER
&& dc
->miterLimit
< fabs(1 / sin(alpha
/2))) {
1846 _joint
= PS_JOIN_BEVEL
;
1849 pInsidePath
= pUpPath
;
1850 pOutsidePath
= pDownPath
;
1852 else if(alpha
< 0) {
1853 pInsidePath
= pDownPath
;
1854 pOutsidePath
= pUpPath
;
1859 /* Inside angle points */
1861 pt
.x
= xo
- round( penWidthIn
* cos(theta
+ M_PI_2
) );
1862 pt
.y
= yo
- round( penWidthIn
* sin(theta
+ M_PI_2
) );
1865 pt
.x
= xo
+ round( penWidthIn
* cos(theta
+ M_PI_2
) );
1866 pt
.y
= yo
+ round( penWidthIn
* sin(theta
+ M_PI_2
) );
1868 PATH_AddEntry(pInsidePath
, &pt
, PT_LINETO
);
1870 pt
.x
= xo
+ round( penWidthIn
* cos(M_PI_2
+ alpha
+ theta
) );
1871 pt
.y
= yo
+ round( penWidthIn
* sin(M_PI_2
+ alpha
+ theta
) );
1874 pt
.x
= xo
- round( penWidthIn
* cos(M_PI_2
+ alpha
+ theta
) );
1875 pt
.y
= yo
- round( penWidthIn
* sin(M_PI_2
+ alpha
+ theta
) );
1877 PATH_AddEntry(pInsidePath
, &pt
, PT_LINETO
);
1878 /* Outside angle point */
1880 case PS_JOIN_MITER
:
1881 miterWidth
= fabs(penWidthOut
/ cos(M_PI_2
- fabs(alpha
) / 2));
1882 pt
.x
= xo
+ round( miterWidth
* cos(theta
+ alpha
/ 2) );
1883 pt
.y
= yo
+ round( miterWidth
* sin(theta
+ alpha
/ 2) );
1884 PATH_AddEntry(pOutsidePath
, &pt
, PT_LINETO
);
1886 case PS_JOIN_BEVEL
:
1888 pt
.x
= xo
+ round( penWidthOut
* cos(theta
+ M_PI_2
) );
1889 pt
.y
= yo
+ round( penWidthOut
* sin(theta
+ M_PI_2
) );
1892 pt
.x
= xo
- round( penWidthOut
* cos(theta
+ M_PI_2
) );
1893 pt
.y
= yo
- round( penWidthOut
* sin(theta
+ M_PI_2
) );
1895 PATH_AddEntry(pOutsidePath
, &pt
, PT_LINETO
);
1897 pt
.x
= xo
- round( penWidthOut
* cos(M_PI_2
+ alpha
+ theta
) );
1898 pt
.y
= yo
- round( penWidthOut
* sin(M_PI_2
+ alpha
+ theta
) );
1901 pt
.x
= xo
+ round( penWidthOut
* cos(M_PI_2
+ alpha
+ theta
) );
1902 pt
.y
= yo
+ round( penWidthOut
* sin(M_PI_2
+ alpha
+ theta
) );
1904 PATH_AddEntry(pOutsidePath
, &pt
, PT_LINETO
);
1906 case PS_JOIN_ROUND
:
1909 pt
.x
= xo
+ round( penWidthOut
* cos(theta
+ M_PI_2
) );
1910 pt
.y
= yo
+ round( penWidthOut
* sin(theta
+ M_PI_2
) );
1913 pt
.x
= xo
- round( penWidthOut
* cos(theta
+ M_PI_2
) );
1914 pt
.y
= yo
- round( penWidthOut
* sin(theta
+ M_PI_2
) );
1916 PATH_AddEntry(pOutsidePath
, &pt
, PT_BEZIERTO
);
1917 pt
.x
= xo
+ round( penWidthOut
* cos(theta
+ alpha
/ 2) );
1918 pt
.y
= yo
+ round( penWidthOut
* sin(theta
+ alpha
/ 2) );
1919 PATH_AddEntry(pOutsidePath
, &pt
, PT_BEZIERTO
);
1921 pt
.x
= xo
- round( penWidthOut
* cos(M_PI_2
+ alpha
+ theta
) );
1922 pt
.y
= yo
- round( penWidthOut
* sin(M_PI_2
+ alpha
+ theta
) );
1925 pt
.x
= xo
+ round( penWidthOut
* cos(M_PI_2
+ alpha
+ theta
) );
1926 pt
.y
= yo
+ round( penWidthOut
* sin(M_PI_2
+ alpha
+ theta
) );
1928 PATH_AddEntry(pOutsidePath
, &pt
, PT_BEZIERTO
);
1933 type
= add_points( pNewPath
, pUpPath
->points
, pUpPath
->count
, PT_LINETO
);
1934 type
[0] = PT_MOVETO
;
1935 reverse_points( pDownPath
->points
, pDownPath
->count
);
1936 type
= add_points( pNewPath
, pDownPath
->points
, pDownPath
->count
, PT_LINETO
);
1937 if (pStrokes
[i
]->flags
[pStrokes
[i
]->count
- 1] & PT_CLOSEFIGURE
) type
[0] = PT_MOVETO
;
1939 free_gdi_path( pStrokes
[i
] );
1940 free_gdi_path( pUpPath
);
1941 free_gdi_path( pDownPath
);
1943 HeapFree(GetProcessHeap(), 0, pStrokes
);
1944 free_gdi_path( flat_path
);
1949 /*******************************************************************
1950 * StrokeAndFillPath [GDI32.@]
1954 BOOL WINAPI
StrokeAndFillPath(HDC hdc
)
1957 DC
*dc
= get_dc_ptr( hdc
);
1961 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pStrokeAndFillPath
);
1962 ret
= physdev
->funcs
->pStrokeAndFillPath( physdev
);
1963 release_dc_ptr( dc
);
1969 /*******************************************************************
1970 * StrokePath [GDI32.@]
1974 BOOL WINAPI
StrokePath(HDC hdc
)
1977 DC
*dc
= get_dc_ptr( hdc
);
1981 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pStrokePath
);
1982 ret
= physdev
->funcs
->pStrokePath( physdev
);
1983 release_dc_ptr( dc
);
1989 /*******************************************************************
1990 * WidenPath [GDI32.@]
1994 BOOL WINAPI
WidenPath(HDC hdc
)
1997 DC
*dc
= get_dc_ptr( hdc
);
2001 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pWidenPath
);
2002 ret
= physdev
->funcs
->pWidenPath( physdev
);
2003 release_dc_ptr( dc
);
2009 /***********************************************************************
2010 * null driver fallback implementations
2013 BOOL CDECL
nulldrv_BeginPath( PHYSDEV dev
)
2015 DC
*dc
= get_nulldrv_dc( dev
);
2016 struct path_physdev
*physdev
;
2017 struct gdi_path
*path
= alloc_gdi_path(0);
2019 if (!path
) return FALSE
;
2020 if (!path_driver
.pCreateDC( &dc
->physDev
, NULL
, NULL
, NULL
, NULL
))
2022 free_gdi_path( path
);
2025 physdev
= get_path_physdev( find_dc_driver( dc
, &path_driver
));
2026 physdev
->path
= path
;
2027 path
->pos
= dc
->attr
->cur_pos
;
2028 lp_to_dp( dc
, &path
->pos
, 1 );
2029 if (dc
->path
) free_gdi_path( dc
->path
);
2034 BOOL CDECL
nulldrv_EndPath( PHYSDEV dev
)
2036 SetLastError( ERROR_CAN_NOT_COMPLETE
);
2040 BOOL CDECL
nulldrv_AbortPath( PHYSDEV dev
)
2042 DC
*dc
= get_nulldrv_dc( dev
);
2044 if (dc
->path
) free_gdi_path( dc
->path
);
2049 BOOL CDECL
nulldrv_CloseFigure( PHYSDEV dev
)
2051 SetLastError( ERROR_CAN_NOT_COMPLETE
);
2055 BOOL CDECL
nulldrv_SelectClipPath( PHYSDEV dev
, INT mode
)
2058 HRGN hrgn
= PathToRegion( dev
->hdc
);
2062 ret
= ExtSelectClipRgn( dev
->hdc
, hrgn
, mode
) != ERROR
;
2063 DeleteObject( hrgn
);
2068 BOOL CDECL
nulldrv_FillPath( PHYSDEV dev
)
2070 if (GetPath( dev
->hdc
, NULL
, NULL
, 0 ) == -1) return FALSE
;
2071 AbortPath( dev
->hdc
);
2075 BOOL CDECL
nulldrv_StrokeAndFillPath( PHYSDEV dev
)
2077 if (GetPath( dev
->hdc
, NULL
, NULL
, 0 ) == -1) return FALSE
;
2078 AbortPath( dev
->hdc
);
2082 BOOL CDECL
nulldrv_StrokePath( PHYSDEV dev
)
2084 if (GetPath( dev
->hdc
, NULL
, NULL
, 0 ) == -1) return FALSE
;
2085 AbortPath( dev
->hdc
);
2089 BOOL CDECL
nulldrv_FlattenPath( PHYSDEV dev
)
2091 DC
*dc
= get_nulldrv_dc( dev
);
2092 struct gdi_path
*path
;
2096 SetLastError( ERROR_CAN_NOT_COMPLETE
);
2099 if (!(path
= PATH_FlattenPath( dc
->path
))) return FALSE
;
2100 free_gdi_path( dc
->path
);
2105 BOOL CDECL
nulldrv_WidenPath( PHYSDEV dev
)
2107 DC
*dc
= get_nulldrv_dc( dev
);
2108 struct gdi_path
*path
;
2112 SetLastError( ERROR_CAN_NOT_COMPLETE
);
2115 if (!(path
= PATH_WidenPath( dc
))) return FALSE
;
2116 free_gdi_path( dc
->path
);
2121 const struct gdi_dc_funcs path_driver
=
2123 NULL
, /* pAbortDoc */
2124 pathdrv_AbortPath
, /* pAbortPath */
2125 NULL
, /* pAlphaBlend */
2126 pathdrv_AngleArc
, /* pAngleArc */
2127 pathdrv_Arc
, /* pArc */
2128 pathdrv_ArcTo
, /* pArcTo */
2129 pathdrv_BeginPath
, /* pBeginPath */
2130 NULL
, /* pBlendImage */
2131 pathdrv_Chord
, /* pChord */
2132 pathdrv_CloseFigure
, /* pCloseFigure */
2133 NULL
, /* pCreateCompatibleDC */
2134 pathdrv_CreateDC
, /* pCreateDC */
2135 pathdrv_DeleteDC
, /* pDeleteDC */
2136 NULL
, /* pDeleteObject */
2137 NULL
, /* pDeviceCapabilities */
2138 pathdrv_Ellipse
, /* pEllipse */
2140 NULL
, /* pEndPage */
2141 pathdrv_EndPath
, /* pEndPath */
2142 NULL
, /* pEnumFonts */
2143 NULL
, /* pEnumICMProfiles */
2144 NULL
, /* pExcludeClipRect */
2145 NULL
, /* pExtDeviceMode */
2146 NULL
, /* pExtEscape */
2147 NULL
, /* pExtFloodFill */
2148 NULL
, /* pExtSelectClipRgn */
2149 pathdrv_ExtTextOut
, /* pExtTextOut */
2150 NULL
, /* pFillPath */
2151 NULL
, /* pFillRgn */
2152 NULL
, /* pFlattenPath */
2153 NULL
, /* pFontIsLinked */
2154 NULL
, /* pFrameRgn */
2155 NULL
, /* pGdiComment */
2156 NULL
, /* pGetBoundsRect */
2157 NULL
, /* pGetCharABCWidths */
2158 NULL
, /* pGetCharABCWidthsI */
2159 NULL
, /* pGetCharWidth */
2160 NULL
, /* pGetCharWidthInfo */
2161 NULL
, /* pGetDeviceCaps */
2162 NULL
, /* pGetDeviceGammaRamp */
2163 NULL
, /* pGetFontData */
2164 NULL
, /* pGetFontRealizationInfo */
2165 NULL
, /* pGetFontUnicodeRanges */
2166 NULL
, /* pGetGlyphIndices */
2167 NULL
, /* pGetGlyphOutline */
2168 NULL
, /* pGetICMProfile */
2169 NULL
, /* pGetImage */
2170 NULL
, /* pGetKerningPairs */
2171 NULL
, /* pGetNearestColor */
2172 NULL
, /* pGetOutlineTextMetrics */
2173 NULL
, /* pGetPixel */
2174 NULL
, /* pGetSystemPaletteEntries */
2175 NULL
, /* pGetTextCharsetInfo */
2176 NULL
, /* pGetTextExtentExPoint */
2177 NULL
, /* pGetTextExtentExPointI */
2178 NULL
, /* pGetTextFace */
2179 NULL
, /* pGetTextMetrics */
2180 NULL
, /* pGradientFill */
2181 NULL
, /* pIntersectClipRect */
2182 NULL
, /* pInvertRgn */
2183 pathdrv_LineTo
, /* pLineTo */
2184 NULL
, /* pModifyWorldTransform */
2185 pathdrv_MoveTo
, /* pMoveTo */
2186 NULL
, /* pOffsetClipRgn */
2187 NULL
, /* pOffsetViewportOrg */
2188 NULL
, /* pOffsetWindowOrg */
2189 NULL
, /* pPaintRgn */
2191 pathdrv_Pie
, /* pPie */
2192 pathdrv_PolyBezier
, /* pPolyBezier */
2193 pathdrv_PolyBezierTo
, /* pPolyBezierTo */
2194 pathdrv_PolyDraw
, /* pPolyDraw */
2195 pathdrv_PolyPolygon
, /* pPolyPolygon */
2196 pathdrv_PolyPolyline
, /* pPolyPolyline */
2197 pathdrv_Polygon
, /* pPolygon */
2198 pathdrv_Polyline
, /* pPolyline */
2199 pathdrv_PolylineTo
, /* pPolylineTo */
2200 NULL
, /* pPutImage */
2201 NULL
, /* pRealizeDefaultPalette */
2202 NULL
, /* pRealizePalette */
2203 pathdrv_Rectangle
, /* pRectangle */
2204 NULL
, /* pResetDC */
2205 NULL
, /* pRestoreDC */
2206 pathdrv_RoundRect
, /* pRoundRect */
2208 NULL
, /* pScaleViewportExt */
2209 NULL
, /* pScaleWindowExt */
2210 NULL
, /* pSelectBitmap */
2211 NULL
, /* pSelectBrush */
2212 NULL
, /* pSelectClipPath */
2213 NULL
, /* pSelectFont */
2214 NULL
, /* pSelectPalette */
2215 NULL
, /* pSelectPen */
2216 NULL
, /* pSetArcDirection */
2217 NULL
, /* pSetBkColor */
2218 NULL
, /* pSetBkMode */
2219 NULL
, /* pSetBoundsRect */
2220 NULL
, /* pSetDCBrushColor */
2221 NULL
, /* pSetDCPenColor */
2222 NULL
, /* pSetDIBitsToDevice */
2223 NULL
, /* pSetDeviceClipping */
2224 NULL
, /* pSetDeviceGammaRamp */
2225 NULL
, /* pSetLayout */
2226 NULL
, /* pSetMapMode */
2227 NULL
, /* pSetMapperFlags */
2228 NULL
, /* pSetPixel */
2229 NULL
, /* pSetPolyFillMode */
2230 NULL
, /* pSetROP2 */
2231 NULL
, /* pSetRelAbs */
2232 NULL
, /* pSetStretchBltMode */
2233 NULL
, /* pSetTextAlign */
2234 NULL
, /* pSetTextCharacterExtra */
2235 NULL
, /* pSetTextColor */
2236 NULL
, /* pSetTextJustification */
2237 NULL
, /* pSetViewportExt */
2238 NULL
, /* pSetViewportOrg */
2239 NULL
, /* pSetWindowExt */
2240 NULL
, /* pSetWindowOrg */
2241 NULL
, /* pSetWorldTransform */
2242 NULL
, /* pStartDoc */
2243 NULL
, /* pStartPage */
2244 NULL
, /* pStretchBlt */
2245 NULL
, /* pStretchDIBits */
2246 NULL
, /* pStrokeAndFillPath */
2247 NULL
, /* pStrokePath */
2248 NULL
, /* pUnrealizePalette */
2249 NULL
, /* pWidenPath */
2250 NULL
, /* pD3DKMTCheckVidPnExclusiveOwnership */
2251 NULL
, /* pD3DKMTSetVidPnSourceOwner */
2252 NULL
, /* wine_get_wgl_driver */
2253 NULL
, /* wine_get_vulkan_driver */
2254 GDI_PRIORITY_PATH_DRV
/* priority */