DIB Engine: Fork DDB-DIB behaviour
[wine/hacks.git] / dlls / winedib.drv / graphics.c
blobb74c08ef7284f7be8c1c8b44ef12bd52d8fd2f23
1 /*
2 * DIBDRV implementation of GDI driver graphics functions
4 * Copyright 2009 Massimo Del Fedele
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 "config.h"
22 #include "wine/port.h"
24 #include "dibdrv.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dibdrv);
28 /***********************************************************************
29 * DIBDRV_Arc
31 BOOL DIBDRV_Arc( DIBDRVPHYSDEV *physDev, INT left, INT top, INT right, INT bottom,
32 INT xstart, INT ystart, INT xend, INT yend )
34 BOOL res;
36 TRACE("physDev:%p, left:%d, top:%d, right:%d, bottom:%d, xstart:%d, ystart:%d, xend:%d, yend:%d\n",
37 physDev, left, top, right, bottom, xstart, ystart, xend, yend);
39 if(physDev->hasDIB)
41 /* DIB section selected in, use DIB Engine */
42 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
43 res = _DIBDRV_GetDisplayDriver()->pArc(physDev->X11PhysDev, left, top, right, bottom,
44 xstart, ystart, xend, yend);
46 else
48 /* DDB selected in, use X11 driver */
49 res = _DIBDRV_GetDisplayDriver()->pArc(physDev->X11PhysDev, left, top, right, bottom,
50 xstart, ystart, xend, yend);
52 return res;
55 /***********************************************************************
56 * DIBDRV_Chord
58 BOOL DIBDRV_Chord( DIBDRVPHYSDEV *physDev, INT left, INT top, INT right, INT bottom,
59 INT xstart, INT ystart, INT xend, INT yend )
61 BOOL res;
63 TRACE("physDev:%p, left:%d, top:%d, right:%d, bottom:%d, xstart:%d, ystart:%d, xend:%d, yend:%d\n",
64 physDev, left, top, right, bottom, xstart, ystart, xend, yend);
66 if(physDev->hasDIB)
68 /* DIB section selected in, use DIB Engine */
69 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
70 res = _DIBDRV_GetDisplayDriver()->pChord(physDev->X11PhysDev, left, top, right, bottom,
71 xstart, ystart, xend, yend);
73 else
75 /* DDB selected in, use X11 driver */
76 res = _DIBDRV_GetDisplayDriver()->pChord(physDev->X11PhysDev, left, top, right, bottom,
77 xstart, ystart, xend, yend);
79 return res;
82 /***********************************************************************
83 * DIBDRV_Ellipse
85 BOOL DIBDRV_Ellipse( DIBDRVPHYSDEV *physDev, INT left, INT top, INT right, INT bottom )
87 BOOL res;
89 TRACE("physDev:%p, left:%d, top:%d, right:%d, bottom:%d\n",
90 physDev, left, top, right, bottom);
92 if(physDev->hasDIB)
94 /* DIB section selected in, use DIB Engine */
95 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
96 res = _DIBDRV_GetDisplayDriver()->pEllipse(physDev->X11PhysDev, left, top, right, bottom);
98 else
100 /* DDB selected in, use X11 driver */
101 res = _DIBDRV_GetDisplayDriver()->pEllipse(physDev->X11PhysDev, left, top, right, bottom);
103 return res;
106 /**********************************************************************
107 * DIBDRV_ExtFloodFill
109 BOOL DIBDRV_ExtFloodFill( DIBDRVPHYSDEV *physDev, INT x, INT y, COLORREF color,
110 UINT fillType )
112 BOOL res;
114 TRACE("physDev:%p, x:%d, y:%d, color:%x, fillType:%d\n",
115 physDev, x, y, color, fillType);
117 if(physDev->hasDIB)
119 /* DIB section selected in, use DIB Engine */
120 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
121 res = _DIBDRV_GetDisplayDriver()->pExtFloodFill(physDev->X11PhysDev, x, y, color, fillType);
123 else
125 /* DDB selected in, use X11 driver */
126 res = _DIBDRV_GetDisplayDriver()->pExtFloodFill(physDev->X11PhysDev, x, y, color, fillType);
128 return res;
131 /***********************************************************************
132 * DIBDRV_GetDCOrgEx
134 BOOL DIBDRV_GetDCOrgEx( DIBDRVPHYSDEV *physDev, LPPOINT lpp )
136 BOOL res;
138 TRACE("physDev:%p, lpp:%p\n", physDev, lpp);
140 if(physDev->hasDIB)
142 /* DIB section selected in, use DIB Engine */
143 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
144 res = _DIBDRV_GetDisplayDriver()->pGetDCOrgEx(physDev->X11PhysDev, lpp);
146 else
148 /* DDB selected in, use X11 driver */
149 res = _DIBDRV_GetDisplayDriver()->pGetDCOrgEx(physDev->X11PhysDev, lpp);
151 return res;
154 /***********************************************************************
155 * DIBDRV_GetPixel
157 COLORREF DIBDRV_GetPixel( DIBDRVPHYSDEV *physDev, INT x, INT y )
159 COLORREF res;
161 TRACE("physDev:%p, x:%d, y:%d\n", physDev, x, y);
163 if(physDev->hasDIB)
165 /* DIB section selected in, use DIB Engine */
166 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
167 res = _DIBDRV_GetDisplayDriver()->pGetPixel(physDev->X11PhysDev, x, y);
169 else
171 /* DDB selected in, use X11 driver */
172 res = _DIBDRV_GetDisplayDriver()->pGetPixel(physDev->X11PhysDev, x, y);
174 return res;
177 /***********************************************************************
178 * DIBDRV_LineTo
180 BOOL DIBDRV_LineTo( DIBDRVPHYSDEV *physDev, INT x, INT y )
182 BOOL res;
184 TRACE("physDev:%p, x:%d, y:%d\n", physDev, x, y);
186 if(physDev->hasDIB)
188 /* DIB section selected in, use DIB Engine */
189 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
190 res = _DIBDRV_GetDisplayDriver()->pLineTo(physDev->X11PhysDev, x, y);
192 else
194 /* DDB selected in, use X11 driver */
195 res = _DIBDRV_GetDisplayDriver()->pLineTo(physDev->X11PhysDev, x, y);
197 return res;
200 /***********************************************************************
201 * DIBDRV_PaintRgn
203 BOOL DIBDRV_PaintRgn( DIBDRVPHYSDEV *physDev, HRGN hrgn )
205 BOOL res;
207 TRACE("physDev:%p, hrgn:%p\n", physDev, hrgn);
209 if(physDev->hasDIB)
211 /* DIB section selected in, use DIB Engine */
212 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
213 res = _DIBDRV_GetDisplayDriver()->pPaintRgn(physDev->X11PhysDev, hrgn);
215 else
217 /* DDB selected in, use X11 driver */
218 res = _DIBDRV_GetDisplayDriver()->pPaintRgn(physDev->X11PhysDev, hrgn);
220 return res;
223 /***********************************************************************
224 * DIBDRV_Pie
226 BOOL DIBDRV_Pie( DIBDRVPHYSDEV *physDev, INT left, INT top, INT right, INT bottom,
227 INT xstart, INT ystart, INT xend, INT yend )
229 BOOL res;
231 TRACE("physDev:%p, left:%d, top:%d, right:%d, bottom:%d, xstart:%d, ystart:%d, xend:%d, yend:%d\n",
232 physDev, left, top, right, bottom, xstart, ystart, xend, yend);
234 if(physDev->hasDIB)
236 /* DIB section selected in, use DIB Engine */
237 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
238 res = _DIBDRV_GetDisplayDriver()->pPie(physDev->X11PhysDev, left, top, right, bottom,
239 xstart, ystart, xend, yend);
241 else
243 /* DDB selected in, use X11 driver */
244 res = _DIBDRV_GetDisplayDriver()->pPie(physDev->X11PhysDev, left, top, right, bottom,
245 xstart, ystart, xend, yend);
247 return res;
250 /**********************************************************************
251 * DIBDRV_Polygon
253 BOOL DIBDRV_Polygon( DIBDRVPHYSDEV *physDev, const POINT* pt, INT count )
255 BOOL res;
257 TRACE("physDev:%p, pt:%p, count:%d\n", physDev, pt, count);
259 if(physDev->hasDIB)
261 /* DIB section selected in, use DIB Engine */
262 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
263 res = _DIBDRV_GetDisplayDriver()->pPolygon(physDev->X11PhysDev, pt, count);
265 else
267 /* DDB selected in, use X11 driver */
268 res = _DIBDRV_GetDisplayDriver()->pPolygon(physDev->X11PhysDev, pt, count);
270 return res;
273 /**********************************************************************
274 * DIBDRV_Polyline
276 BOOL DIBDRV_Polyline( DIBDRVPHYSDEV *physDev, const POINT* pt, INT count )
278 BOOL res;
280 TRACE("physDev:%p, pt:%p, count:%d\n", physDev, pt, count);
282 if(physDev->hasDIB)
284 /* DIB section selected in, use DIB Engine */
285 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
286 res = _DIBDRV_GetDisplayDriver()->pPolyline(physDev->X11PhysDev, pt, count);
288 else
290 /* DDB selected in, use X11 driver */
291 res = _DIBDRV_GetDisplayDriver()->pPolyline(physDev->X11PhysDev, pt, count);
293 return res;
296 /**********************************************************************
297 * DIBDRV_PolyPolygon
299 BOOL DIBDRV_PolyPolygon( DIBDRVPHYSDEV *physDev, const POINT* pt, const INT* counts, UINT polygons)
301 BOOL res;
303 TRACE("physDev:%p, pt:%p, counts:%p, polygons:%d\n", physDev, pt, counts, polygons);
305 if(physDev->hasDIB)
307 /* DIB section selected in, use DIB Engine */
308 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
309 res = _DIBDRV_GetDisplayDriver()->pPolyPolygon(physDev->X11PhysDev, pt, counts, polygons);
311 else
313 /* DDB selected in, use X11 driver */
314 res = _DIBDRV_GetDisplayDriver()->pPolyPolygon(physDev->X11PhysDev, pt, counts, polygons);
316 return res;
319 /**********************************************************************
320 * DIBDRV_PolyPolyline
322 BOOL DIBDRV_PolyPolyline( DIBDRVPHYSDEV *physDev, const POINT* pt, const DWORD* counts,
323 DWORD polylines )
325 BOOL res;
327 TRACE("physDev:%p, pt:%p, counts:%p, polylines:%d\n", physDev, pt, counts, polylines);
329 if(physDev->hasDIB)
331 /* DIB section selected in, use DIB Engine */
332 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
333 res = _DIBDRV_GetDisplayDriver()->pPolyPolyline(physDev->X11PhysDev, pt, counts, polylines);
335 else
337 /* DDB selected in, use X11 driver */
338 res = _DIBDRV_GetDisplayDriver()->pPolyPolyline(physDev->X11PhysDev, pt, counts, polylines);
340 return res;
343 /***********************************************************************
344 * DIBDRV_Rectangle
346 BOOL DIBDRV_Rectangle( DIBDRVPHYSDEV *physDev, INT left, INT top, INT right, INT bottom)
348 BOOL res;
350 TRACE("physDev:%p, left:%d, top:%d, right:%d, bottom:%d\n",
351 physDev, left, top, right, bottom);
353 if(physDev->hasDIB)
355 /* DIB section selected in, use DIB Engine */
356 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
357 res = _DIBDRV_GetDisplayDriver()->pRectangle(physDev->X11PhysDev, left, top, right, bottom);
359 else
361 /* DDB selected in, use X11 driver */
362 res = _DIBDRV_GetDisplayDriver()->pRectangle(physDev->X11PhysDev, left, top, right, bottom);
364 return res;
367 /***********************************************************************
368 * DIBDRV_RoundRect
370 BOOL DIBDRV_RoundRect( DIBDRVPHYSDEV *physDev, INT left, INT top, INT right,
371 INT bottom, INT ell_width, INT ell_height )
373 BOOL res;
375 TRACE("physDev:%p, left:%d, top:%d, right:%d, bottom:%d, ell_width:%d, ell_height:%d\n",
376 physDev, left, top, right, bottom, ell_width, ell_height);
378 if(physDev->hasDIB)
380 /* DIB section selected in, use DIB Engine */
381 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
382 res = _DIBDRV_GetDisplayDriver()->pRoundRect(physDev->X11PhysDev, left, top, right, bottom,
383 ell_width, ell_height);
385 else
387 /* DDB selected in, use X11 driver */
388 res = _DIBDRV_GetDisplayDriver()->pRoundRect(physDev->X11PhysDev, left, top, right, bottom,
389 ell_width, ell_height);
391 return res;
394 /***********************************************************************
395 * DIBDRV_SetPixel
397 COLORREF DIBDRV_SetPixel( DIBDRVPHYSDEV *physDev, INT x, INT y, COLORREF color )
399 COLORREF res;
401 TRACE("physDev:%p, x:%d, y:%d, color:%x\n", physDev, x, y, color);
403 if(physDev->hasDIB)
405 /* DIB section selected in, use DIB Engine */
406 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
407 res = _DIBDRV_GetDisplayDriver()->pSetPixel(physDev->X11PhysDev, x, y, color);
409 else
411 /* DDB selected in, use X11 driver */
412 res = _DIBDRV_GetDisplayDriver()->pSetPixel(physDev->X11PhysDev, x, y, color);
414 return res;
417 /***********************************************************************
418 * DIBDRV_SetDCOrg
420 DWORD DIBDRV_SetDCOrg( DIBDRVPHYSDEV *physDev, INT x, INT y )
422 DWORD res;
424 TRACE("physDev:%p, x:%d, y:%d\n", physDev, x, y);
426 if(physDev->hasDIB)
428 /* DIB section selected in, use DIB Engine */
429 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
430 res = _DIBDRV_GetDisplayDriver()->pSetDCOrg(physDev->X11PhysDev, x, y);
432 else
434 /* DDB selected in, use X11 driver */
435 res = _DIBDRV_GetDisplayDriver()->pSetDCOrg(physDev->X11PhysDev, x, y);
437 return res;