Debian Codegraph @

src/uxa/uxa-render.c

raw symbols SCIP
1 /*
2 * Copyright © 2001 Keith Packard
3 *
4 * Partly based on code that is Copyright © The XFree86 Project Inc.
5 *
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
15 *
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
23 */
24
25 #ifdef HAVE_DIX_CONFIG_H
26 #include <dix-config.h>
27 #endif
28
29 #include <stdlib.h>
30
31 #include "uxa-priv.h"cxx . . $ `<file>/src/uxa/uxa-priv.h`/
32 #include <xorgVersion.h>
33
34 #ifdef RENDERcxx . . $ `<external>/9559255664802066005/xorg-server.h:85:9`!
35 #include "mipict.h"
36
37 static void uxa_composite_fallback_pict_desccxx . . $ uxa_composite_fallback_pict_desc(b43660749408942a).(PicturePtrcxx . . $ PicturePtr# pict, char *string,
38 int n)
39 {
40 char format[20];
41 char size[20];
42 char loc;
43
44 if (!pict) {
45 snprintfcxx . . $ snprintf(ea502d73e74c754c).(string, n, "None");
46 return;
47 }
48
49 if (pict->pDrawablecxx . . $ _Picture#pDrawable. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
50 snprintfcxx . . $ snprintf(ea502d73e74c754c).(string, n, "source-only");
51 return;
52 }
53
54 switch (pict->formatcxx . . $ _Picture#format.) {
55 case PICT_a8r8g8b8cxx . . $ PICT_a8r8g8b8.:
56 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "ARGB8888");
57 break;
58 case PICT_x8r8g8b8cxx . . $ PICT_x8r8g8b8.:
59 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "XRGB8888");
60 break;
61 case PICT_r5g6b5cxx . . $ PICT_r5g6b5.:
62 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "RGB565 ");
63 break;
64 case PICT_x1r5g5b5cxx . . $ PICT_x1r5g5b5.:
65 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "RGB555 ");
66 break;
67 case PICT_a8cxx . . $ PICT_a8.:
68 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "A8 ");
69 break;
70 case PICT_a1cxx . . $ PICT_a1.:
71 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "A1 ");
72 break;
73 default:
74 snprintfcxx . . $ snprintf(ea502d73e74c754c).(format, 20, "0x%x", (int)pict->formatcxx . . $ _Picture#format.);
75 break;
76 }
77
78 loc = uxa_drawable_is_offscreencxx . . $ uxa_drawable_is_offscreen(653d4fd9ab926f62).(pict->pDrawablecxx . . $ _Picture#pDrawable.) ? 's' : 'm';
79
80 snprintfcxx . . $ snprintf(ea502d73e74c754c).(size, 20, "%dx%d%s", pict->pDrawablecxx . . $ _Picture#pDrawable.->widthcxx . . $ _Drawable#width.,
81 pict->pDrawablecxx . . $ _Picture#pDrawable.->heightcxx . . $ _Drawable#height., pict->repeatcxx . . $ _Picture#repeat. ? " R" : "");
82
83 snprintfcxx . . $ snprintf(ea502d73e74c754c).(string, n, "%p:%c fmt %s (%s)%s",
84 pict->pDrawablecxx . . $ _Picture#pDrawable., loc, format, size,
85 pict->alphaMapcxx . . $ _Picture#alphaMap. ? " with alpha map" :"");
86 }
87
88 static const char *
89 op_to_stringcxx . . $ op_to_string(42624c5f3be67010).(CARD8cxx . . $ CARD8# op)
90 {
91 switch (op) {
92 #define Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(x) case PictOp##x: return #x
93 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Clear);
94 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Src);
95 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Dst);
96 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Over);
97 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(OverReverse);
98 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(In);
99 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(InReverse);
100 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Out);
101 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(OutReverse);
102 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Atop);
103 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(AtopReverse);
104 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Xor);
105 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Add);
106 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Saturate);
107
108 /*
109 * Operators only available in version 0.2
110 */
111 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointClear);
112 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointSrc);
113 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointDst);
114 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointOver);
115 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointOverReverse);
116 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointIn);
117 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointInReverse);
118 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointOut);
119 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointOutReverse);
120 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointAtop);
121 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointAtopReverse);
122 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(DisjointXor);
123
124 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointClear);
125 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointSrc);
126 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointDst);
127 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointOver);
128 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointOverReverse);
129 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointIn);
130 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointInReverse);
131 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointOut);
132 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointOutReverse);
133 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointAtop);
134 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointAtopReverse);
135 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ConjointXor);
136
137 /*
138 * Operators only available in version 0.11
139 */
140 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Multiply);
141 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Screen);
142 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Overlay);
143 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Darken);
144 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Lighten);
145 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ColorDodge);
146 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(ColorBurn);
147 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(HardLight);
148 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(SoftLight);
149 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Difference);
150 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(Exclusion);
151 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(HSLHue);
152 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(HSLSaturation);
153 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(HSLColor);
154 Ccxx . . $ `src/uxa/uxa-render.c:92:9`!(HSLLuminosity);
155 default: return "garbage";
156 #undef Ccxx . . $ `src/uxa/uxa-render.c:92:9`!
157 }
158 }
159
160 static void
161 uxa_print_composite_fallbackcxx . . $ uxa_print_composite_fallback(da667da082ecb617).(const char *func, CARD8cxx . . $ CARD8# op,
162 PicturePtrcxx . . $ PicturePtr# pSrc, PicturePtrcxx . . $ PicturePtr# pMask, PicturePtrcxx . . $ PicturePtr# pDst)
163 {
164 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.);
165 char srcdesc[40], maskdesc[40], dstdesc[40];
166
167 if (! uxa_screen->fallback_debugcxx . . $ $anonymous_type_38e0ee3db9adc002_2#fallback_debug.)
168 return;
169
170 /* Limit the noise if fallbacks are expected. */
171 if (uxa_screen->force_fallbackcxx . . $ $anonymous_type_38e0ee3db9adc002_2#force_fallback.)
172 return;
173
174 uxa_composite_fallback_pict_desccxx . . $ uxa_composite_fallback_pict_desc(b43660749408942a).(pSrc, srcdesc, 40);
175 uxa_composite_fallback_pict_desccxx . . $ uxa_composite_fallback_pict_desc(b43660749408942a).(pMask, maskdesc, 40);
176 uxa_composite_fallback_pict_desccxx . . $ uxa_composite_fallback_pict_desc(b43660749408942a).(pDst, dstdesc, 40);
177
178 ErrorFcxx . . $ ErrorF(326aeb464d16410c).("Composite fallback at %s:\n"
179 " op %s, \n"
180 " src %s, \n"
181 " mask %s, \n"
182 " dst %s, \n"
183 " screen %s\n",
184 func, op_to_stringcxx . . $ op_to_string(42624c5f3be67010). (op), srcdesc, maskdesc, dstdesc,
185 uxa_screen->swappedOutcxx . . $ $anonymous_type_38e0ee3db9adc002_2#swappedOut. ? "swapped out" : "normal");
186 }
187
188 Boolcxx . . $ Bool# uxa_op_reads_destinationcxx . . $ uxa_op_reads_destination(b27dbea426b7b93).(CARD8cxx . . $ CARD8# op)
189 {
190 /* FALSE (does not read destination) is the list of ops in the protocol
191 * document with "0" in the "Fb" column and no "Ab" in the "Fa" column.
192 * That's just Clear and Src. ReduceCompositeOp() will already have
193 * converted con/disjoint clear/src to Clear or Src.
194 */
195 switch (op) {
196 case PictOpClearcxx . . $ `<external>/2369207440537731940/render.h:93:9`!:
197 case PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`!:
198 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
199 default:
200 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
201 }
202 }
203
204 static Boolcxx . . $ Bool#
205 uxa_get_pixel_from_rgbacxx . . $ uxa_get_pixel_from_rgba(13fdbd74698217b0).(CARD32cxx . . $ CARD32# * pixel,
206 CARD16cxx . . $ CARD16# red,
207 CARD16cxx . . $ CARD16# green,
208 CARD16cxx . . $ CARD16# blue,
209 CARD16cxx . . $ CARD16# alpha,
210 CARD32cxx . . $ CARD32# format)
211 {
212 int rbits, bbits, gbits, abits;
213 int rshift, bshift, gshift, ashift;
214
215 rbits = PICT_FORMAT_Rcxx . . $ `<external>/15484583900196244369/picture.h:53:9`!(format);
216 gbits = PICT_FORMAT_Gcxx . . $ `<external>/15484583900196244369/picture.h:54:9`!(format);
217 bbits = PICT_FORMAT_Bcxx . . $ `<external>/15484583900196244369/picture.h:55:9`!(format);
218 abits = PICT_FORMAT_Acxx . . $ `<external>/15484583900196244369/picture.h:52:9`!(format);
219 if (abits == 0)
220 abits = PICT_FORMAT_BPPcxx . . $ `<external>/15484583900196244369/picture.h:50:9`!(format) - (rbits+gbits+bbits);
221
222 if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_Acxx . . $ `<external>/15484583900196244369/picture.h:60:9`!) {
223 *pixel = alpha >> (16 - abits);
224 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
225 }
226
227 if (!PICT_FORMAT_COLORcxx . . $ `<external>/15484583900196244369/picture.h:67:9`!(format))
228 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
229
230 if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_ARGBcxx . . $ `<external>/15484583900196244369/picture.h:61:9`!) {
231 bshift = 0;
232 gshift = bbits;
233 rshift = gshift + gbits;
234 ashift = rshift + rbits;
235 } else if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_ABGRcxx . . $ `<external>/15484583900196244369/picture.h:62:9`!) {
236 rshift = 0;
237 gshift = rbits;
238 bshift = gshift + gbits;
239 ashift = bshift + bbits;
240 } else if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_BGRAcxx . . $ `<external>/15484583900196244369/picture.h:65:9`!) {
241 ashift = 0;
242 rshift = abits;
243 gshift = rshift + rbits;
244 bshift = gshift + gbits;
245 } else {
246 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
247 }
248
249 *pixel = 0;
250 *pixel |= (blue >> (16 - bbits)) << bshift;
251 *pixel |= (green >> (16 - gbits)) << gshift;
252 *pixel |= (red >> (16 - rbits)) << rshift;
253 *pixel |= (alpha >> (16 - abits)) << ashift;
254
255 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
256 }
257
258 Boolcxx . . $ Bool#
259 uxa_get_rgba_from_pixelcxx . . $ uxa_get_rgba_from_pixel(c374232f791f2f08).(CARD32cxx . . $ CARD32# pixel,
260 CARD16cxx . . $ CARD16# * red,
261 CARD16cxx . . $ CARD16# * green,
262 CARD16cxx . . $ CARD16# * blue,
263 CARD16cxx . . $ CARD16# * alpha,
264 CARD32cxx . . $ CARD32# format)
265 {
266 int rbits, bbits, gbits, abits;
267 int rshift, bshift, gshift, ashift;
268
269 rbits = PICT_FORMAT_Rcxx . . $ `<external>/15484583900196244369/picture.h:53:9`!(format);
270 gbits = PICT_FORMAT_Gcxx . . $ `<external>/15484583900196244369/picture.h:54:9`!(format);
271 bbits = PICT_FORMAT_Bcxx . . $ `<external>/15484583900196244369/picture.h:55:9`!(format);
272 abits = PICT_FORMAT_Acxx . . $ `<external>/15484583900196244369/picture.h:52:9`!(format);
273
274 if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_Acxx . . $ `<external>/15484583900196244369/picture.h:60:9`!) {
275 rshift = gshift = bshift = ashift = 0;
276 } else if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_ARGBcxx . . $ `<external>/15484583900196244369/picture.h:61:9`!) {
277 bshift = 0;
278 gshift = bbits;
279 rshift = gshift + gbits;
280 ashift = rshift + rbits;
281 } else if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_ABGRcxx . . $ `<external>/15484583900196244369/picture.h:62:9`!) {
282 rshift = 0;
283 gshift = rbits;
284 bshift = gshift + gbits;
285 ashift = bshift + bbits;
286 } else if (PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(format) == PICT_TYPE_BGRAcxx . . $ `<external>/15484583900196244369/picture.h:65:9`!) {
287 ashift = 0;
288 rshift = abits;
289 if (abits == 0)
290 rshift = PICT_FORMAT_BPPcxx . . $ `<external>/15484583900196244369/picture.h:50:9`!(format) - (rbits+gbits+bbits);
291 gshift = rshift + rbits;
292 bshift = gshift + gbits;
293 } else {
294 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
295 }
296
297 if (rbits) {
298 *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits);
299 while (rbits < 16) {
300 *red |= *red >> rbits;
301 rbits <<= 1;
302 }
303 } else
304 *red = 0;
305
306 if (gbits) {
307 *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits);
308 while (gbits < 16) {
309 *green |= *green >> gbits;
310 gbits <<= 1;
311 }
312 } else
313 *green = 0;
314
315 if (bbits) {
316 *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits);
317 while (bbits < 16) {
318 *blue |= *blue >> bbits;
319 bbits <<= 1;
320 }
321 } else
322 *blue = 0;
323
324 if (abits) {
325 *alpha =
326 ((pixel >> ashift) & ((1 << abits) - 1)) << (16 - abits);
327 while (abits < 16) {
328 *alpha |= *alpha >> abits;
329 abits <<= 1;
330 }
331 } else
332 *alpha = 0xffff;
333
334 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
335 }
336
337 Boolcxx . . $ Bool#
338 uxa_get_color_for_pixmapcxx . . $ uxa_get_color_for_pixmap(bdb1d423bc7461d4). (PixmapPtrcxx . . $ PixmapPtr# pixmap,
339 CARD32cxx . . $ CARD32# src_format,
340 CARD32cxx . . $ CARD32# dst_format,
341 CARD32cxx . . $ CARD32# *pixel)
342 {
343 CARD16cxx . . $ CARD16# red, green, blue, alpha;
344
345 *pixel = uxa_get_pixmap_first_pixelcxx . . $ uxa_get_pixmap_first_pixel(e7c19584c0d224af).(pixmap);
346
347 if (src_format != dst_format) {
348 if (!uxa_get_rgba_from_pixelcxx . . $ uxa_get_rgba_from_pixel(c374232f791f2f08).(*pixel,
349 &red, &green, &blue, &alpha,
350 src_format))
351 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
352
353 if (!uxa_get_pixel_from_rgbacxx . . $ uxa_get_pixel_from_rgba(13fdbd74698217b0).(pixel,
354 red, green, blue, alpha,
355 dst_format))
356 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
357 }
358
359 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
360 }
361
362 static int
363 uxa_try_driver_solid_fillcxx . . $ uxa_try_driver_solid_fill(3a15924f2bf7306d).(PicturePtrcxx . . $ PicturePtr# pSrc,
364 PicturePtrcxx . . $ PicturePtr# pDst,
365 INT16cxx . . $ INT16# xSrc,
366 INT16cxx . . $ INT16# ySrc,
367 INT16cxx . . $ INT16# xDst, INT16cxx . . $ INT16# yDst, CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
368 {
369 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.);
370 RegionReccxx . . $ RegionRec# region;
371 BoxPtrcxx . . $ BoxPtr# pbox;
372 int nbox;
373 int dst_off_x, dst_off_y;
374 PixmapPtrcxx . . $ PixmapPtr# pSrcPix = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, pDstPix;
375 CARD32cxx . . $ CARD32# pixel;
376
377 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_solidcxx . . $ _UxaDriver#check_solid. && !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_solidcxx . . $ _UxaDriver#check_solid.(pDst->pDrawablecxx . . $ _Picture#pDrawable., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!))
378 return -1;
379
380 pDstPix = uxa_get_offscreen_pixmapcxx . . $ uxa_get_offscreen_pixmap(fabc0b97bf9e3b7).(pDst->pDrawablecxx . . $ _Picture#pDrawable., &dst_off_x, &dst_off_y);
381 if (!pDstPix)
382 return -1;
383
384 xDst += pDst->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
385 yDst += pDst->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
386
387 if (pSrc->pDrawablecxx . . $ _Picture#pDrawable.) {
388 pSrcPix = uxa_get_drawable_pixmapcxx . . $ uxa_get_drawable_pixmap(37fca7f3554b94d5).(pSrc->pDrawablecxx . . $ _Picture#pDrawable.);
389 xSrc += pSrc->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
390 ySrc += pSrc->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
391 }
392
393 if (!miComputeCompositeRegioncxx . . $ miComputeCompositeRegion(de2d6d5d4628920b).(&region, pSrc, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, pDst,
394 xSrc, ySrc, 0, 0, xDst, yDst,
395 width, height))
396 return 1;
397
398 if (pSrcPix) {
399 if (! uxa_get_color_for_pixmapcxx . . $ uxa_get_color_for_pixmap(bdb1d423bc7461d4). (pSrcPix, pSrc->formatcxx . . $ _Picture#format., pDst->formatcxx . . $ _Picture#format., &pixel)) {
400 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen, &region);
401 return -1;
402 }
403 } else {
404 SourcePictcxx . . $ SourcePict# *source = pSrc->pSourcePictcxx . . $ _Picture#pSourcePict.;
405 PictSolidFillcxx . . $ PictSolidFill# *solid = &source->solidFillcxx . . $ _SourcePict#solidFill.;
406
407 if (source == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! || source->typecxx . . $ _SourcePict#type. != SourcePictTypeSolidFillcxx . . $ `<external>/920586193036082439/picturestr.h:63:9`!) {
408 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen, &region);
409 return -1;
410 }
411
412 if (pDst->formatcxx . . $ _Picture#format. == PICT_a8r8g8b8cxx . . $ PICT_a8r8g8b8.) {
413 pixel = solid->colorcxx . . $ _PictSolidFill#color.;
414 } else if (pDst->formatcxx . . $ _Picture#format. == PICT_x8r8g8b8cxx . . $ PICT_x8r8g8b8.) {
415 pixel = solid->colorcxx . . $ _PictSolidFill#color. | 0xff000000;
416 } else {
417 CARD16cxx . . $ CARD16# red, green, blue, alpha;
418
419 if (!uxa_get_rgba_from_pixelcxx . . $ uxa_get_rgba_from_pixel(c374232f791f2f08).(solid->colorcxx . . $ _PictSolidFill#color.,
420 &red, &green, &blue, &alpha,
421 PIXMAN_a8r8g8b8cxx . . $ PIXMAN_a8r8g8b8.) ||
422 !uxa_get_pixel_from_rgbacxx . . $ uxa_get_pixel_from_rgba(13fdbd74698217b0).(&pixel,
423 red, green, blue, alpha,
424 pDst->formatcxx . . $ _Picture#format.)) {
425 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen, &region);
426 return -1;
427 }
428 }
429 }
430
431 if (!(*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->prepare_solidcxx . . $ _UxaDriver#prepare_solid.)
432 (pDstPix, GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!, pixel)) {
433 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen, &region);
434 return -1;
435 }
436
437 REGION_TRANSLATEcxx . . $ `<external>/14128946855725894503/regionstr.h:362:9`!(pScreen, &region, dst_off_x, dst_off_y);
438
439 nbox = REGION_NUM_RECTScxx . . $ `<external>/14128946855725894503/regionstr.h:346:9`!(&region);
440 pbox = REGION_RECTScxx . . $ `<external>/14128946855725894503/regionstr.h:348:9`!(&region);
441
442 while (nbox--) {
443 (*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->solidcxx . . $ _UxaDriver#solid.) (pDstPix, pbox->x1cxx . . $ pixman_box16#x1., pbox->y1cxx . . $ pixman_box16#y1.,
444 pbox->x2cxx . . $ pixman_box16#x2., pbox->y2cxx . . $ pixman_box16#y2.);
445 pbox++;
446 }
447
448 (*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->done_solidcxx . . $ _UxaDriver#done_solid.) (pDstPix);
449
450 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen, &region);
451 return 1;
452 }
453
454 static PicturePtrcxx . . $ PicturePtr#
455 uxa_picture_for_pixman_formatcxx . . $ uxa_picture_for_pixman_format(a1c82e78a68cc11b).(ScreenPtrcxx . . $ ScreenPtr# pScreen,
456 pixman_format_code_tcxx . . $ pixman_format_code_t# format,
457 int width, int height)
458 {
459 PicturePtrcxx . . $ PicturePtr# pPicture;
460 PixmapPtrcxx . . $ PixmapPtr# pPixmap;
461 int error;
462
463 if (format == PIXMAN_a1cxx . . $ PIXMAN_a1.)
464 format = PIXMAN_a8cxx . . $ PIXMAN_a8.;
465
466 /* fill alpha if unset */
467 if (PIXMAN_FORMAT_Acxx . . $ `<external>/17639638556090915931/pixman.h:1024:9`!(format) == 0)
468 format = PIXMAN_a8r8g8b8cxx . . $ PIXMAN_a8r8g8b8.;
469
470 pPixmap = (*pScreen->CreatePixmapcxx . . $ _Screen#CreatePixmap.)(pScreen, width, height,
471 PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format),
472 UXA_CREATE_PIXMAP_FOR_MAPcxx . . $ `src/uxa/uxa.h:555:9`!);
473 if (!pPixmap)
474 return 0;
475
476 pPicture = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pPixmap->drawablecxx . . $ _Pixmap#drawable.,
477 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(pScreen,
478 PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format),
479 format),
480 0, 0, serverClientcxx . . $ serverClient., &error);
481 (*pScreen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.) (pPixmap);
482 if (!pPicture)
483 return 0;
484
485 ValidatePicturecxx . . $ ValidatePicture(bc938522fd951fa8).(pPicture);
486
487 return pPicture;
488 }
489
490 static PicturePtrcxx . . $ PicturePtr#
491 uxa_picture_from_pixman_imagecxx . . $ uxa_picture_from_pixman_image(6e446f5f405fc899).(ScreenPtrcxx . . $ ScreenPtr# screen,
492 pixman_image_tcxx . . $ pixman_image_t# * image,
493 pixman_format_code_tcxx . . $ pixman_format_code_t# format)
494 {
495 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
496 PicturePtrcxx . . $ PicturePtr# picture;
497 PixmapPtrcxx . . $ PixmapPtr# pixmap;
498 int width, height;
499
500 width = pixman_image_get_widthcxx . . $ pixman_image_get_width(1233b5bf7ad32299).(image);
501 height = pixman_image_get_heightcxx . . $ pixman_image_get_height(1233b5bf7ad32299).(image);
502
503 picture = uxa_picture_for_pixman_formatcxx . . $ uxa_picture_for_pixman_format(a1c82e78a68cc11b).(screen, format,
504 width, height);
505 if (!picture)
506 return 0;
507
508 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->put_imagecxx . . $ _UxaDriver#put_image. &&
509 ((picture->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth. << 24) | picture->formatcxx . . $ _Picture#format.) == format &&
510 uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->put_imagecxx . . $ _UxaDriver#put_image.((PixmapPtrcxx . . $ PixmapPtr#)picture->pDrawablecxx . . $ _Picture#pDrawable.,
511 0, 0,
512 width, height,
513 (char *)pixman_image_get_datacxx . . $ pixman_image_get_data(d654764b2964478d).(image),
514 pixman_image_get_stridecxx . . $ pixman_image_get_stride(1233b5bf7ad32299).(image)))
515 return picture;
516
517 pixmap = GetScratchPixmapHeadercxx . . $ GetScratchPixmapHeader(a3242d3456af3d86).(screen, width, height,
518 PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format),
519 PIXMAN_FORMAT_BPPcxx . . $ `<external>/17639638556090915931/pixman.h:1021:9`!(format),
520 pixman_image_get_stridecxx . . $ pixman_image_get_stride(1233b5bf7ad32299).(image),
521 pixman_image_get_datacxx . . $ pixman_image_get_data(d654764b2964478d).(image));
522 if (!pixmap) {
523 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(picture, 0);
524 return 0;
525 }
526
527 if (((picture->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth. << 24) | picture->formatcxx . . $ _Picture#format.) == format) {
528 GCPtrcxx . . $ GCPtr# gc;
529
530 gc = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format), screen);
531 if (!gc) {
532 FreeScratchPixmapHeadercxx . . $ FreeScratchPixmapHeader(2f6e21ec3a00cbb6).(pixmap);
533 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(picture, 0);
534 return 0;
535 }
536 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(picture->pDrawablecxx . . $ _Picture#pDrawable., gc);
537
538 (*gc->opscxx . . $ _GC#ops.->CopyAreacxx . . $ _GCOps#CopyArea.) (&pixmap->drawablecxx . . $ _Pixmap#drawable., picture->pDrawablecxx . . $ _Picture#pDrawable.,
539 gc, 0, 0, width, height, 0, 0);
540
541 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(gc);
542 } else {
543 PicturePtrcxx . . $ PicturePtr# src;
544 int error;
545
546 src = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pixmap->drawablecxx . . $ _Pixmap#drawable.,
547 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen,
548 PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format),
549 format),
550 0, 0, serverClientcxx . . $ serverClient., &error);
551 if (!src) {
552 FreeScratchPixmapHeadercxx . . $ FreeScratchPixmapHeader(2f6e21ec3a00cbb6).(pixmap);
553 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(picture, 0);
554 return 0;
555 }
556 ValidatePicturecxx . . $ ValidatePicture(bc938522fd951fa8).(src);
557
558 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(picture->pDrawablecxx . . $ _Picture#pDrawable., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
559 fbCompositecxx . . $ fbComposite(842e5d8f7bc57502).(PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`!, src, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, picture,
560 0, 0, 0, 0, 0, 0, width, height);
561 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(picture->pDrawablecxx . . $ _Picture#pDrawable.);
562 }
563
564 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(src, 0);
565 }
566 FreeScratchPixmapHeadercxx . . $ FreeScratchPixmapHeader(2f6e21ec3a00cbb6).(pixmap);
567
568 return picture;
569 }
570
571 static PicturePtrcxx . . $ PicturePtr#
572 uxa_create_solidcxx . . $ uxa_create_solid(413afeb6eb7c3199).(ScreenPtrcxx . . $ ScreenPtr# screen, uint32_tcxx . . $ uint32_t# color)
573 {
574 PixmapPtrcxx . . $ PixmapPtr# pixmap;
575 PicturePtrcxx . . $ PicturePtr# picture;
576 XIDcxx . . $ XID# repeat = RepeatNormalcxx . . $ `<external>/2369207440537731940/render.h:206:9`!;
577 int error = 0;
578
579 pixmap = (*screen->CreatePixmapcxx . . $ _Screen#CreatePixmap.)(screen, 1, 1, 32,
580 UXA_CREATE_PIXMAP_FOR_MAPcxx . . $ `src/uxa/uxa.h:555:9`!);
581 if (!pixmap)
582 return 0;
583
584 if (!uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).((DrawablePtrcxx . . $ DrawablePtr#)pixmap, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
585 (*screen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.)(pixmap);
586 return 0;
587 }
588 *((uint32_tcxx . . $ uint32_t# *)pixmap->devPrivatecxx . . $ _Pixmap#devPrivate..ptrcxx . . $ _DevUnion#ptr.) = color;
589 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).((DrawablePtrcxx . . $ DrawablePtr#)pixmap);
590
591 picture = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pixmap->drawablecxx . . $ _Pixmap#drawable.,
592 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen, 32, PICT_a8r8g8b8cxx . . $ PICT_a8r8g8b8.),
593 CPRepeatcxx . . $ `<external>/2369207440537731940/render.h:169:9`!, &repeat, serverClientcxx . . $ serverClient., &error);
594 (*screen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.)(pixmap);
595
596 return picture;
597 }
598
599 static PicturePtrcxx . . $ PicturePtr#
600 uxa_solid_clearcxx . . $ uxa_solid_clear(f2bb66c63077fc11).(ScreenPtrcxx . . $ ScreenPtr# screen)
601 {
602 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
603 PicturePtrcxx . . $ PicturePtr# picture;
604
605 if (!uxa_screen->solid_clearcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_clear.) {
606 uxa_screen->solid_clearcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_clear. = uxa_create_solidcxx . . $ uxa_create_solid(413afeb6eb7c3199).(screen, 0);
607 if (!uxa_screen->solid_clearcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_clear.)
608 return 0;
609 }
610 picture = uxa_screen->solid_clearcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_clear.;
611 return picture;
612 }
613
614 PicturePtrcxx . . $ PicturePtr#
615 uxa_acquire_solidcxx . . $ uxa_acquire_solid(a1d4245718085bf9).(ScreenPtrcxx . . $ ScreenPtr# screen, SourcePictcxx . . $ SourcePict# *source)
616 {
617 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
618 PictSolidFillcxx . . $ PictSolidFill# *solid = &source->solidFillcxx . . $ _SourcePict#solidFill.;
619 PicturePtrcxx . . $ PicturePtr# picture;
620 int i;
621
622 if ((solid->colorcxx . . $ _PictSolidFill#color. >> 24) == 0) {
623 picture = uxa_solid_clearcxx . . $ uxa_solid_clear(f2bb66c63077fc11).(screen);
624 if (!picture)
625 return 0;
626
627 goto DONE;
628 } else if (solid->colorcxx . . $ _PictSolidFill#color. == 0xff000000) {
629 if (!uxa_screen->solid_blackcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_black.) {
630 uxa_screen->solid_blackcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_black. = uxa_create_solidcxx . . $ uxa_create_solid(413afeb6eb7c3199).(screen, 0xff000000);
631 if (!uxa_screen->solid_blackcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_black.)
632 return 0;
633 }
634 picture = uxa_screen->solid_blackcxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_black.;
635 goto DONE;
636 } else if (solid->colorcxx . . $ _PictSolidFill#color. == 0xffffffff) {
637 if (!uxa_screen->solid_whitecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_white.) {
638 uxa_screen->solid_whitecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_white. = uxa_create_solidcxx . . $ uxa_create_solid(413afeb6eb7c3199).(screen, 0xffffffff);
639 if (!uxa_screen->solid_whitecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_white.)
640 return 0;
641 }
642 picture = uxa_screen->solid_whitecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_white.;
643 goto DONE;
644 }
645
646 for (i = 0; i < uxa_screen->solid_cache_sizecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache_size.; i++) {
647 if (uxa_screen->solid_cachecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache.[i].colorcxx . . $ $anonymous_type_38e0ee3db9adc002_1#color. == solid->colorcxx . . $ _PictSolidFill#color.) {
648 picture = uxa_screen->solid_cachecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache.[i].picturecxx . . $ $anonymous_type_38e0ee3db9adc002_1#picture.;
649 goto DONE;
650 }
651 }
652
653 picture = uxa_create_solidcxx . . $ uxa_create_solid(413afeb6eb7c3199).(screen, solid->colorcxx . . $ _PictSolidFill#color.);
654 if (!picture)
655 return 0;
656
657 if (uxa_screen->solid_cache_sizecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache_size. == UXA_NUM_SOLID_CACHEcxx . . $ `src/uxa/uxa-priv.h:111:9`!) {
658 i = randcxx . . $ rand(b126dc7c1de90089).() % UXA_NUM_SOLID_CACHEcxx . . $ `src/uxa/uxa-priv.h:111:9`!;
659 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(uxa_screen->solid_cachecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache.[i].picturecxx . . $ $anonymous_type_38e0ee3db9adc002_1#picture., 0);
660 } else
661 uxa_screen->solid_cache_sizecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache_size.++;
662
663 uxa_screen->solid_cachecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache.[i].picturecxx . . $ $anonymous_type_38e0ee3db9adc002_1#picture. = picture;
664 uxa_screen->solid_cachecxx . . $ $anonymous_type_38e0ee3db9adc002_2#solid_cache.[i].colorcxx . . $ $anonymous_type_38e0ee3db9adc002_1#color. = solid->colorcxx . . $ _PictSolidFill#color.;
665
666 DONE:
667 picture->refcntcxx . . $ _Picture#refcnt.++;
668 return picture;
669 }
670
671 PicturePtrcxx . . $ PicturePtr#
672 uxa_acquire_patterncxx . . $ uxa_acquire_pattern(a5833e34f1c3b0dd).(ScreenPtrcxx . . $ ScreenPtr# pScreen,
673 PicturePtrcxx . . $ PicturePtr# pSrc,
674 pixman_format_code_tcxx . . $ pixman_format_code_t# format,
675 INT16cxx . . $ INT16# x, INT16cxx . . $ INT16# y, CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
676 {
677 PicturePtrcxx . . $ PicturePtr# pDst;
678
679 if (pSrc->pSourcePictcxx . . $ _Picture#pSourcePict.) {
680 SourcePictcxx . . $ SourcePict# *source = pSrc->pSourcePictcxx . . $ _Picture#pSourcePict.;
681 if (source->typecxx . . $ _SourcePict#type. == SourcePictTypeSolidFillcxx . . $ `<external>/920586193036082439/picturestr.h:63:9`!)
682 return uxa_acquire_solidcxx . . $ uxa_acquire_solid(a1d4245718085bf9). (pScreen, source);
683 }
684
685 pDst = uxa_picture_for_pixman_formatcxx . . $ uxa_picture_for_pixman_format(a1c82e78a68cc11b).(pScreen, format, width, height);
686 if (!pDst)
687 return 0;
688
689 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(pDst->pDrawablecxx . . $ _Picture#pDrawable., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
690 fbCompositecxx . . $ fbComposite(842e5d8f7bc57502).(PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`!, pSrc, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, pDst,
691 x, y, 0, 0, 0, 0, width, height);
692 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(pDst->pDrawablecxx . . $ _Picture#pDrawable.);
693 return pDst;
694 } else {
695 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(pDst, 0);
696 return 0;
697 }
698 }
699
700 static Boolcxx . . $ Bool#
701 transform_is_integer_translationcxx . . $ transform_is_integer_translation(9086d0cceb1cfbfc).(PictTransformPtrcxx . . $ PictTransformPtr# t, int *tx, int *ty)
702 {
703 if (t == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
704 *tx = *ty = 0;
705 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
706 }
707
708 if (t->matrixcxx . . $ pixman_transform#matrix.[0][0] != IntToxFixedcxx . . $ `<external>/15484583900196244369/picture.h:203:9`!(1) ||
709 t->matrixcxx . . $ pixman_transform#matrix.[0][1] != 0 ||
710 t->matrixcxx . . $ pixman_transform#matrix.[1][0] != 0 ||
711 t->matrixcxx . . $ pixman_transform#matrix.[1][1] != IntToxFixedcxx . . $ `<external>/15484583900196244369/picture.h:203:9`!(1) ||
712 t->matrixcxx . . $ pixman_transform#matrix.[2][0] != 0 ||
713 t->matrixcxx . . $ pixman_transform#matrix.[2][1] != 0 ||
714 t->matrixcxx . . $ pixman_transform#matrix.[2][2] != IntToxFixedcxx . . $ `<external>/15484583900196244369/picture.h:203:9`!(1))
715 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
716
717 if (xFixedFraccxx . . $ `<external>/15484583900196244369/picture.h:207:9`!(t->matrix[0][2]) != 0 ||
718 xFixedFraccxx . . $ `<external>/15484583900196244369/picture.h:207:9`!(t->matrix[1][2]) != 0)
719 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
720
721 *tx = xFixedToIntcxx . . $ `<external>/15484583900196244369/picture.h:202:9`!(t->matrix[0][2]);
722 *ty = xFixedToIntcxx . . $ `<external>/15484583900196244369/picture.h:202:9`!(t->matrix[1][2]);
723 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
724 }
725
726 static PicturePtrcxx . . $ PicturePtr#
727 uxa_render_picturecxx . . $ uxa_render_picture(a5833e34f1c3b0dd).(ScreenPtrcxx . . $ ScreenPtr# screen,
728 PicturePtrcxx . . $ PicturePtr# src,
729 pixman_format_code_tcxx . . $ pixman_format_code_t# format,
730 INT16cxx . . $ INT16# x, INT16cxx . . $ INT16# y,
731 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
732 {
733 PicturePtrcxx . . $ PicturePtr# picture;
734 int ret = 0;
735
736 /* XXX we need a mechanism for the card to choose the fallback format */
737
738 /* force alpha channel in case source does not entirely cover the extents */
739 if (PIXMAN_FORMAT_Acxx . . $ `<external>/17639638556090915931/pixman.h:1024:9`!(format) == 0)
740 format = PIXMAN_a8r8g8b8cxx . . $ PIXMAN_a8r8g8b8.; /* available on all hardware */
741
742 picture = uxa_picture_for_pixman_formatcxx . . $ uxa_picture_for_pixman_format(a1c82e78a68cc11b).(screen, format, width, height);
743 if (!picture)
744 return 0;
745
746 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(picture->pDrawablecxx . . $ _Picture#pDrawable., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
747 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(src->pDrawablecxx . . $ _Picture#pDrawable., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_ROcxx . . $ UXA_ACCESS_RO.)) {
748 ret = 1;
749 fbCompositecxx . . $ fbComposite(842e5d8f7bc57502).(PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`!, src, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, picture,
750 x, y, 0, 0, 0, 0, width, height);
751 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(src->pDrawablecxx . . $ _Picture#pDrawable.);
752 }
753 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(picture->pDrawablecxx . . $ _Picture#pDrawable.);
754 }
755
756 if (!ret) {
757 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(picture, 0);
758 return 0;
759 }
760
761 return picture;
762 }
763
764 PicturePtrcxx . . $ PicturePtr#
765 uxa_acquire_drawablecxx . . $ uxa_acquire_drawable(1656e4e7aa259a11).(ScreenPtrcxx . . $ ScreenPtr# pScreen,
766 PicturePtrcxx . . $ PicturePtr# pSrc,
767 INT16cxx . . $ INT16# x, INT16cxx . . $ INT16# y,
768 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height,
769 INT16cxx . . $ INT16# * out_x, INT16cxx . . $ INT16# * out_y)
770 {
771 PixmapPtrcxx . . $ PixmapPtr# pPixmap;
772 PicturePtrcxx . . $ PicturePtr# pDst;
773 GCPtrcxx . . $ GCPtr# pGC;
774 int depth, error;
775 int tx, ty;
776
777 depth = pSrc->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth.;
778 if (depth == 1 ||
779 pSrc->filtercxx . . $ _Picture#filter. == PictFilterConvolutioncxx . . $ `<external>/920586193036082439/picturestr.h:180:9`! || /* XXX */
780 !transform_is_integer_translationcxx . . $ transform_is_integer_translation(9086d0cceb1cfbfc).(pSrc->transformcxx . . $ _Picture#transform., &tx, &ty)) {
781 /* XXX extract the sample extents and do the transformation on the GPU */
782 pDst = uxa_render_picturecxx . . $ uxa_render_picture(a5833e34f1c3b0dd).(pScreen, pSrc,
783 pSrc->formatcxx . . $ _Picture#format. | (BitsPerPixelcxx . . $ `<external>/6888719942695738040/servermd.h:109:9`!(pSrc->pDrawable->depth) << 24),
784 x, y, width, height);
785
786 goto done;
787 } else {
788 if (width == pSrc->pDrawablecxx . . $ _Picture#pDrawable.->widthcxx . . $ _Drawable#width. && height == pSrc->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth.) {
789 *out_x = x + pSrc->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
790 *out_y = y + pSrc->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
791 return pSrc;
792 }
793 }
794
795 pPixmap = pScreen->CreatePixmapcxx . . $ _Screen#CreatePixmap.(pScreen,
796 width, height, depth,
797 CREATE_PIXMAP_USAGE_SCRATCHcxx . . $ `<external>/1376006743595286137/scrnintstr.h:181:9`!);
798 if (!pPixmap)
799 return 0;
800
801 /* Skip the copy if the result remains in memory and not a bo */
802 if (!uxa_drawable_is_offscreencxx . . $ uxa_drawable_is_offscreen(653d4fd9ab926f62).(&pPixmap->drawablecxx . . $ _Pixmap#drawable.)) {
803 pScreen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pPixmap);
804 return 0;
805 }
806
807 pGC = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(depth, pScreen);
808 if (!pGC) {
809 pScreen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pPixmap);
810 return 0;
811 }
812
813 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(&pPixmap->drawablecxx . . $ _Pixmap#drawable., pGC);
814 pGC->opscxx . . $ _GC#ops.->CopyAreacxx . . $ _GCOps#CopyArea.(pSrc->pDrawablecxx . . $ _Picture#pDrawable., &pPixmap->drawablecxx . . $ _Pixmap#drawable., pGC,
815 x + tx, y + ty, width, height, 0, 0);
816 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(pGC);
817
818 pDst = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pPixmap->drawablecxx . . $ _Pixmap#drawable.,
819 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(pScreen, depth, pSrc->formatcxx . . $ _Picture#format.),
820 0, 0, serverClientcxx . . $ serverClient., &error);
821 pScreen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pPixmap);
822 ValidatePicturecxx . . $ ValidatePicture(bc938522fd951fa8).(pDst);
823
824 done:
825 pDst->componentAlphacxx . . $ _Picture#componentAlpha. = pSrc->componentAlphacxx . . $ _Picture#componentAlpha.;
826 *out_x = x;
827 *out_y = y;
828 return pDst;
829 }
830
831 static PicturePtrcxx . . $ PicturePtr#
832 uxa_acquire_picturecxx . . $ uxa_acquire_picture(a8b0b69522d70ab3).(ScreenPtrcxx . . $ ScreenPtr# screen,
833 PicturePtrcxx . . $ PicturePtr# src,
834 pixman_format_code_tcxx . . $ pixman_format_code_t# format,
835 INT16cxx . . $ INT16# x, INT16cxx . . $ INT16# y,
836 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height,
837 INT16cxx . . $ INT16# * out_x, INT16cxx . . $ INT16# * out_y)
838 {
839 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
840
841 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_texturecxx . . $ _UxaDriver#check_composite_texture. &&
842 uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_texturecxx . . $ _UxaDriver#check_composite_texture.(screen, src)) {
843 if (src->pDrawablecxx . . $ _Picture#pDrawable.) {
844 *out_x = x + src->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
845 *out_y = y + src->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
846 } else {
847 *out_x = 0;
848 *out_y = 0;
849 }
850 return src;
851 }
852
853 if (src->pDrawablecxx . . $ _Picture#pDrawable.) {
854 PicturePtrcxx . . $ PicturePtr# dst;
855
856 dst = uxa_acquire_drawablecxx . . $ uxa_acquire_drawable(1656e4e7aa259a11).(screen, src,
857 x, y, width, height,
858 out_x, out_y);
859 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_texturecxx . . $ _UxaDriver#check_composite_texture. &&
860 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_texturecxx . . $ _UxaDriver#check_composite_texture.(screen, dst)) {
861 if (dst != src)
862 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(dst, 0);
863 return 0;
864 }
865
866 return dst;
867 }
868
869 *out_x = 0;
870 *out_y = 0;
871 return uxa_acquire_patterncxx . . $ uxa_acquire_pattern(a5833e34f1c3b0dd).(screen, src,
872 format, x, y, width, height);
873 }
874
875 static PicturePtrcxx . . $ PicturePtr#
876 uxa_acquire_sourcecxx . . $ uxa_acquire_source(1656e4e7aa259a11).(ScreenPtrcxx . . $ ScreenPtr# screen,
877 PicturePtrcxx . . $ PicturePtr# pict,
878 INT16cxx . . $ INT16# x, INT16cxx . . $ INT16# y,
879 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height,
880 INT16cxx . . $ INT16# * out_x, INT16cxx . . $ INT16# * out_y)
881 {
882 return uxa_acquire_picturecxx . . $ uxa_acquire_picture(a8b0b69522d70ab3). (screen, pict,
883 PIXMAN_a8r8g8b8cxx . . $ PIXMAN_a8r8g8b8.,
884 x, y,
885 width, height,
886 out_x, out_y);
887 }
888
889 static PicturePtrcxx . . $ PicturePtr#
890 uxa_acquire_maskcxx . . $ uxa_acquire_mask(6ff22e026476ae21).(ScreenPtrcxx . . $ ScreenPtr# screen,
891 PicturePtrcxx . . $ PicturePtr# pict,
892 INT16cxx . . $ INT16# x, INT16cxx . . $ INT16# y,
893 INT16cxx . . $ INT16# width, INT16cxx . . $ INT16# height,
894 INT16cxx . . $ INT16# * out_x, INT16cxx . . $ INT16# * out_y)
895 {
896 return uxa_acquire_picturecxx . . $ uxa_acquire_picture(a8b0b69522d70ab3). (screen, pict,
897 PIXMAN_a8cxx . . $ PIXMAN_a8.,
898 x, y,
899 width, height,
900 out_x, out_y);
901 }
902
903 static Boolcxx . . $ Bool#
904 _pixman_region_init_rectanglescxx . . $ _pixman_region_init_rectangles(9f54c029f58f8fb9).(pixman_region16_tcxx . . $ pixman_region16_t# *region,
905 int num_rects,
906 xRectanglecxx . . $ xRectangle# *rects,
907 int tx, int ty)
908 {
909 pixman_box16_tcxx . . $ pixman_box16_t# stack_boxes[64], *boxes = stack_boxes;
910 pixman_bool_tcxx . . $ pixman_bool_t# ret;
911 int i;
912
913 if (num_rects > sizeof(stack_boxes) / sizeof(stack_boxes[0])) {
914 boxes = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(pixman_box16_tcxx . . $ pixman_box16_t#) * num_rects);
915 if (boxes == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
916 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
917 }
918
919 for (i = 0; i < num_rects; i++) {
920 boxes[i].x1cxx . . $ pixman_box16#x1. = rects[i].xcxx . . $ _xRectangle#x. + tx;
921 boxes[i].y1cxx . . $ pixman_box16#y1. = rects[i].ycxx . . $ _xRectangle#y. + ty;
922 boxes[i].x2cxx . . $ pixman_box16#x2. = rects[i].xcxx . . $ _xRectangle#x. + tx + rects[i].widthcxx . . $ _xRectangle#width.;
923 boxes[i].y2cxx . . $ pixman_box16#y2. = rects[i].ycxx . . $ _xRectangle#y. + ty + rects[i].heightcxx . . $ _xRectangle#height.;
924 }
925
926 ret = pixman_region_init_rectscxx . . $ pixman_region_init_rects(c5e28c5d5714f300).(region, boxes, num_rects);
927
928 if (boxes != stack_boxes)
929 freecxx . . $ free(5d22bdacc48458e8).(boxes);
930
931 return ret;
932 }
933
934 void
935 uxa_solid_rectscxx . . $ uxa_solid_rects(46aed192b798154b). (CARD8cxx . . $ CARD8# op,
936 PicturePtrcxx . . $ PicturePtr# dst,
937 xRenderColorcxx . . $ xRenderColor# *color,
938 int num_rects,
939 xRectanglecxx . . $ xRectangle# *rects)
940 {
941 ScreenPtrcxx . . $ ScreenPtr# screen = dst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.;
942 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
943 PixmapPtrcxx . . $ PixmapPtr# dst_pixmap, src_pixmap = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
944 pixman_region16_tcxx . . $ pixman_region16_t# region;
945 pixman_box16_tcxx . . $ pixman_box16_t# *boxes, *extents;
946 PicturePtrcxx . . $ PicturePtr# src;
947 int dst_x, dst_y;
948 int num_boxes;
949
950 if (!pixman_region_not_emptycxx . . $ pixman_region_not_empty(b2619d5288bc5588).(dst->pCompositeClipcxx . . $ _Picture#pCompositeClip.))
951 return;
952
953 if (dst->alphaMapcxx . . $ _Picture#alphaMap.)
954 goto fallback;
955
956 dst_pixmap = uxa_get_offscreen_pixmapcxx . . $ uxa_get_offscreen_pixmap(fabc0b97bf9e3b7).(dst->pDrawablecxx . . $ _Picture#pDrawable., &dst_x, &dst_y);
957 if (!dst_pixmap)
958 goto fallback;
959
960 if (!_pixman_region_init_rectanglescxx . . $ _pixman_region_init_rectangles(9f54c029f58f8fb9).(&region,
961 num_rects, rects,
962 dst->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x., dst->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.))
963 goto fallback;
964
965 if (!pixman_region_intersectcxx . . $ pixman_region_intersect(435842d10c01995c).(&region, &region, dst->pCompositeClipcxx . . $ _Picture#pCompositeClip.)) {
966 pixman_region_finicxx . . $ pixman_region_fini(353c1b2f50b7675c).(&region);
967 return;
968 }
969
970 /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
971 * manually append the damaged regions ourselves.
972 */
973 DamageRegionAppendcxx . . $ DamageRegionAppend(ea3abe859ef1e42e).(dst->pDrawablecxx . . $ _Picture#pDrawable., &region);
974
975 pixman_region_translatecxx . . $ pixman_region_translate(3d137d1414c3c76d).(&region, dst_x, dst_y);
976 boxes = pixman_region_rectanglescxx . . $ pixman_region_rectangles(aedb766777a11712).(&region, &num_boxes);
977 extents = pixman_region_extentscxx . . $ pixman_region_extents(336fab133eff062b). (&region);
978
979 if (op == PictOpClearcxx . . $ `<external>/2369207440537731940/render.h:93:9`!)
980 color->redcxx . . $ $anonymous_type_d4be3316d06f2656_6#red. = color->greencxx . . $ $anonymous_type_d4be3316d06f2656_6#green. = color->bluecxx . . $ $anonymous_type_d4be3316d06f2656_6#blue. = color->alphacxx . . $ $anonymous_type_d4be3316d06f2656_6#alpha. = 0;
981 if (color->alphacxx . . $ $anonymous_type_d4be3316d06f2656_6#alpha. >= 0xff00 && op == PictOpOvercxx . . $ `<external>/2369207440537731940/render.h:96:9`!) {
982 color->alphacxx . . $ $anonymous_type_d4be3316d06f2656_6#alpha. = 0xffff;
983 op = PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`!;
984 }
985
986 /* Using GEM, the relocation costs outweigh the advantages of the blitter */
987 if (num_boxes == 1 && (op == PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`! || op == PictOpClearcxx . . $ `<external>/2369207440537731940/render.h:93:9`!)) {
988 CARD32cxx . . $ CARD32# pixel;
989
990 try_solid:
991 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_solidcxx . . $ _UxaDriver#check_solid. &&
992 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_solidcxx . . $ _UxaDriver#check_solid.(&dst_pixmap->drawablecxx . . $ _Pixmap#drawable., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!))
993 goto err_region;
994
995 if (!uxa_get_pixel_from_rgbacxx . . $ uxa_get_pixel_from_rgba(13fdbd74698217b0).(&pixel,
996 color->redcxx . . $ $anonymous_type_d4be3316d06f2656_6#red.,
997 color->greencxx . . $ $anonymous_type_d4be3316d06f2656_6#green.,
998 color->bluecxx . . $ $anonymous_type_d4be3316d06f2656_6#blue.,
999 color->alphacxx . . $ $anonymous_type_d4be3316d06f2656_6#alpha.,
1000 dst->formatcxx . . $ _Picture#format.))
1001 goto err_region;
1002
1003 if (!uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->prepare_solidcxx . . $ _UxaDriver#prepare_solid.(dst_pixmap, GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!, pixel))
1004 goto err_region;
1005
1006 while (num_boxes--) {
1007 uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->solidcxx . . $ _UxaDriver#solid.(dst_pixmap,
1008 boxes->x1cxx . . $ pixman_box16#x1., boxes->y1cxx . . $ pixman_box16#y1.,
1009 boxes->x2cxx . . $ pixman_box16#x2., boxes->y2cxx . . $ pixman_box16#y2.);
1010 boxes++;
1011 }
1012
1013 uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->done_solidcxx . . $ _UxaDriver#done_solid.(dst_pixmap);
1014 } else {
1015 int error;
1016
1017 src = CreateSolidPicturecxx . . $ CreateSolidPicture(90f555472db260f1).(0, color, &error);
1018 if (!src)
1019 goto err_region;
1020
1021 if (!uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_compositecxx . . $ _UxaDriver#check_composite.(op, src, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, dst,
1022 extents->x2cxx . . $ pixman_box16#x2. - extents->x1cxx . . $ pixman_box16#x1.,
1023 extents->y2cxx . . $ pixman_box16#y2. - extents->y1cxx . . $ pixman_box16#y1.)) {
1024 if (op == PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`! || op == PictOpClearcxx . . $ `<external>/2369207440537731940/render.h:93:9`!) {
1025 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(src, 0);
1026 goto try_solid;
1027 }
1028
1029 goto err_src;
1030 }
1031
1032 if (!uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_texturecxx . . $ _UxaDriver#check_composite_texture. ||
1033 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_texturecxx . . $ _UxaDriver#check_composite_texture.(screen, src)) {
1034 PicturePtrcxx . . $ PicturePtr# solid;
1035 int src_off_x, src_off_y;
1036
1037 solid = uxa_acquire_solidcxx . . $ uxa_acquire_solid(a1d4245718085bf9).(screen, src->pSourcePictcxx . . $ _Picture#pSourcePict.);
1038 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(src, 0);
1039
1040 src = solid;
1041 src_pixmap = uxa_get_offscreen_pixmapcxx . . $ uxa_get_offscreen_pixmap(fabc0b97bf9e3b7).(src->pDrawablecxx . . $ _Picture#pDrawable.,
1042 &src_off_x, &src_off_y);
1043 if (!src_pixmap)
1044 goto err_src;
1045 }
1046
1047 if (!uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->prepare_compositecxx . . $ _UxaDriver#prepare_composite.(op, src, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, dst, src_pixmap, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, dst_pixmap))
1048 goto err_src;
1049
1050 while (num_boxes--) {
1051 uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->compositecxx . . $ _UxaDriver#composite.(dst_pixmap,
1052 0, 0, 0, 0,
1053 boxes->x1cxx . . $ pixman_box16#x1.,
1054 boxes->y1cxx . . $ pixman_box16#y1.,
1055 boxes->x2cxx . . $ pixman_box16#x2. - boxes->x1cxx . . $ pixman_box16#x1.,
1056 boxes->y2cxx . . $ pixman_box16#y2. - boxes->y1cxx . . $ pixman_box16#y1.);
1057 boxes++;
1058 }
1059
1060 uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->done_compositecxx . . $ _UxaDriver#done_composite.(dst_pixmap);
1061 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(src, 0);
1062 }
1063
1064 pixman_region_finicxx . . $ pixman_region_fini(353c1b2f50b7675c).(&region);
1065 return;
1066
1067 err_src:
1068 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(src, 0);
1069 err_region:
1070 pixman_region_finicxx . . $ pixman_region_fini(353c1b2f50b7675c).(&region);
1071 fallback:
1072 uxa_screen->SavedCompositeRectscxx . . $ $anonymous_type_38e0ee3db9adc002_2#SavedCompositeRects.(op, dst, color, num_rects, rects);
1073 }
1074
1075 static int
1076 uxa_try_driver_compositecxx . . $ uxa_try_driver_composite(5cd7f53e5a0ee9f8).(CARD8cxx . . $ CARD8# op,
1077 PicturePtrcxx . . $ PicturePtr# pSrc,
1078 PicturePtrcxx . . $ PicturePtr# pMask,
1079 PicturePtrcxx . . $ PicturePtr# pDst,
1080 INT16cxx . . $ INT16# xSrc, INT16cxx . . $ INT16# ySrc,
1081 INT16cxx . . $ INT16# xMask, INT16cxx . . $ INT16# yMask,
1082 INT16cxx . . $ INT16# xDst, INT16cxx . . $ INT16# yDst,
1083 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
1084 {
1085 ScreenPtrcxx . . $ ScreenPtr# screen = pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.;
1086 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
1087 RegionReccxx . . $ RegionRec# region;
1088 BoxPtrcxx . . $ BoxPtr# pbox;
1089 int nbox;
1090 int xDst_copy = 0, yDst_copy = 0;
1091 int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
1092 PixmapPtrcxx . . $ PixmapPtr# pSrcPix, pMaskPix = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, pDstPix;
1093 PicturePtrcxx . . $ PicturePtr# localSrc, localMask = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1094 PicturePtrcxx . . $ PicturePtr# localDst = pDst;
1095
1096 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_compositecxx . . $ _UxaDriver#check_composite. &&
1097 !(*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_compositecxx . . $ _UxaDriver#check_composite.) (op, pSrc, pMask, pDst, width, height))
1098 return -1;
1099
1100 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_targetcxx . . $ _UxaDriver#check_composite_target. &&
1101 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_targetcxx . . $ _UxaDriver#check_composite_target.(uxa_get_drawable_pixmapcxx . . $ uxa_get_drawable_pixmap(37fca7f3554b94d5).(pDst->pDrawablecxx . . $ _Picture#pDrawable.))) {
1102 int depth = pDst->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth.;
1103 PixmapPtrcxx . . $ PixmapPtr# pixmap;
1104 int error;
1105 GCPtrcxx . . $ GCPtr# gc;
1106
1107 pixmap = uxa_get_drawable_pixmapcxx . . $ uxa_get_drawable_pixmap(37fca7f3554b94d5).(pDst->pDrawablecxx . . $ _Picture#pDrawable.);
1108 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_copycxx . . $ _UxaDriver#check_copy. &&
1109 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_copycxx . . $ _UxaDriver#check_copy.(pixmap, pixmap, GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!))
1110 return -1;
1111
1112 pixmap = screen->CreatePixmapcxx . . $ _Screen#CreatePixmap.(screen,
1113 width, height, depth,
1114 CREATE_PIXMAP_USAGE_SCRATCHcxx . . $ `<external>/1376006743595286137/scrnintstr.h:181:9`!);
1115 if (!pixmap)
1116 return 0;
1117
1118 gc = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(depth, screen);
1119 if (!gc) {
1120 screen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pixmap);
1121 return 0;
1122 }
1123
1124 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(&pixmap->drawablecxx . . $ _Pixmap#drawable., gc);
1125 gc->opscxx . . $ _GC#ops.->CopyAreacxx . . $ _GCOps#CopyArea.(pDst->pDrawablecxx . . $ _Picture#pDrawable., &pixmap->drawablecxx . . $ _Pixmap#drawable., gc,
1126 xDst, yDst, width, height, 0, 0);
1127 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(gc);
1128
1129 xDst_copy = xDst; xDst = 0;
1130 yDst_copy = yDst; yDst = 0;
1131
1132 localDst = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pixmap->drawablecxx . . $ _Pixmap#drawable.,
1133 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen, depth, pDst->formatcxx . . $ _Picture#format.),
1134 0, 0, serverClientcxx . . $ serverClient., &error);
1135 screen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pixmap);
1136
1137 if (!localDst)
1138 return 0;
1139
1140 ValidatePicturecxx . . $ ValidatePicture(bc938522fd951fa8).(localDst);
1141 }
1142
1143 pDstPix =
1144 uxa_get_offscreen_pixmapcxx . . $ uxa_get_offscreen_pixmap(fabc0b97bf9e3b7).(localDst->pDrawablecxx . . $ _Picture#pDrawable., &dst_off_x, &dst_off_y);
1145 if (!pDstPix) {
1146 if (localDst != pDst)
1147 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1148 return -1;
1149 }
1150
1151 xDst += localDst->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
1152 yDst += localDst->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
1153
1154 localSrc = uxa_acquire_sourcecxx . . $ uxa_acquire_source(1656e4e7aa259a11).(screen, pSrc,
1155 xSrc, ySrc,
1156 width, height,
1157 &xSrc, &ySrc);
1158 if (!localSrc) {
1159 if (localDst != pDst)
1160 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1161 return 0;
1162 }
1163
1164 if (pMask) {
1165 localMask = uxa_acquire_maskcxx . . $ uxa_acquire_mask(6ff22e026476ae21).(screen, pMask,
1166 xMask, yMask,
1167 width, height,
1168 &xMask, &yMask);
1169 if (!localMask) {
1170 if (localSrc != pSrc)
1171 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localSrc, 0);
1172 if (localDst != pDst)
1173 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1174
1175 return 0;
1176 }
1177 }
1178
1179 if (!miComputeCompositeRegioncxx . . $ miComputeCompositeRegion(de2d6d5d4628920b).(&region, localSrc, localMask, localDst,
1180 xSrc, ySrc, xMask, yMask, xDst, yDst,
1181 width, height)) {
1182 if (localSrc != pSrc)
1183 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localSrc, 0);
1184 if (localMask && localMask != pMask)
1185 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localMask, 0);
1186 if (localDst != pDst)
1187 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1188
1189 return 1;
1190 }
1191
1192 if (localSrc->pDrawablecxx . . $ _Picture#pDrawable.) {
1193 pSrcPix = uxa_get_offscreen_pixmapcxx . . $ uxa_get_offscreen_pixmap(fabc0b97bf9e3b7).(localSrc->pDrawablecxx . . $ _Picture#pDrawable.,
1194 &src_off_x, &src_off_y);
1195 if (!pSrcPix) {
1196 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(screen, &region);
1197
1198 if (localSrc != pSrc)
1199 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localSrc, 0);
1200 if (localMask && localMask != pMask)
1201 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localMask, 0);
1202 if (localDst != pDst)
1203 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1204
1205 return 0;
1206 }
1207 } else {
1208 pSrcPix = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1209 }
1210
1211 if (localMask) {
1212 if (localMask->pDrawablecxx . . $ _Picture#pDrawable.) {
1213 pMaskPix = uxa_get_offscreen_pixmapcxx . . $ uxa_get_offscreen_pixmap(fabc0b97bf9e3b7).(localMask->pDrawablecxx . . $ _Picture#pDrawable.,
1214 &mask_off_x, &mask_off_y);
1215 if (!pMaskPix) {
1216 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(screen, &region);
1217
1218 if (localSrc != pSrc)
1219 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localSrc, 0);
1220 if (localMask && localMask != pMask)
1221 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localMask, 0);
1222 if (localDst != pDst)
1223 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1224
1225 return 0;
1226 }
1227 } else {
1228 pMaskPix = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1229 }
1230 }
1231
1232 if (!(*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->prepare_compositecxx . . $ _UxaDriver#prepare_composite.)
1233 (op, localSrc, localMask, localDst, pSrcPix, pMaskPix, pDstPix)) {
1234 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(screen, &region);
1235
1236 if (localSrc != pSrc)
1237 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localSrc, 0);
1238 if (localMask && localMask != pMask)
1239 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localMask, 0);
1240 if (localDst != pDst)
1241 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1242
1243 return -1;
1244 }
1245
1246 if (pMask) {
1247 xMask = xMask + mask_off_x - xDst;
1248 yMask = yMask + mask_off_y - yDst;
1249 }
1250
1251 xSrc = xSrc + src_off_x - xDst;
1252 ySrc = ySrc + src_off_y - yDst;
1253
1254 nbox = REGION_NUM_RECTScxx . . $ `<external>/14128946855725894503/regionstr.h:346:9`!(&region);
1255 pbox = REGION_RECTScxx . . $ `<external>/14128946855725894503/regionstr.h:348:9`!(&region);
1256 while (nbox--) {
1257 (*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->compositecxx . . $ _UxaDriver#composite.) (pDstPix,
1258 pbox->x1cxx . . $ pixman_box16#x1. + xSrc,
1259 pbox->y1cxx . . $ pixman_box16#y1. + ySrc,
1260 pbox->x1cxx . . $ pixman_box16#x1. + xMask,
1261 pbox->y1cxx . . $ pixman_box16#y1. + yMask,
1262 pbox->x1cxx . . $ pixman_box16#x1. + dst_off_x,
1263 pbox->y1cxx . . $ pixman_box16#y1. + dst_off_y,
1264 pbox->x2cxx . . $ pixman_box16#x2. - pbox->x1cxx . . $ pixman_box16#x1.,
1265 pbox->y2cxx . . $ pixman_box16#y2. - pbox->y1cxx . . $ pixman_box16#y1.);
1266 pbox++;
1267 }
1268 (*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->done_compositecxx . . $ _UxaDriver#done_composite.) (pDstPix);
1269
1270 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(screen, &region);
1271
1272 if (localSrc != pSrc)
1273 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localSrc, 0);
1274 if (localMask && localMask != pMask)
1275 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localMask, 0);
1276
1277 if (localDst != pDst) {
1278 GCPtrcxx . . $ GCPtr# gc;
1279
1280 gc = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(pDst->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth., screen);
1281 if (gc) {
1282 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(pDst->pDrawablecxx . . $ _Picture#pDrawable., gc);
1283 gc->opscxx . . $ _GC#ops.->CopyAreacxx . . $ _GCOps#CopyArea.(localDst->pDrawablecxx . . $ _Picture#pDrawable., pDst->pDrawablecxx . . $ _Picture#pDrawable., gc,
1284 0, 0, width, height, xDst_copy, yDst_copy);
1285 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(gc);
1286 }
1287
1288 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1289 }
1290
1291 return 1;
1292 }
1293
1294 /**
1295 * uxa_try_magic_two_pass_composite_helper implements PictOpOver using two passes of
1296 * simpler operations PictOpOutReverse and PictOpAdd. Mainly used for component
1297 * alpha and limited 1-tmu cards.
1298 *
1299 * From http://anholt.livejournal.com/32058.html:
1300 *
1301 * The trouble is that component-alpha rendering requires two different sources
1302 * for blending: one for the source value to the blender, which is the
1303 * per-channel multiplication of source and mask, and one for the source alpha
1304 * for multiplying with the destination channels, which is the multiplication
1305 * of the source channels by the mask alpha. So the equation for Over is:
1306 *
1307 * dst.A = src.A * mask.A + (1 - (src.A * mask.A)) * dst.A
1308 * dst.R = src.R * mask.R + (1 - (src.A * mask.R)) * dst.R
1309 * dst.G = src.G * mask.G + (1 - (src.A * mask.G)) * dst.G
1310 * dst.B = src.B * mask.B + (1 - (src.A * mask.B)) * dst.B
1311 *
1312 * But we can do some simpler operations, right? How about PictOpOutReverse,
1313 * which has a source factor of 0 and dest factor of (1 - source alpha). We
1314 * can get the source alpha value (srca.X = src.A * mask.X) out of the texture
1315 * blenders pretty easily. So we can do a component-alpha OutReverse, which
1316 * gets us:
1317 *
1318 * dst.A = 0 + (1 - (src.A * mask.A)) * dst.A
1319 * dst.R = 0 + (1 - (src.A * mask.R)) * dst.R
1320 * dst.G = 0 + (1 - (src.A * mask.G)) * dst.G
1321 * dst.B = 0 + (1 - (src.A * mask.B)) * dst.B
1322 *
1323 * OK. And if an op doesn't use the source alpha value for the destination
1324 * factor, then we can do the channel multiplication in the texture blenders
1325 * to get the source value, and ignore the source alpha that we wouldn't use.
1326 * We've supported this in the Radeon driver for a long time. An example would
1327 * be PictOpAdd, which does:
1328 *
1329 * dst.A = src.A * mask.A + dst.A
1330 * dst.R = src.R * mask.R + dst.R
1331 * dst.G = src.G * mask.G + dst.G
1332 * dst.B = src.B * mask.B + dst.B
1333 *
1334 * Hey, this looks good! If we do a PictOpOutReverse and then a PictOpAdd right
1335 * after it, we get:
1336 *
1337 * dst.A = src.A * mask.A + ((1 - (src.A * mask.A)) * dst.A)
1338 * dst.R = src.R * mask.R + ((1 - (src.A * mask.R)) * dst.R)
1339 * dst.G = src.G * mask.G + ((1 - (src.A * mask.G)) * dst.G)
1340 * dst.B = src.B * mask.B + ((1 - (src.A * mask.B)) * dst.B)
1341 */
1342
1343 static int
1344 uxa_try_magic_two_pass_composite_helpercxx . . $ uxa_try_magic_two_pass_composite_helper(5cd7f53e5a0ee9f8).(CARD8cxx . . $ CARD8# op,
1345 PicturePtrcxx . . $ PicturePtr# pSrc,
1346 PicturePtrcxx . . $ PicturePtr# pMask,
1347 PicturePtrcxx . . $ PicturePtr# pDst,
1348 INT16cxx . . $ INT16# xSrc, INT16cxx . . $ INT16# ySrc,
1349 INT16cxx . . $ INT16# xMask, INT16cxx . . $ INT16# yMask,
1350 INT16cxx . . $ INT16# xDst, INT16cxx . . $ INT16# yDst,
1351 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
1352 {
1353 ScreenPtrcxx . . $ ScreenPtr# screen = pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.;
1354 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(screen);
1355 PicturePtrcxx . . $ PicturePtr# localDst = pDst;
1356 int xDst_copy = 0, yDst_copy = 0;
1357
1358 assertcxx . . $ `/usr/include/assert.h:118:11`!(op == PictOpOvercxx . . $ `<external>/2369207440537731940/render.h:96:9`!);
1359
1360 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_compositecxx . . $ _UxaDriver#check_composite. &&
1361 (!(*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_compositecxx . . $ _UxaDriver#check_composite.) (PictOpOutReversecxx . . $ `<external>/2369207440537731940/render.h:101:9`!, pSrc,
1362 pMask, pDst, width, height)
1363 || !(*uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_compositecxx . . $ _UxaDriver#check_composite.) (PictOpAddcxx . . $ `<external>/2369207440537731940/render.h:105:9`!, pSrc, pMask,
1364 pDst, width, height))) {
1365 return -1;
1366 }
1367
1368 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_targetcxx . . $ _UxaDriver#check_composite_target. &&
1369 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_composite_targetcxx . . $ _UxaDriver#check_composite_target.(uxa_get_drawable_pixmapcxx . . $ uxa_get_drawable_pixmap(37fca7f3554b94d5).(pDst->pDrawablecxx . . $ _Picture#pDrawable.))) {
1370 int depth = pDst->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth.;
1371 PixmapPtrcxx . . $ PixmapPtr# pixmap;
1372 int error;
1373 GCPtrcxx . . $ GCPtr# gc;
1374
1375 pixmap = uxa_get_drawable_pixmapcxx . . $ uxa_get_drawable_pixmap(37fca7f3554b94d5).(pDst->pDrawablecxx . . $ _Picture#pDrawable.);
1376 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_copycxx . . $ _UxaDriver#check_copy. &&
1377 !uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->check_copycxx . . $ _UxaDriver#check_copy.(pixmap, pixmap, GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!))
1378 return -1;
1379
1380 pixmap = screen->CreatePixmapcxx . . $ _Screen#CreatePixmap.(screen,
1381 width, height, depth,
1382 CREATE_PIXMAP_USAGE_SCRATCHcxx . . $ `<external>/1376006743595286137/scrnintstr.h:181:9`!);
1383 if (!pixmap)
1384 return 0;
1385
1386 gc = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(depth, screen);
1387 if (!gc) {
1388 screen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pixmap);
1389 return 0;
1390 }
1391
1392 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(&pixmap->drawablecxx . . $ _Pixmap#drawable., gc);
1393 gc->opscxx . . $ _GC#ops.->CopyAreacxx . . $ _GCOps#CopyArea.(pDst->pDrawablecxx . . $ _Picture#pDrawable., &pixmap->drawablecxx . . $ _Pixmap#drawable., gc,
1394 xDst, yDst, width, height, 0, 0);
1395 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(gc);
1396
1397 xDst_copy = xDst; xDst = 0;
1398 yDst_copy = yDst; yDst = 0;
1399
1400 localDst = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pixmap->drawablecxx . . $ _Pixmap#drawable.,
1401 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen, depth, pDst->formatcxx . . $ _Picture#format.),
1402 0, 0, serverClientcxx . . $ serverClient., &error);
1403 screen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.(pixmap);
1404
1405 if (!localDst)
1406 return 0;
1407
1408 ValidatePicturecxx . . $ ValidatePicture(bc938522fd951fa8).(localDst);
1409 }
1410
1411 /* Now, we think we should be able to accelerate this operation. First,
1412 * composite the destination to be the destination times the source alpha
1413 * factors.
1414 */
1415 uxa_compositecxx . . $ uxa_composite(842e5d8f7bc57502).(PictOpOutReversecxx . . $ `<external>/2369207440537731940/render.h:101:9`!, pSrc, pMask, localDst,
1416 xSrc, ySrc,
1417 xMask, yMask,
1418 xDst, yDst,
1419 width, height);
1420
1421 /* Then, add in the source value times the destination alpha factors (1.0).
1422 */
1423 uxa_compositecxx . . $ uxa_composite(842e5d8f7bc57502).(PictOpAddcxx . . $ `<external>/2369207440537731940/render.h:105:9`!, pSrc, pMask, localDst,
1424 xSrc, ySrc,
1425 xMask, yMask,
1426 xDst, yDst,
1427 width, height);
1428
1429 if (localDst != pDst) {
1430 GCPtrcxx . . $ GCPtr# gc;
1431
1432 gc = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(pDst->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth., screen);
1433 if (gc) {
1434 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(pDst->pDrawablecxx . . $ _Picture#pDrawable., gc);
1435 gc->opscxx . . $ _GC#ops.->CopyAreacxx . . $ _GCOps#CopyArea.(localDst->pDrawablecxx . . $ _Picture#pDrawable., pDst->pDrawablecxx . . $ _Picture#pDrawable., gc,
1436 0, 0, width, height, xDst_copy, yDst_copy);
1437 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(gc);
1438 }
1439
1440 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(localDst, 0);
1441 }
1442
1443 return 1;
1444 }
1445
1446 static int
1447 compatible_formatscxx . . $ compatible_formats(36f8fe928de54d5c). (CARD8cxx . . $ CARD8# op, PicturePtrcxx . . $ PicturePtr# dst, PicturePtrcxx . . $ PicturePtr# src)
1448 {
1449 if (op == PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`!) {
1450 if (src->formatcxx . . $ _Picture#format. == dst->formatcxx . . $ _Picture#format.)
1451 return 1;
1452
1453 /* Is the destination an alpha-less version of source? */
1454 if (dst->formatcxx . . $ _Picture#format. == PICT_FORMATcxx . . $ `<external>/15484583900196244369/picture.h:41:9`!(PICT_FORMAT_BPPcxx . . $ `<external>/15484583900196244369/picture.h:50:9`!(src->format),
1455 PICT_FORMAT_TYPEcxx . . $ `<external>/15484583900196244369/picture.h:51:9`!(src->format),
1456 0,
1457 PICT_FORMAT_Rcxx . . $ `<external>/15484583900196244369/picture.h:53:9`!(src->format),
1458 PICT_FORMAT_Gcxx . . $ `<external>/15484583900196244369/picture.h:54:9`!(src->format),
1459 PICT_FORMAT_Bcxx . . $ `<external>/15484583900196244369/picture.h:55:9`!(src->format)))
1460 return 1;
1461
1462 /* XXX xrgb is promoted to argb during image upload... */
1463 #if 0
1464 if (dst->format == PICT_a8r8g8b8 && src->format == PICT_x8r8g8b8)
1465 return 1;
1466 #endif
1467 } else if (op == PictOpOvercxx . . $ `<external>/2369207440537731940/render.h:96:9`!) {
1468 if (PICT_FORMAT_Acxx . . $ `<external>/15484583900196244369/picture.h:52:9`!(src->format))
1469 return 0;
1470
1471 return src->formatcxx . . $ _Picture#format. == dst->formatcxx . . $ _Picture#format.;
1472 }
1473
1474 return 0;
1475 }
1476
1477 static int
1478 drawable_containscxx . . $ drawable_contains(79d555e13035ac79). (DrawablePtrcxx . . $ DrawablePtr# drawable, int x, int y, int w, int h)
1479 {
1480 if (x < 0 || y < 0)
1481 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
1482
1483 if (x + w > drawable->widthcxx . . $ _Drawable#width.)
1484 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
1485
1486 if (y + h > drawable->heightcxx . . $ _Drawable#height.)
1487 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
1488
1489 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
1490 }
1491
1492 void
1493 uxa_compositecxx . . $ uxa_composite(842e5d8f7bc57502).(CARD8cxx . . $ CARD8# op,
1494 PicturePtrcxx . . $ PicturePtr# pSrc,
1495 PicturePtrcxx . . $ PicturePtr# pMask,
1496 PicturePtrcxx . . $ PicturePtr# pDst,
1497 INT16cxx . . $ INT16# xSrc, INT16cxx . . $ INT16# ySrc,
1498 INT16cxx . . $ INT16# xMask, INT16cxx . . $ INT16# yMask,
1499 INT16cxx . . $ INT16# xDst, INT16cxx . . $ INT16# yDst,
1500 CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
1501 {
1502 uxa_screen_tcxx . . $ uxa_screen_t# *uxa_screen = uxa_get_screencxx . . $ uxa_get_screen(abdd93f26e57bd53).(pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.);
1503 int ret = -1;
1504 Boolcxx . . $ Bool# saveSrcRepeat = pSrc->repeatcxx . . $ _Picture#repeat.;
1505 Boolcxx . . $ Bool# saveMaskRepeat = pMask ? pMask->repeatcxx . . $ _Picture#repeat. : 0;
1506 RegionReccxx . . $ RegionRec# region;
1507 int tx, ty;
1508
1509 if (uxa_screen->swappedOutcxx . . $ $anonymous_type_38e0ee3db9adc002_2#swappedOut. || uxa_screen->force_fallbackcxx . . $ $anonymous_type_38e0ee3db9adc002_2#force_fallback.)
1510 goto fallback;
1511
1512 if (!uxa_drawable_is_offscreencxx . . $ uxa_drawable_is_offscreen(653d4fd9ab926f62).(pDst->pDrawablecxx . . $ _Picture#pDrawable.))
1513 goto fallback;
1514
1515 if (pDst->alphaMapcxx . . $ _Picture#alphaMap. || pSrc->alphaMapcxx . . $ _Picture#alphaMap. || (pMask && pMask->alphaMapcxx . . $ _Picture#alphaMap.))
1516 goto fallback;
1517
1518 /* Remove repeat in source if useless */
1519 if (pSrc->pDrawablecxx . . $ _Picture#pDrawable. && pSrc->repeatcxx . . $ _Picture#repeat. && pSrc->filtercxx . . $ _Picture#filter. != PictFilterConvolutioncxx . . $ `<external>/920586193036082439/picturestr.h:180:9`! &&
1520 transform_is_integer_translationcxx . . $ transform_is_integer_translation(9086d0cceb1cfbfc).(pSrc->transformcxx . . $ _Picture#transform., &tx, &ty) &&
1521 (pSrc->pDrawablecxx . . $ _Picture#pDrawable.->widthcxx . . $ _Drawable#width. > 1 || pSrc->pDrawablecxx . . $ _Picture#pDrawable.->heightcxx . . $ _Drawable#height. > 1) &&
1522 drawable_containscxx . . $ drawable_contains(79d555e13035ac79).(pSrc->pDrawablecxx . . $ _Picture#pDrawable., xSrc + tx, ySrc + ty, width, height))
1523 pSrc->repeatcxx . . $ _Picture#repeat. = 0;
1524
1525 if (!pMask) {
1526 if (op == PictOpClearcxx . . $ `<external>/2369207440537731940/render.h:93:9`!) {
1527 PicturePtrcxx . . $ PicturePtr# clear = uxa_solid_clearcxx . . $ uxa_solid_clear(f2bb66c63077fc11).(pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.);
1528 if (clear &&
1529 uxa_try_driver_solid_fillcxx . . $ uxa_try_driver_solid_fill(3a15924f2bf7306d).(clear, pDst,
1530 xSrc, ySrc,
1531 xDst, yDst,
1532 width, height) == 1)
1533 goto done;
1534 }
1535
1536 if (pSrc->pDrawablecxx . . $ _Picture#pDrawable. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
1537 if (pSrc->pSourcePictcxx . . $ _Picture#pSourcePict.) {
1538 SourcePictcxx . . $ SourcePict# *source = pSrc->pSourcePictcxx . . $ _Picture#pSourcePict.;
1539 if (source->typecxx . . $ _SourcePict#type. == SourcePictTypeSolidFillcxx . . $ `<external>/920586193036082439/picturestr.h:63:9`!) {
1540 if (op == PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`! ||
1541 (op == PictOpOvercxx . . $ `<external>/2369207440537731940/render.h:96:9`! &&
1542 (source->solidFillcxx . . $ _SourcePict#solidFill..colorcxx . . $ _PictSolidFill#color. & 0xff000000) == 0xff000000)) {
1543 ret = uxa_try_driver_solid_fillcxx . . $ uxa_try_driver_solid_fill(3a15924f2bf7306d).(pSrc, pDst,
1544 xSrc, ySrc,
1545 xDst, yDst,
1546 width, height);
1547 if (ret == 1)
1548 goto done;
1549 }
1550 }
1551 }
1552 } else if (pSrc->pDrawablecxx . . $ _Picture#pDrawable.->widthcxx . . $ _Drawable#width. == 1 &&
1553 pSrc->pDrawablecxx . . $ _Picture#pDrawable.->heightcxx . . $ _Drawable#height. == 1 &&
1554 pSrc->repeatcxx . . $ _Picture#repeat. &&
1555 (op == PictOpSrccxx . . $ `<external>/2369207440537731940/render.h:94:9`! || (op == PictOpOvercxx . . $ `<external>/2369207440537731940/render.h:96:9`! && !PICT_FORMAT_Acxx . . $ `<external>/15484583900196244369/picture.h:52:9`!(pSrc->format)))) {
1556 ret = uxa_try_driver_solid_fillcxx . . $ uxa_try_driver_solid_fill(3a15924f2bf7306d).(pSrc, pDst,
1557 xSrc, ySrc,
1558 xDst, yDst,
1559 width, height);
1560 if (ret == 1)
1561 goto done;
1562 } else if (compatible_formatscxx . . $ compatible_formats(36f8fe928de54d5c). (op, pDst, pSrc) &&
1563 pSrc->filtercxx . . $ _Picture#filter. != PictFilterConvolutioncxx . . $ `<external>/920586193036082439/picturestr.h:180:9`! &&
1564 transform_is_integer_translationcxx . . $ transform_is_integer_translation(9086d0cceb1cfbfc).(pSrc->transformcxx . . $ _Picture#transform., &tx, &ty)) {
1565 if (!pSrc->repeatcxx . . $ _Picture#repeat. &&
1566 drawable_containscxx . . $ drawable_contains(79d555e13035ac79).(pSrc->pDrawablecxx . . $ _Picture#pDrawable.,
1567 xSrc + tx, ySrc + ty,
1568 width, height)) {
1569 xDst += pDst->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
1570 yDst += pDst->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
1571 xSrc += pSrc->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x. + tx;
1572 ySrc += pSrc->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y. + ty;
1573
1574 if (!miComputeCompositeRegioncxx . . $ miComputeCompositeRegion(de2d6d5d4628920b).
1575 (&region, pSrc, pMask, pDst, xSrc, ySrc,
1576 xMask, yMask, xDst, yDst, width, height))
1577 goto done;
1578
1579 uxa_copy_n_to_ncxx . . $ uxa_copy_n_to_n(27a2fb75e8bc06bd).(pSrc->pDrawablecxx . . $ _Picture#pDrawable.,
1580 pDst->pDrawablecxx . . $ _Picture#pDrawable., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
1581 REGION_RECTScxx . . $ `<external>/14128946855725894503/regionstr.h:348:9`!(&region),
1582 REGION_NUM_RECTScxx . . $ `<external>/14128946855725894503/regionstr.h:346:9`!(&region),
1583 xSrc - xDst, ySrc - yDst, FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!,
1584 FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!, 0, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
1585 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen,
1586 &region);
1587 goto done;
1588 } else if (pSrc->repeatcxx . . $ _Picture#repeat. && pSrc->repeatTypecxx . . $ _Picture#repeatType. == RepeatNormalcxx . . $ `<external>/2369207440537731940/render.h:206:9`! &&
1589 pSrc->pDrawablecxx . . $ _Picture#pDrawable.->typecxx . . $ _Drawable#type. == DRAWABLE_PIXMAPcxx . . $ `<external>/16193921217673123569/pixmap.h:56:9`!) {
1590 DDXPointReccxx . . $ DDXPointRec# patOrg;
1591
1592 /* Let's see if the driver can do the repeat
1593 * in one go
1594 */
1595 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->prepare_compositecxx . . $ _UxaDriver#prepare_composite.) {
1596 ret = uxa_try_driver_compositecxx . . $ uxa_try_driver_composite(5cd7f53e5a0ee9f8).(op, pSrc,
1597 pMask, pDst,
1598 xSrc, ySrc,
1599 xMask, yMask,
1600 xDst, yDst,
1601 width, height);
1602 if (ret == 1)
1603 goto done;
1604 }
1605
1606 /* Now see if we can use
1607 * uxa_fill_region_tiled()
1608 */
1609 xDst += pDst->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x.;
1610 yDst += pDst->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y.;
1611 xSrc += pSrc->pDrawablecxx . . $ _Picture#pDrawable.->xcxx . . $ _Drawable#x. + tx;
1612 ySrc += pSrc->pDrawablecxx . . $ _Picture#pDrawable.->ycxx . . $ _Drawable#y. + ty;
1613
1614 if (!miComputeCompositeRegioncxx . . $ miComputeCompositeRegion(de2d6d5d4628920b).
1615 (&region, pSrc, pMask, pDst, xSrc, ySrc,
1616 xMask, yMask, xDst, yDst, width, height))
1617 goto done;
1618
1619 /* pattern origin is the point in the
1620 * destination drawable
1621 * corresponding to (0,0) in the source */
1622 patOrg.xcxx . . $ _xPoint#x. = xDst - xSrc;
1623 patOrg.ycxx . . $ _xPoint#y. = yDst - ySrc;
1624
1625 ret = uxa_fill_region_tiledcxx . . $ uxa_fill_region_tiled(6839623c0ddb9d9e).(pDst->pDrawablecxx . . $ _Picture#pDrawable.,
1626 &region,
1627 (PixmapPtrcxx . . $ PixmapPtr#) pSrc->
1628 pDrawablecxx . . $ _Picture#pDrawable., &patOrg,
1629 FB_ALLONEScxx . . $ `<external>/469613206824382343/fb.h:88:9`!, GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!);
1630
1631 REGION_UNINITcxx . . $ `<external>/14128946855725894503/regionstr.h:371:9`!(pDst->pDrawable->pScreen,
1632 &region);
1633
1634 if (ret)
1635 goto done;
1636 }
1637 }
1638 }
1639
1640 /* Remove repeat in mask if useless */
1641 if (pMask && pMask->pDrawablecxx . . $ _Picture#pDrawable. && pMask->repeatcxx . . $ _Picture#repeat. &&
1642 pMask->filtercxx . . $ _Picture#filter. != PictFilterConvolutioncxx . . $ `<external>/920586193036082439/picturestr.h:180:9`! &&
1643 transform_is_integer_translationcxx . . $ transform_is_integer_translation(9086d0cceb1cfbfc).(pMask->transformcxx . . $ _Picture#transform., &tx, &ty) &&
1644 (pMask->pDrawablecxx . . $ _Picture#pDrawable.->widthcxx . . $ _Drawable#width. > 1 || pMask->pDrawablecxx . . $ _Picture#pDrawable.->heightcxx . . $ _Drawable#height. > 1) &&
1645 drawable_containscxx . . $ drawable_contains(79d555e13035ac79).(pMask->pDrawablecxx . . $ _Picture#pDrawable., xMask + tx, yMask + ty, width, height))
1646 pMask->repeatcxx . . $ _Picture#repeat. = 0;
1647
1648 if (uxa_screen->infocxx . . $ $anonymous_type_38e0ee3db9adc002_2#info.->prepare_compositecxx . . $ _UxaDriver#prepare_composite.) {
1649 Boolcxx . . $ Bool# isSrcSolid;
1650
1651 ret =
1652 uxa_try_driver_compositecxx . . $ uxa_try_driver_composite(5cd7f53e5a0ee9f8).(op, pSrc, pMask, pDst, xSrc, ySrc,
1653 xMask, yMask, xDst, yDst, width,
1654 height);
1655 if (ret == 1)
1656 goto done;
1657
1658 /* For generic masks and solid src pictures, mach64 can do
1659 * Over in two passes, similar to the component-alpha case.
1660 */
1661
1662 isSrcSolid =
1663 pSrc->pDrawablecxx . . $ _Picture#pDrawable. ?
1664 pSrc->pDrawablecxx . . $ _Picture#pDrawable.->widthcxx . . $ _Drawable#width. == 1 &&
1665 pSrc->pDrawablecxx . . $ _Picture#pDrawable.->heightcxx . . $ _Drawable#height. == 1 &&
1666 pSrc->repeatcxx . . $ _Picture#repeat. :
1667 pSrc->pSourcePictcxx . . $ _Picture#pSourcePict. ?
1668 pSrc->pSourcePictcxx . . $ _Picture#pSourcePict.->typecxx . . $ _SourcePict#type. == SourcePictTypeSolidFillcxx . . $ `<external>/920586193036082439/picturestr.h:63:9`! :
1669 0;
1670
1671 /* If we couldn't do the Composite in a single pass, and it
1672 * was a component-alpha Over, see if we can do it in two
1673 * passes with an OutReverse and then an Add.
1674 */
1675 if (ret == -1 && op == PictOpOvercxx . . $ `<external>/2369207440537731940/render.h:96:9`! && pMask &&
1676 (pMask->componentAlphacxx . . $ _Picture#componentAlpha. || isSrcSolid)) {
1677 ret =
1678 uxa_try_magic_two_pass_composite_helpercxx . . $ uxa_try_magic_two_pass_composite_helper(5cd7f53e5a0ee9f8).(op, pSrc,
1679 pMask, pDst,
1680 xSrc, ySrc,
1681 xMask, yMask,
1682 xDst, yDst,
1683 width, height);
1684 if (ret == 1)
1685 goto done;
1686 }
1687
1688 }
1689
1690 fallback:
1691 uxa_print_composite_fallbackcxx . . $ uxa_print_composite_fallback(da667da082ecb617).("uxa_composite",
1692 op, pSrc, pMask, pDst);
1693
1694 uxa_check_compositecxx . . $ uxa_check_composite(842e5d8f7bc57502).(op, pSrc, pMask, pDst, xSrc, ySrc,
1695 xMask, yMask, xDst, yDst, width, height);
1696
1697 done:
1698 pSrc->repeatcxx . . $ _Picture#repeat. = saveSrcRepeat;
1699 if (pMask)
1700 pMask->repeatcxx . . $ _Picture#repeat. = saveMaskRepeat;
1701 }
1702 #endif
1703
1704 /**
1705 * Same as miCreateAlphaPicture, except it uses uxa_check_poly_fill_rect instead
1706 * of PolyFillRect to initialize the pixmap after creating it, to prevent
1707 * the pixmap from being migrated.
1708 *
1709 * See the comments about uxa_trapezoids and uxa_triangles.
1710 */
1711 static PicturePtrcxx . . $ PicturePtr#
1712 uxa_create_alpha_picturecxx . . $ uxa_create_alpha_picture(a20e3f9ce98a634f).(ScreenPtrcxx . . $ ScreenPtr# pScreen,
1713 PicturePtrcxx . . $ PicturePtr# pDst,
1714 PictFormatPtrcxx . . $ PictFormatPtr# pPictFormat, CARD16cxx . . $ CARD16# width, CARD16cxx . . $ CARD16# height)
1715 {
1716 PixmapPtrcxx . . $ PixmapPtr# pPixmap;
1717 PicturePtrcxx . . $ PicturePtr# pPicture;
1718 int error;
1719
1720 if (width > 32767 || height > 32767)
1721 return 0;
1722
1723 if (!pPictFormat) {
1724 if (pDst->polyEdgecxx . . $ _Picture#polyEdge. == PolyEdgeSharpcxx . . $ `<external>/2369207440537731940/render.h:163:9`!)
1725 pPictFormat = PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(pScreen, 1, PICT_a1cxx . . $ PICT_a1.);
1726 else
1727 pPictFormat = PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(pScreen, 8, PICT_a8cxx . . $ PICT_a8.);
1728 if (!pPictFormat)
1729 return 0;
1730 }
1731
1732 pPixmap = (*pScreen->CreatePixmapcxx . . $ _Screen#CreatePixmap.) (pScreen, width, height,
1733 pPictFormat->depthcxx . . $ _PictFormat#depth.,
1734 UXA_CREATE_PIXMAP_FOR_MAPcxx . . $ `src/uxa/uxa.h:555:9`!);
1735 if (!pPixmap)
1736 return 0;
1737 pPicture = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &pPixmap->drawablecxx . . $ _Pixmap#drawable., pPictFormat,
1738 0, 0, serverClientcxx . . $ serverClient., &error);
1739 (*pScreen->DestroyPixmapcxx . . $ _Screen#DestroyPixmap.) (pPixmap);
1740 return pPicture;
1741 }
1742
1743 /**
1744 * uxa_trapezoids is essentially a copy of miTrapezoids that uses
1745 * uxa_create_alpha_picture instead of miCreateAlphaPicture.
1746 *
1747 * The problem with miCreateAlphaPicture is that it calls PolyFillRect
1748 * to initialize the contents after creating the pixmap, which
1749 * causes the pixmap to be moved in for acceleration. The subsequent
1750 * call to RasterizeTrapezoid won't be accelerated however, which
1751 * forces the pixmap to be moved out again.
1752 *
1753 * uxa_create_alpha_picture avoids this roundtrip by using
1754 * uxa_check_poly_fill_rect to initialize the contents.
1755 */
1756 void
1757 uxa_trapezoidscxx . . $ uxa_trapezoids(b799eecf52fec6e0).(CARD8cxx . . $ CARD8# op, PicturePtrcxx . . $ PicturePtr# src, PicturePtrcxx . . $ PicturePtr# dst,
1758 PictFormatPtrcxx . . $ PictFormatPtr# maskFormat, INT16cxx . . $ INT16# xSrc, INT16cxx . . $ INT16# ySrc,
1759 int ntrap, xTrapezoidcxx . . $ xTrapezoid# * traps)
1760 {
1761 ScreenPtrcxx . . $ ScreenPtr# screen = dst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.;
1762 BoxReccxx . . $ BoxRec# bounds;
1763 Boolcxx . . $ Bool# direct;
1764
1765 direct = op == PictOpAddcxx . . $ `<external>/2369207440537731940/render.h:105:9`! && miIsSolidAlphacxx . . $ miIsSolidAlpha(3733fbdf51d434b3).(src);
1766 if (maskFormat || direct) {
1767 miTrapezoidBoundscxx . . $ miTrapezoidBounds(917242408f063a5).(ntrap, traps, &bounds);
1768
1769 if (bounds.y1cxx . . $ pixman_box16#y1. >= bounds.y2cxx . . $ pixman_box16#y2. || bounds.x1cxx . . $ pixman_box16#x1. >= bounds.x2cxx . . $ pixman_box16#x2.)
1770 return;
1771 }
1772
1773 /*
1774 * Check for solid alpha add
1775 */
1776 if (direct) {
1777 DrawablePtrcxx . . $ DrawablePtr# pDraw = dst->pDrawablecxx . . $ _Picture#pDrawable.;
1778 PixmapPtrcxx . . $ PixmapPtr# pixmap = uxa_get_drawable_pixmapcxx . . $ uxa_get_drawable_pixmap(37fca7f3554b94d5).(pDraw);
1779 int xoff, yoff;
1780
1781 uxa_get_drawable_deltascxx . . $ uxa_get_drawable_deltas(4d73e5080d87940b).(pDraw, pixmap, &xoff, &yoff);
1782
1783 xoff += pDraw->xcxx . . $ _Drawable#x.;
1784 yoff += pDraw->ycxx . . $ _Drawable#y.;
1785
1786 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(pDraw, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
1787 PictureScreenPtrcxx . . $ PictureScreenPtr# ps = GetPictureScreencxx . . $ `<external>/920586193036082439/picturestr.h:357:9`!(screen);
1788
1789 for (; ntrap; ntrap--, traps++)
1790 (*ps->RasterizeTrapezoidcxx . . $ _PictureScreen#RasterizeTrapezoid.) (dst, traps, 0, 0);
1791 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(pDraw);
1792 }
1793 } else if (maskFormat) {
1794 PixmapPtrcxx . . $ PixmapPtr# scratch = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1795 PicturePtrcxx . . $ PicturePtr# mask;
1796 INT16cxx . . $ INT16# xDst, yDst;
1797 INT16cxx . . $ INT16# xRel, yRel;
1798 int width, height;
1799 pixman_image_tcxx . . $ pixman_image_t# *image;
1800 pixman_format_code_tcxx . . $ pixman_format_code_t# format;
1801
1802 xDst = traps[0].leftcxx . . $ $anonymous_type_d4be3316d06f2656_10#left..p1cxx . . $ $anonymous_type_d4be3316d06f2656_8#p1..xcxx . . $ $anonymous_type_d4be3316d06f2656_7#x. >> 16;
1803 yDst = traps[0].leftcxx . . $ $anonymous_type_d4be3316d06f2656_10#left..p1cxx . . $ $anonymous_type_d4be3316d06f2656_8#p1..ycxx . . $ $anonymous_type_d4be3316d06f2656_7#y. >> 16;
1804
1805 width = bounds.x2cxx . . $ pixman_box16#x2. - bounds.x1cxx . . $ pixman_box16#x1.;
1806 height = bounds.y2cxx . . $ pixman_box16#y2. - bounds.y1cxx . . $ pixman_box16#y1.;
1807
1808 format = maskFormat->formatcxx . . $ _PictFormat#format. |
1809 (BitsPerPixelcxx . . $ `<external>/6888719942695738040/servermd.h:109:9`!(maskFormat->depth) << 24);
1810 image =
1811 pixman_image_create_bitscxx . . $ pixman_image_create_bits(7aecbb5f67bee13).(format, width, height, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, 0);
1812 if (!image)
1813 return;
1814
1815 for (; ntrap; ntrap--, traps++)
1816 pixman_rasterize_trapezoidcxx . . $ pixman_rasterize_trapezoid(9d1abdd3f906ac20).(image,
1817 (pixman_trapezoid_tcxx . . $ pixman_trapezoid_t# *) traps,
1818 -bounds.x1cxx . . $ pixman_box16#x1., -bounds.y1cxx . . $ pixman_box16#y1.);
1819 if (uxa_drawable_is_offscreencxx . . $ uxa_drawable_is_offscreen(653d4fd9ab926f62).(dst->pDrawablecxx . . $ _Picture#pDrawable.)) {
1820 mask = uxa_picture_from_pixman_imagecxx . . $ uxa_picture_from_pixman_image(6e446f5f405fc899).(screen, image, format);
1821 } else {
1822 int error;
1823
1824 scratch = GetScratchPixmapHeadercxx . . $ GetScratchPixmapHeader(a3242d3456af3d86).(screen, width, height,
1825 PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format),
1826 PIXMAN_FORMAT_BPPcxx . . $ `<external>/17639638556090915931/pixman.h:1021:9`!(format),
1827 pixman_image_get_stridecxx . . $ pixman_image_get_stride(1233b5bf7ad32299).(image),
1828 pixman_image_get_datacxx . . $ pixman_image_get_data(d654764b2964478d).(image));
1829 mask = CreatePicturecxx . . $ CreatePicture(f47001d5eb332be6).(0, &scratch->drawablecxx . . $ _Pixmap#drawable.,
1830 PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen,
1831 PIXMAN_FORMAT_DEPTHcxx . . $ `<external>/17639638556090915931/pixman.h:1030:9`!(format),
1832 format),
1833 0, 0, serverClientcxx . . $ serverClient., &error);
1834 }
1835 if (!mask) {
1836 if (scratch)
1837 FreeScratchPixmapHeadercxx . . $ FreeScratchPixmapHeader(2f6e21ec3a00cbb6).(scratch);
1838 pixman_image_unrefcxx . . $ pixman_image_unref(1233b5bf7ad32299).(image);
1839 return;
1840 }
1841
1842 xRel = bounds.x1cxx . . $ pixman_box16#x1. + xSrc - xDst;
1843 yRel = bounds.y1cxx . . $ pixman_box16#y1. + ySrc - yDst;
1844 CompositePicturecxx . . $ CompositePicture(842e5d8f7bc57502).(op, src, mask, dst,
1845 xRel, yRel,
1846 0, 0,
1847 bounds.x1cxx . . $ pixman_box16#x1., bounds.y1cxx . . $ pixman_box16#y1.,
1848 width, height);
1849 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(mask, 0);
1850
1851 if (scratch)
1852 FreeScratchPixmapHeadercxx . . $ FreeScratchPixmapHeader(2f6e21ec3a00cbb6).(scratch);
1853 pixman_image_unrefcxx . . $ pixman_image_unref(1233b5bf7ad32299).(image);
1854 } else {
1855 if (dst->polyEdgecxx . . $ _Picture#polyEdge. == PolyEdgeSharpcxx . . $ `<external>/2369207440537731940/render.h:163:9`!)
1856 maskFormat = PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen, 1, PICT_a1cxx . . $ PICT_a1.);
1857 else
1858 maskFormat = PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(screen, 8, PICT_a8cxx . . $ PICT_a8.);
1859 for (; ntrap; ntrap--, traps++)
1860 uxa_trapezoidscxx . . $ uxa_trapezoids(b799eecf52fec6e0).(op, src, dst, maskFormat, xSrc, ySrc,
1861 1, traps);
1862 }
1863 }
1864
1865 /**
1866 * uxa_triangles is essentially a copy of miTriangles that uses
1867 * uxa_create_alpha_picture instead of miCreateAlphaPicture.
1868 *
1869 * The problem with miCreateAlphaPicture is that it calls PolyFillRect
1870 * to initialize the contents after creating the pixmap, which
1871 * causes the pixmap to be moved in for acceleration. The subsequent
1872 * call to AddTriangles won't be accelerated however, which forces the pixmap
1873 * to be moved out again.
1874 *
1875 * uxa_create_alpha_picture avoids this roundtrip by using
1876 * uxa_check_poly_fill_rect to initialize the contents.
1877 */
1878 void
1879 uxa_trianglescxx . . $ uxa_triangles(6d3f6e8e923ce4b4).(CARD8cxx . . $ CARD8# op, PicturePtrcxx . . $ PicturePtr# pSrc, PicturePtrcxx . . $ PicturePtr# pDst,
1880 PictFormatPtrcxx . . $ PictFormatPtr# maskFormat, INT16cxx . . $ INT16# xSrc, INT16cxx . . $ INT16# ySrc,
1881 int ntri, xTrianglecxx . . $ xTriangle# * tris)
1882 {
1883 ScreenPtrcxx . . $ ScreenPtr# pScreen = pDst->pDrawablecxx . . $ _Picture#pDrawable.->pScreencxx . . $ _Drawable#pScreen.;
1884 PictureScreenPtrcxx . . $ PictureScreenPtr# ps = GetPictureScreencxx . . $ `<external>/920586193036082439/picturestr.h:357:9`!(pScreen);
1885 BoxReccxx . . $ BoxRec# bounds;
1886 Boolcxx . . $ Bool# direct = op == PictOpAddcxx . . $ `<external>/2369207440537731940/render.h:105:9`! && miIsSolidAlphacxx . . $ miIsSolidAlpha(3733fbdf51d434b3).(pSrc);
1887
1888 if (maskFormat || direct) {
1889 miTriangleBoundscxx . . $ miTriangleBounds(af3afcf3173678d5).(ntri, tris, &bounds);
1890
1891 if (bounds.y1cxx . . $ pixman_box16#y1. >= bounds.y2cxx . . $ pixman_box16#y2. || bounds.x1cxx . . $ pixman_box16#x1. >= bounds.x2cxx . . $ pixman_box16#x2.)
1892 return;
1893 }
1894
1895 /*
1896 * Check for solid alpha add
1897 */
1898 if (direct) {
1899 DrawablePtrcxx . . $ DrawablePtr# pDraw = pDst->pDrawablecxx . . $ _Picture#pDrawable.;
1900 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(pDraw, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
1901 (*ps->AddTrianglescxx . . $ _PictureScreen#AddTriangles.) (pDst, 0, 0, ntri, tris);
1902 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(pDraw);
1903 }
1904 } else if (maskFormat) {
1905 PicturePtrcxx . . $ PicturePtr# pPicture;
1906 INT16cxx . . $ INT16# xDst, yDst;
1907 INT16cxx . . $ INT16# xRel, yRel;
1908 int width = bounds.x2cxx . . $ pixman_box16#x2. - bounds.x1cxx . . $ pixman_box16#x1.;
1909 int height = bounds.y2cxx . . $ pixman_box16#y2. - bounds.y1cxx . . $ pixman_box16#y1.;
1910 GCPtrcxx . . $ GCPtr# pGC;
1911 xRectanglecxx . . $ xRectangle# rect;
1912
1913 xDst = tris[0].p1cxx . . $ $anonymous_type_d4be3316d06f2656_9#p1..xcxx . . $ $anonymous_type_d4be3316d06f2656_7#x. >> 16;
1914 yDst = tris[0].p1cxx . . $ $anonymous_type_d4be3316d06f2656_9#p1..ycxx . . $ $anonymous_type_d4be3316d06f2656_7#y. >> 16;
1915
1916 pPicture = uxa_create_alpha_picturecxx . . $ uxa_create_alpha_picture(a20e3f9ce98a634f).(pScreen, pDst, maskFormat,
1917 width, height);
1918 if (!pPicture)
1919 return;
1920
1921 /* Clear the alpha picture to 0. */
1922 pGC = GetScratchGCcxx . . $ GetScratchGC(44bf9445c2078010).(pPicture->pDrawablecxx . . $ _Picture#pDrawable.->depthcxx . . $ _Drawable#depth., pScreen);
1923 if (!pGC) {
1924 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(pPicture, 0);
1925 return;
1926 }
1927 ValidateGCcxx . . $ ValidateGC(846eadd374091791).(pPicture->pDrawablecxx . . $ _Picture#pDrawable., pGC);
1928 rect.xcxx . . $ _xRectangle#x. = 0;
1929 rect.ycxx . . $ _xRectangle#y. = 0;
1930 rect.widthcxx . . $ _xRectangle#width. = width;
1931 rect.heightcxx . . $ _xRectangle#height. = height;
1932 uxa_check_poly_fill_rectcxx . . $ uxa_check_poly_fill_rect(d6f64512319f08ab).(pPicture->pDrawablecxx . . $ _Picture#pDrawable., pGC, 1, &rect);
1933 FreeScratchGCcxx . . $ FreeScratchGC(e7809960d98f6890).(pGC);
1934
1935 if (uxa_prepare_accesscxx . . $ uxa_prepare_access(e713a049538fd1ac).(pPicture->pDrawablecxx . . $ _Picture#pDrawable., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, UXA_ACCESS_RWcxx . . $ UXA_ACCESS_RW.)) {
1936 (*ps->AddTrianglescxx . . $ _PictureScreen#AddTriangles.) (pPicture, -bounds.x1cxx . . $ pixman_box16#x1., -bounds.y1cxx . . $ pixman_box16#y1.,
1937 ntri, tris);
1938 uxa_finish_accesscxx . . $ uxa_finish_access(ad6b53353c30a3f6).(pPicture->pDrawablecxx . . $ _Picture#pDrawable.);
1939 }
1940
1941 xRel = bounds.x1cxx . . $ pixman_box16#x1. + xSrc - xDst;
1942 yRel = bounds.y1cxx . . $ pixman_box16#y1. + ySrc - yDst;
1943 CompositePicturecxx . . $ CompositePicture(842e5d8f7bc57502).(op, pSrc, pPicture, pDst,
1944 xRel, yRel, 0, 0, bounds.x1cxx . . $ pixman_box16#x1., bounds.y1cxx . . $ pixman_box16#y1.,
1945 bounds.x2cxx . . $ pixman_box16#x2. - bounds.x1cxx . . $ pixman_box16#x1., bounds.y2cxx . . $ pixman_box16#y2. - bounds.y1cxx . . $ pixman_box16#y1.);
1946 FreePicturecxx . . $ FreePicture(6fe7d876f9648735).(pPicture, 0);
1947 } else {
1948 if (pDst->polyEdgecxx . . $ _Picture#polyEdge. == PolyEdgeSharpcxx . . $ `<external>/2369207440537731940/render.h:163:9`!)
1949 maskFormat = PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(pScreen, 1, PICT_a1cxx . . $ PICT_a1.);
1950 else
1951 maskFormat = PictureMatchFormatcxx . . $ PictureMatchFormat(5efec2175191ef14).(pScreen, 8, PICT_a8cxx . . $ PICT_a8.);
1952
1953 for (; ntri; ntri--, tris++)
1954 uxa_trianglescxx . . $ uxa_triangles(6d3f6e8e923ce4b4).(op, pSrc, pDst, maskFormat, xSrc, ySrc, 1,
1955 tris);
1956 }
1957 }