gdi32: Handle EMFs recording directly in LineTo implementation.
[wine.git] / dlls / gdi32 / gdidc.c
blobc011d66deb9caa6d47eb07998aee4b6bbf763adf
1 /*
2 * GDI Device Context functions
4 * Copyright 1993, 1994 Alexandre Julliard
5 * Copyright 1997 Bertho A. Stultiens
6 * 1999 Huw D M Davies
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "gdi_private.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
28 static DC_ATTR *get_dc_attr( HDC hdc )
30 WORD type = gdi_handle_type( hdc );
31 DC_ATTR *dc_attr;
32 if ((type & 0x1f) != NTGDI_OBJ_DC || !(dc_attr = get_gdi_client_ptr( hdc, 0 )))
34 SetLastError( ERROR_INVALID_HANDLE );
35 return NULL;
37 return dc_attr;
40 /***********************************************************************
41 * LineTo (GDI32.@)
43 BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
45 DC_ATTR *dc_attr;
47 TRACE( "%p, (%d, %d)\n", hdc, x, y );
49 if (is_meta_dc( hdc )) return METADC_LineTo( hdc, x, y );
50 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
51 if (dc_attr->emf && !EMFDC_LineTo( dc_attr, x, y )) return FALSE;
52 return NtGdiLineTo( hdc, x, y );
55 /***********************************************************************
56 * MoveToEx (GDI32.@)
58 BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, POINT *pt )
60 TRACE( "%p, (%d, %d), %p\n", hdc, x, y, pt );
62 if (is_meta_dc( hdc )) return METADC_MoveTo( hdc, x, y );
63 return NtGdiMoveTo( hdc, x, y, pt );
66 /***********************************************************************
67 * Arc (GDI32.@)
69 BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
70 INT xstart, INT ystart, INT xend, INT yend )
72 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
73 right, bottom, xstart, ystart, xend, yend );
75 if (is_meta_dc( hdc ))
76 return METADC_Arc( hdc, left, top, right, bottom,
77 xstart, ystart, xend, yend );
79 return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom,
80 xstart, ystart, xend, yend );
83 /***********************************************************************
84 * ArcTo (GDI32.@)
86 BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom,
87 INT xstart, INT ystart, INT xend, INT yend )
89 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
90 right, bottom, xstart, ystart, xend, yend );
92 return NtGdiArcInternal( NtGdiArcTo, hdc, left, top, right, bottom,
93 xstart, ystart, xend, yend );
96 /***********************************************************************
97 * Chord (GDI32.@)
99 BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom,
100 INT xstart, INT ystart, INT xend, INT yend )
102 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
103 right, bottom, xstart, ystart, xend, yend );
105 if (is_meta_dc( hdc ))
106 return METADC_Chord( hdc, left, top, right, bottom,
107 xstart, ystart, xend, yend );
109 return NtGdiArcInternal( NtGdiChord, hdc, left, top, right, bottom,
110 xstart, ystart, xend, yend );
113 /***********************************************************************
114 * Pie (GDI32.@)
116 BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
117 INT xstart, INT ystart, INT xend, INT yend )
119 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
120 right, bottom, xstart, ystart, xend, yend );
122 if (is_meta_dc( hdc ))
123 return METADC_Pie( hdc, left, top, right, bottom,
124 xstart, ystart, xend, yend );
126 return NtGdiArcInternal( NtGdiPie, hdc, left, top, right, bottom,
127 xstart, ystart, xend, yend );