wined3d: read_from_framebuffer_texture() isn't suitable for readback of onscreen...
[wine/testsucceed.git] / dlls / gdi32 / enhmfdrv / dc.c
blob7277f627cbe08caa60cb245bd10e37210e5d2b64
1 /*
2 * Enhanced MetaFile driver dc value functions
4 * Copyright 1999 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "enhmfdrv/enhmetafiledrv.h"
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
26 INT CDECL EMFDRV_SaveDC( PHYSDEV dev )
28 EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
29 INT ret = save_dc_state( physDev->hdc );
30 EMRSAVEDC emr;
32 if (ret)
34 emr.emr.iType = EMR_SAVEDC;
35 emr.emr.nSize = sizeof(emr);
36 EMFDRV_WriteRecord( dev, &emr.emr );
38 return ret;
41 BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level )
43 EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
44 DC *dc = get_dc_ptr( physDev->hdc );
45 EMRRESTOREDC emr;
46 BOOL ret;
48 emr.emr.iType = EMR_RESTOREDC;
49 emr.emr.nSize = sizeof(emr);
51 if (level < 0)
52 emr.iRelative = level;
53 else
54 emr.iRelative = level - dc->saveLevel - 1;
55 release_dc_ptr( dc );
57 physDev->restoring++;
58 ret = restore_dc_state( physDev->hdc, level );
59 physDev->restoring--;
61 if (ret) EMFDRV_WriteRecord( dev, &emr.emr );
62 return ret;
65 UINT CDECL EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
67 EMRSETTEXTALIGN emr;
68 emr.emr.iType = EMR_SETTEXTALIGN;
69 emr.emr.nSize = sizeof(emr);
70 emr.iMode = align;
71 return EMFDRV_WriteRecord( dev, &emr.emr );
74 BOOL CDECL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
76 EMRSETTEXTJUSTIFICATION emr;
77 emr.emr.iType = EMR_SETTEXTJUSTIFICATION;
78 emr.emr.nSize = sizeof(emr);
79 emr.nBreakExtra = nBreakExtra;
80 emr.nBreakCount = nBreakCount;
81 return EMFDRV_WriteRecord(dev, &emr.emr);
84 INT CDECL EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
86 EMRSETBKMODE emr;
87 emr.emr.iType = EMR_SETBKMODE;
88 emr.emr.nSize = sizeof(emr);
89 emr.iMode = mode;
90 return EMFDRV_WriteRecord( dev, &emr.emr );
93 INT CDECL EMFDRV_SetROP2( PHYSDEV dev, INT rop )
95 EMRSETROP2 emr;
96 emr.emr.iType = EMR_SETROP2;
97 emr.emr.nSize = sizeof(emr);
98 emr.iMode = rop;
99 return EMFDRV_WriteRecord( dev, &emr.emr );
102 INT CDECL EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
104 EMRSETPOLYFILLMODE emr;
105 emr.emr.iType = EMR_SETPOLYFILLMODE;
106 emr.emr.nSize = sizeof(emr);
107 emr.iMode = mode;
108 return EMFDRV_WriteRecord( dev, &emr.emr );
111 INT CDECL EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
113 EMRSETSTRETCHBLTMODE emr;
114 emr.emr.iType = EMR_SETSTRETCHBLTMODE;
115 emr.emr.nSize = sizeof(emr);
116 emr.iMode = mode;
117 return EMFDRV_WriteRecord( dev, &emr.emr );
120 INT CDECL EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
122 EMREXCLUDECLIPRECT emr;
123 emr.emr.iType = EMR_EXCLUDECLIPRECT;
124 emr.emr.nSize = sizeof(emr);
125 emr.rclClip.left = left;
126 emr.rclClip.top = top;
127 emr.rclClip.right = right;
128 emr.rclClip.bottom = bottom;
129 return EMFDRV_WriteRecord( dev, &emr.emr );
132 INT CDECL EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
134 EMRINTERSECTCLIPRECT emr;
135 emr.emr.iType = EMR_INTERSECTCLIPRECT;
136 emr.emr.nSize = sizeof(emr);
137 emr.rclClip.left = left;
138 emr.rclClip.top = top;
139 emr.rclClip.right = right;
140 emr.rclClip.bottom = bottom;
141 return EMFDRV_WriteRecord( dev, &emr.emr );
144 INT CDECL EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
146 EMROFFSETCLIPRGN emr;
147 emr.emr.iType = EMR_OFFSETCLIPRGN;
148 emr.emr.nSize = sizeof(emr);
149 emr.ptlOffset.x = x;
150 emr.ptlOffset.y = y;
151 return EMFDRV_WriteRecord( dev, &emr.emr );
154 INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
156 EMREXTSELECTCLIPRGN *emr;
157 DWORD size, rgnsize;
158 BOOL ret;
160 if (!hrgn)
162 if (mode != RGN_COPY) return ERROR;
163 rgnsize = 0;
165 else rgnsize = GetRegionData( hrgn, 0, NULL );
167 size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
168 emr = HeapAlloc( GetProcessHeap(), 0, size );
169 if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
171 emr->emr.iType = EMR_EXTSELECTCLIPRGN;
172 emr->emr.nSize = size;
173 emr->cbRgnData = rgnsize;
174 emr->iMode = mode;
176 ret = EMFDRV_WriteRecord( dev, &emr->emr );
177 HeapFree( GetProcessHeap(), 0, emr );
178 return ret ? SIMPLEREGION : ERROR;
181 DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
183 EMRSETMAPPERFLAGS emr;
185 emr.emr.iType = EMR_SETMAPPERFLAGS;
186 emr.emr.nSize = sizeof(emr);
187 emr.dwFlags = flags;
189 return EMFDRV_WriteRecord( dev, &emr.emr );
192 BOOL CDECL EMFDRV_AbortPath( PHYSDEV dev )
194 EMRABORTPATH emr;
196 emr.emr.iType = EMR_ABORTPATH;
197 emr.emr.nSize = sizeof(emr);
199 return EMFDRV_WriteRecord( dev, &emr.emr );
202 BOOL CDECL EMFDRV_BeginPath( PHYSDEV dev )
204 EMRBEGINPATH emr;
206 emr.emr.iType = EMR_BEGINPATH;
207 emr.emr.nSize = sizeof(emr);
209 return EMFDRV_WriteRecord( dev, &emr.emr );
212 BOOL CDECL EMFDRV_CloseFigure( PHYSDEV dev )
214 EMRCLOSEFIGURE emr;
216 emr.emr.iType = EMR_CLOSEFIGURE;
217 emr.emr.nSize = sizeof(emr);
219 return EMFDRV_WriteRecord( dev, &emr.emr );
222 BOOL CDECL EMFDRV_EndPath( PHYSDEV dev )
224 EMRENDPATH emr;
226 emr.emr.iType = EMR_ENDPATH;
227 emr.emr.nSize = sizeof(emr);
229 return EMFDRV_WriteRecord( dev, &emr.emr );
232 BOOL CDECL EMFDRV_FillPath( PHYSDEV dev )
234 EMRFILLPATH emr;
236 emr.emr.iType = EMR_FILLPATH;
237 emr.emr.nSize = sizeof(emr);
238 FIXME("Bounds\n");
239 emr.rclBounds.left = 0;
240 emr.rclBounds.top = 0;
241 emr.rclBounds.right = 0;
242 emr.rclBounds.bottom = 0;
243 return EMFDRV_WriteRecord( dev, &emr.emr );
246 BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev )
248 EMRFLATTENPATH emr;
250 emr.emr.iType = EMR_FLATTENPATH;
251 emr.emr.nSize = sizeof(emr);
253 return EMFDRV_WriteRecord( dev, &emr.emr );
256 BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
258 EMRSELECTCLIPPATH emr;
260 emr.emr.iType = EMR_SELECTCLIPPATH;
261 emr.emr.nSize = sizeof(emr);
262 emr.iMode = iMode;
264 return EMFDRV_WriteRecord( dev, &emr.emr );
267 BOOL CDECL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
269 EMRSTROKEANDFILLPATH emr;
271 emr.emr.iType = EMR_STROKEANDFILLPATH;
272 emr.emr.nSize = sizeof(emr);
273 FIXME("Bounds\n");
274 emr.rclBounds.left = 0;
275 emr.rclBounds.top = 0;
276 emr.rclBounds.right = 0;
277 emr.rclBounds.bottom = 0;
278 return EMFDRV_WriteRecord( dev, &emr.emr );
281 BOOL CDECL EMFDRV_StrokePath( PHYSDEV dev )
283 EMRSTROKEPATH emr;
285 emr.emr.iType = EMR_STROKEPATH;
286 emr.emr.nSize = sizeof(emr);
287 FIXME("Bounds\n");
288 emr.rclBounds.left = 0;
289 emr.rclBounds.top = 0;
290 emr.rclBounds.right = 0;
291 emr.rclBounds.bottom = 0;
292 return EMFDRV_WriteRecord( dev, &emr.emr );
295 BOOL CDECL EMFDRV_WidenPath( PHYSDEV dev )
297 EMRWIDENPATH emr;
299 emr.emr.iType = EMR_WIDENPATH;
300 emr.emr.nSize = sizeof(emr);
302 return EMFDRV_WriteRecord( dev, &emr.emr );
305 INT CDECL EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
307 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
309 switch(cap) {
311 case HORZRES:
312 return physDev->horzres;
313 case VERTRES:
314 return physDev->vertres;
315 case LOGPIXELSX:
316 return physDev->logpixelsx;
317 case LOGPIXELSY:
318 return physDev->logpixelsy;
319 case HORZSIZE:
320 return physDev->horzsize;
321 case VERTSIZE:
322 return physDev->vertsize;
323 case BITSPIXEL:
324 return physDev->bitspixel;
325 case TEXTCAPS:
326 return physDev->textcaps;
327 case RASTERCAPS:
328 return physDev->rastercaps;
329 case TECHNOLOGY:
330 return physDev->technology;
331 case PLANES:
332 return physDev->planes;
333 case NUMCOLORS:
334 return physDev->numcolors;
335 default:
336 FIXME("Unimplemented cap %d\n", cap);
337 return 0;