022f2237b88b2f8a6e5a6d9bba85c99c2c758396
[wine/hacks.git] / dlls / winedib.drv / bitblt.c
blob022f2237b88b2f8a6e5a6d9bba85c99c2c758396
1 /*
2 * DIBDRV bit-blit operations
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_AlphaBlend
31 BOOL DIBDRV_AlphaBlend( DIBDRVPHYSDEV *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
32 DIBDRVPHYSDEV *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
33 BLENDFUNCTION blendfn)
35 BOOL res;
37 TRACE("physDevDst:%p, xDst:%d, yDst:%d, widthDst:%d, heightDst:%d, physDevSrc:%p, xSrc:%d, ySrc:%d, widthSrc:%d, heightSrc:%d\n",
38 physDevDst, xDst, yDst, widthDst, heightDst, physDevSrc, xSrc, ySrc, widthSrc, heightSrc);
40 if(physDevDst->hasDIB && physDevSrc->hasDIB)
42 /* DIB section selected in both source and dest DC, use DIB Engine */
43 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
44 res = _DIBDRV_GetDisplayDriver()->pAlphaBlend(physDevDst->X11PhysDev, xDst, yDst, widthDst, heightDst,
45 physDevSrc->X11PhysDev, xSrc, ySrc, widthSrc, heightSrc,
46 blendfn);
48 else if(!physDevDst->hasDIB && !physDevSrc->hasDIB)
50 /* DDB selected in noth source and dest DC, use X11 driver */
51 res = _DIBDRV_GetDisplayDriver()->pAlphaBlend(physDevDst->X11PhysDev, xDst, yDst, widthDst, heightDst,
52 physDevSrc->X11PhysDev, xSrc, ySrc, widthSrc, heightSrc,
53 blendfn);
55 else if(physDevSrc->hasDIB)
57 /* DIB on source, DDB on dest -- must convert source DIB to DDB and use X11 driver for blit */
58 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
59 res = _DIBDRV_GetDisplayDriver()->pAlphaBlend(physDevDst->X11PhysDev, xDst, yDst, widthDst, heightDst,
60 physDevSrc->X11PhysDev, xSrc, ySrc, widthSrc, heightSrc,
61 blendfn);
63 else /* if(physDevDst->hasDIB) */
65 /* DDB on source, DIB on dest -- must convert source DDB to DIB and use the engine for blit */
66 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
67 res = _DIBDRV_GetDisplayDriver()->pAlphaBlend(physDevDst->X11PhysDev, xDst, yDst, widthDst, heightDst,
68 physDevSrc->X11PhysDev, xSrc, ySrc, widthSrc, heightSrc,
69 blendfn);
71 return res;
74 /***********************************************************************
75 * DIBDRV_BitBlt
77 BOOL DIBDRV_BitBlt( DIBDRVPHYSDEV *physDevDst, INT xDst, INT yDst,
78 INT width, INT height, DIBDRVPHYSDEV *physDevSrc,
79 INT xSrc, INT ySrc, DWORD rop )
81 BOOL res;
83 TRACE("physDevDst:%p, xDst:%d, yDst:%d, width:%d, height:%d, physDevSrc:%p, xSrc:%d, ySrc:%d, rop:%08x\n",
84 physDevDst, xDst, yDst, width, height, physDevSrc, xSrc, ySrc, rop);
86 if(physDevDst->hasDIB && physDevSrc->hasDIB)
88 /* DIB section selected in both source and dest DC, use DIB Engine */
89 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
90 res = _DIBDRV_GetDisplayDriver()->pBitBlt(physDevDst->X11PhysDev, xDst, yDst, width, height,
91 physDevSrc->X11PhysDev, xSrc, ySrc, rop);
93 else if(!physDevDst->hasDIB && !physDevSrc->hasDIB)
95 /* DDB selected in noth source and dest DC, use X11 driver */
96 res = _DIBDRV_GetDisplayDriver()->pBitBlt(physDevDst->X11PhysDev, xDst, yDst, width, height,
97 physDevSrc->X11PhysDev, xSrc, ySrc, rop);
99 else if(physDevSrc->hasDIB)
101 /* DIB on source, DDB on dest -- must convert source DIB to DDB and use X11 driver for blit */
102 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
103 res = _DIBDRV_GetDisplayDriver()->pBitBlt(physDevDst->X11PhysDev, xDst, yDst, width, height,
104 physDevSrc->X11PhysDev, xSrc, ySrc, rop);
106 else /* if(physDevDst->hasDIB) */
108 /* DDB on source, DIB on dest -- must convert source DDB to DIB and use the engine for blit */
109 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
110 res = _DIBDRV_GetDisplayDriver()->pBitBlt(physDevDst->X11PhysDev, xDst, yDst, width, height,
111 physDevSrc->X11PhysDev, xSrc, ySrc, rop);
113 return res;
116 /***********************************************************************
117 * DIBDRV_StretchBlt
119 BOOL DIBDRV_StretchBlt( DIBDRVPHYSDEV *physDevDst, INT xDst, INT yDst,
120 INT widthDst, INT heightDst,
121 DIBDRVPHYSDEV *physDevSrc, INT xSrc, INT ySrc,
122 INT widthSrc, INT heightSrc, DWORD rop )
124 BOOL res;
126 TRACE("physDevDst:%p, xDst:%d, yDst:%d, widthDst:%d, heightDst:%d, physDevSrc:%p, xSrc:%d, ySrc:%d, widthSrc:%d, heightSrc:%d, rop:%8x\n",
127 physDevDst, xDst, yDst, widthDst, heightDst, physDevSrc, xSrc, ySrc, widthSrc, heightSrc, rop);
129 if(physDevDst->hasDIB && physDevSrc->hasDIB)
131 /* DIB section selected in both source and dest DC, use DIB Engine */
132 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
133 res = _DIBDRV_GetDisplayDriver()->pStretchBlt(physDevDst->X11PhysDev, xDst, yDst, widthSrc, heightSrc,
134 physDevSrc->X11PhysDev, xSrc, ySrc, widthDst, heightDst, rop);
136 else if(!physDevDst->hasDIB && !physDevSrc->hasDIB)
138 /* DDB selected in noth source and dest DC, use X11 driver */
139 res = _DIBDRV_GetDisplayDriver()->pStretchBlt(physDevDst->X11PhysDev, xDst, yDst, widthSrc, heightSrc,
140 physDevSrc->X11PhysDev, xSrc, ySrc, widthDst, heightDst, rop);
142 else if(physDevSrc->hasDIB)
144 /* DIB on source, DDB on dest -- must convert source DIB to DDB and use X11 driver for blit */
145 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
146 res = _DIBDRV_GetDisplayDriver()->pStretchBlt(physDevDst->X11PhysDev, xDst, yDst, widthSrc, heightSrc,
147 physDevSrc->X11PhysDev, xSrc, ySrc, widthDst, heightDst, rop);
149 else /* if(physDevDst->hasDIB) */
151 /* DDB on source, DIB on dest -- must convert source DDB to DIB and use the engine for blit */
152 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
153 res = _DIBDRV_GetDisplayDriver()->pStretchBlt(physDevDst->X11PhysDev, xDst, yDst, widthSrc, heightSrc,
154 physDevSrc->X11PhysDev, xSrc, ySrc, widthDst, heightDst, rop);
156 return res;
159 /***********************************************************************
160 * DIBDRV_PatBlt
162 BOOL DIBDRV_PatBlt( DIBDRVPHYSDEV *physDev, INT left, INT top, INT width, INT height, DWORD rop )
164 BOOL res;
166 TRACE("physDev:%p, left:%d, top:%d, width:%d, height:%d, rop:%06x\n", physDev, left, top, width, height, rop);
168 if(physDev->hasDIB)
170 /* DIB section selected in, use DIB Engine */
171 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
172 res = _DIBDRV_GetDisplayDriver()->pPatBlt(physDev->X11PhysDev, left, top, width, height, rop);
174 else
176 /* DDB selected in, use X11 driver */
177 res = _DIBDRV_GetDisplayDriver()->pPatBlt(physDev->X11PhysDev, left, top, width, height, rop);
179 return res;