… | |
… | |
20 | * You should have received a copy of the GNU General Public License |
20 | * You should have received a copy of the GNU General Public License |
21 | * along with this program; if not, write to the Free Software |
21 | * along with this program; if not, write to the Free Software |
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
23 | *---------------------------------------------------------------------*/ |
23 | *---------------------------------------------------------------------*/ |
24 | |
24 | |
25 | #include <cmath> |
25 | #include <math.h> |
26 | #include "../config.h" /* NECESSARY */ |
26 | #include "../config.h" /* NECESSARY */ |
27 | #include "rxvt.h" /* NECESSARY */ |
27 | #include "rxvt.h" /* NECESSARY */ |
28 | |
28 | |
29 | #if XRENDER |
29 | #if XRENDER |
30 | # include <X11/extensions/Xrender.h> |
30 | # include <X11/extensions/Xrender.h> |
… | |
… | |
32 | |
32 | |
33 | #ifndef FilterConvolution |
33 | #ifndef FilterConvolution |
34 | #define FilterConvolution "convolution" |
34 | #define FilterConvolution "convolution" |
35 | #endif |
35 | #endif |
36 | |
36 | |
37 | /* |
37 | #ifndef RepeatPad |
38 | * Pixmap geometry string interpretation : |
38 | #define RepeatPad True |
39 | * Each geometry string contains zero or one scale/position |
39 | #endif |
40 | * adjustment and may optionally be followed by a colon and one or more |
|
|
41 | * colon-delimited pixmap operations. |
|
|
42 | * The following table shows the valid geometry strings and their |
|
|
43 | * effects on the background image : |
|
|
44 | * |
|
|
45 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
|
|
46 | * W and H are percentages of the terminal window size. |
|
|
47 | * X and Y are also percentages; e.g., +50+50 centers |
|
|
48 | * the image in the window. |
|
|
49 | * |
|
|
50 | * Pixmap Operations : (should be prepended by a colon) |
|
|
51 | */ |
|
|
52 | |
40 | |
53 | #ifdef HAVE_BG_PIXMAP |
41 | #ifdef HAVE_BG_PIXMAP |
|
|
42 | # if XRENDER |
|
|
43 | static Picture |
|
|
44 | create_xrender_mask (Display *dpy, Drawable drawable, Bool argb, Bool component_alpha) |
|
|
45 | { |
|
|
46 | Pixmap pixmap = XCreatePixmap (dpy, drawable, 1, 1, argb ? 32 : 8); |
|
|
47 | |
|
|
48 | XRenderPictFormat *format = XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8); |
|
|
49 | XRenderPictureAttributes pa; |
|
|
50 | pa.repeat = True; |
|
|
51 | pa.component_alpha = component_alpha; |
|
|
52 | Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat | CPComponentAlpha, &pa); |
|
|
53 | |
|
|
54 | XFreePixmap (dpy, pixmap); |
|
|
55 | |
|
|
56 | return mask; |
|
|
57 | } |
|
|
58 | # endif |
|
|
59 | |
54 | void |
60 | void |
55 | rxvt_term::bg_destroy () |
61 | rxvt_term::bg_destroy () |
56 | { |
62 | { |
57 | #ifdef HAVE_AFTERIMAGE |
|
|
58 | if (original_asim) |
|
|
59 | safe_asimage_destroy (original_asim); |
|
|
60 | if (asv) |
|
|
61 | destroy_asvisual (asv, 0); |
|
|
62 | if (asimman) |
|
|
63 | destroy_image_manager (asimman, 0); |
|
|
64 | #endif |
|
|
65 | |
|
|
66 | #ifdef HAVE_PIXBUF |
63 | #ifdef HAVE_PIXBUF |
67 | if (pixbuf) |
64 | if (pixbuf) |
68 | g_object_unref (pixbuf); |
65 | g_object_unref (pixbuf); |
69 | #endif |
66 | #endif |
70 | |
67 | |
… | |
… | |
123 | |
120 | |
124 | return false; |
121 | return false; |
125 | } |
122 | } |
126 | |
123 | |
127 | # ifdef BG_IMAGE_FROM_FILE |
124 | # ifdef BG_IMAGE_FROM_FILE |
128 | static inline bool |
|
|
129 | check_set_scale_value (int geom_flags, int flag, unsigned int &scale, unsigned int new_value) |
|
|
130 | { |
|
|
131 | if (geom_flags & flag) |
|
|
132 | { |
|
|
133 | if (new_value > 1000) |
|
|
134 | new_value = 1000; |
|
|
135 | if (new_value != scale) |
|
|
136 | { |
|
|
137 | scale = new_value; |
|
|
138 | return true; |
|
|
139 | } |
|
|
140 | } |
|
|
141 | return false; |
|
|
142 | } |
|
|
143 | |
|
|
144 | static inline bool |
|
|
145 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
|
|
146 | { |
|
|
147 | if (geom_flags & flag) |
|
|
148 | { |
|
|
149 | if (new_value < -100) |
|
|
150 | new_value = -100; |
|
|
151 | else if (new_value > 200) |
|
|
152 | new_value = 200; |
|
|
153 | if (new_value != align) |
|
|
154 | { |
|
|
155 | align = new_value; |
|
|
156 | return true; |
|
|
157 | } |
|
|
158 | } |
|
|
159 | return false; |
|
|
160 | } |
|
|
161 | |
|
|
162 | static inline int |
125 | static inline int |
163 | make_align_position (int align, int window_size, int image_size) |
126 | make_align_position (int align, int window_size, int image_size) |
164 | { |
127 | { |
165 | int diff = window_size - image_size; |
128 | int diff = window_size - image_size; |
166 | int smaller = min (image_size, window_size); |
129 | int smaller = min (image_size, window_size); |
167 | |
130 | |
168 | if (align >= 0 && align <= 100) |
131 | if (align >= 0 && align <= 100) |
169 | return diff * align / 100; |
132 | return diff * align / 100; |
170 | else if (align > 100 && align <= 200) |
133 | else if (align > 100 && align <= 200) |
171 | return ((align - 100) * smaller / 100) + window_size - smaller; |
134 | return (align - 100) * smaller / 100 + window_size - smaller; |
172 | else if (align >= -100 && align < 0) |
135 | else if (align >= -100 && align < 0) |
173 | return ((align + 100) * smaller / 100) - image_size; |
136 | return (align + 100) * smaller / 100 - image_size; |
174 | return 0; |
137 | return 0; |
175 | } |
138 | } |
176 | |
139 | |
177 | static inline int |
140 | static inline int |
178 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
141 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
… | |
… | |
185 | src_pos = -pos; |
148 | src_pos = -pos; |
186 | dst_pos = 0; |
149 | dst_pos = 0; |
187 | dst_size += pos; |
150 | dst_size += pos; |
188 | } |
151 | } |
189 | |
152 | |
190 | if (dst_pos + dst_size > target_size) |
|
|
191 | dst_size = target_size - dst_pos; |
153 | min_it (dst_size, target_size - dst_pos); |
192 | return src_pos; |
154 | return src_pos; |
193 | } |
155 | } |
194 | |
156 | |
195 | bool |
157 | bool |
196 | rxvt_term::bg_set_geometry (const char *geom, bool update) |
158 | rxvt_term::bg_set_geometry (const char *geom, bool update) |
197 | { |
159 | { |
198 | bool changed = false; |
160 | bool changed = false; |
199 | int geom_flags = 0; |
161 | int geom_flags = 0; |
200 | int x = 0, y = 0; |
162 | int x = h_align; |
|
|
163 | int y = v_align; |
201 | unsigned int w = 0, h = 0; |
164 | unsigned int w = h_scale; |
202 | unsigned long new_flags = (bg_flags & (~BG_GEOMETRY_FLAGS)); |
165 | unsigned int h = v_scale; |
|
|
166 | unsigned long new_flags = 0; |
203 | |
167 | |
204 | if (geom == NULL) |
168 | if (geom == NULL) |
205 | return false; |
169 | return false; |
206 | |
170 | |
207 | if (geom[0]) |
171 | if (geom[0]) |
208 | { |
172 | { |
209 | char **arr = rxvt_strsplit (':', geom); |
173 | char **arr = rxvt_strsplit (':', geom); |
210 | |
174 | |
211 | for (int i = 0; arr[i]; i++) |
175 | for (int i = 0; arr[i]; i++) |
212 | { |
176 | { |
213 | if (!strcasecmp (arr[i], "style=tiled")) |
177 | if (!strcasecmp (arr[i], "style=tiled")) |
214 | { |
178 | { |
215 | new_flags = BG_TILE; |
179 | new_flags = BG_TILE; |
216 | w = h = noScale; |
180 | w = h = noScale; |
217 | x = y = 0; |
181 | x = y = 0; |
218 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
182 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
219 | } |
183 | } |
220 | else if (!strcasecmp (arr[i], "style=aspect-stretched")) |
184 | else if (!strcasecmp (arr[i], "style=aspect-stretched")) |
221 | { |
185 | { |
222 | new_flags = BG_PROP_SCALE; |
186 | new_flags = BG_KEEP_ASPECT; |
|
|
187 | w = h = windowScale; |
223 | x = y = centerAlign; |
188 | x = y = centerAlign; |
224 | geom_flags = XValue|YValue; |
189 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
225 | } |
190 | } |
226 | else if (!strcasecmp (arr[i], "style=stretched")) |
191 | else if (!strcasecmp (arr[i], "style=stretched")) |
227 | { |
192 | { |
228 | new_flags = 0; |
193 | new_flags = 0; |
229 | w = h = windowScale; |
194 | w = h = windowScale; |
… | |
… | |
242 | w = h = noScale; |
207 | w = h = noScale; |
243 | geom_flags = WidthValue|HeightValue; |
208 | geom_flags = WidthValue|HeightValue; |
244 | } |
209 | } |
245 | else if (!strcasecmp (arr[i], "op=tile")) |
210 | else if (!strcasecmp (arr[i], "op=tile")) |
246 | new_flags |= BG_TILE; |
211 | new_flags |= BG_TILE; |
247 | else if (!strcasecmp (arr[i], "op=pscale")) |
212 | else if (!strcasecmp (arr[i], "op=keep-aspect")) |
248 | new_flags |= BG_PROP_SCALE; |
213 | new_flags |= BG_KEEP_ASPECT; |
249 | else if (!strcasecmp (arr[i], "op=root")) |
214 | else if (!strcasecmp (arr[i], "op=root-align")) |
250 | new_flags |= BG_ROOT_ALIGN; |
215 | new_flags |= BG_ROOT_ALIGN; |
251 | |
216 | |
252 | // deprecated |
217 | // deprecated |
253 | else if (!strcasecmp (arr[i], "tile")) |
218 | else if (!strcasecmp (arr[i], "tile")) |
254 | { |
219 | { |
… | |
… | |
256 | w = h = noScale; |
221 | w = h = noScale; |
257 | geom_flags |= WidthValue|HeightValue; |
222 | geom_flags |= WidthValue|HeightValue; |
258 | } |
223 | } |
259 | else if (!strcasecmp (arr[i], "propscale")) |
224 | else if (!strcasecmp (arr[i], "propscale")) |
260 | { |
225 | { |
261 | new_flags |= BG_PROP_SCALE; |
226 | new_flags |= BG_KEEP_ASPECT; |
|
|
227 | w = h = windowScale; |
|
|
228 | geom_flags |= WidthValue|HeightValue; |
262 | } |
229 | } |
263 | else if (!strcasecmp (arr[i], "hscale")) |
230 | else if (!strcasecmp (arr[i], "hscale")) |
264 | { |
231 | { |
265 | new_flags |= BG_TILE; |
232 | new_flags |= BG_TILE; |
266 | w = windowScale; |
233 | w = windowScale; |
… | |
… | |
296 | geom_flags |= XParseGeometry (arr[i], &x, &y, &w, &h); |
263 | geom_flags |= XParseGeometry (arr[i], &x, &y, &w, &h); |
297 | } /* done parsing ops */ |
264 | } /* done parsing ops */ |
298 | |
265 | |
299 | rxvt_free_strsplit (arr); |
266 | rxvt_free_strsplit (arr); |
300 | } |
267 | } |
|
|
268 | |
|
|
269 | new_flags |= bg_flags & ~BG_GEOMETRY_FLAGS; |
301 | |
270 | |
302 | if (!update) |
271 | if (!update) |
303 | { |
272 | { |
304 | if (!(geom_flags & XValue)) |
273 | if (!(geom_flags & XValue)) |
305 | x = y = defaultAlign; |
274 | x = y = defaultAlign; |
… | |
… | |
310 | w = h = defaultScale; |
279 | w = h = defaultScale; |
311 | else if (!(geom_flags & HeightValue)) |
280 | else if (!(geom_flags & HeightValue)) |
312 | h = w; |
281 | h = w; |
313 | else if (!(geom_flags & WidthValue)) |
282 | else if (!(geom_flags & WidthValue)) |
314 | w = h; |
283 | w = h; |
315 | |
|
|
316 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
|
|
317 | } |
284 | } |
318 | |
285 | |
319 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; |
286 | min_it (w, 1000); |
320 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true; |
287 | min_it (h, 1000); |
321 | if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true; |
288 | clamp_it (x, -100, 200); |
322 | if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true; |
289 | clamp_it (y, -100, 200); |
323 | |
290 | |
324 | if (new_flags != bg_flags) |
291 | if (bg_flags != new_flags |
|
|
292 | || h_scale != w |
|
|
293 | || v_scale != h |
|
|
294 | || h_align != x |
|
|
295 | || v_align != y) |
325 | { |
296 | { |
326 | bg_flags = new_flags; |
297 | bg_flags = new_flags; |
|
|
298 | h_scale = w; |
|
|
299 | v_scale = h; |
|
|
300 | h_align = x; |
|
|
301 | v_align = y; |
327 | changed = true; |
302 | changed = true; |
328 | } |
303 | } |
329 | |
304 | |
330 | return changed; |
305 | return changed; |
331 | } |
306 | } |
… | |
… | |
334 | rxvt_term::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
309 | rxvt_term::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
335 | { |
310 | { |
336 | int target_width = szHint.width; |
311 | int target_width = szHint.width; |
337 | int target_height = szHint.height; |
312 | int target_height = szHint.height; |
338 | |
313 | |
|
|
314 | w = h_scale * target_width / 100; |
|
|
315 | h = v_scale * target_height / 100; |
|
|
316 | |
339 | if (bg_flags & BG_PROP_SCALE) |
317 | if (bg_flags & BG_KEEP_ASPECT) |
340 | { |
318 | { |
341 | float scale = (float)target_width / image_width; |
319 | float scale = (float)w / image_width; |
342 | min_it (scale, (float)target_height / image_height); |
320 | min_it (scale, (float)h / image_height); |
343 | w = image_width * scale + 0.5; |
321 | w = image_width * scale + 0.5; |
344 | h = image_height * scale + 0.5; |
322 | h = image_height * scale + 0.5; |
345 | } |
323 | } |
346 | else |
|
|
347 | { |
|
|
348 | w = h_scale * target_width / 100; |
|
|
349 | h = v_scale * target_height / 100; |
|
|
350 | } |
|
|
351 | |
324 | |
352 | if (!w) w = image_width; |
325 | if (!w) w = image_width; |
353 | if (!h) h = image_height; |
326 | if (!h) h = image_height; |
354 | |
327 | |
355 | if (bg_flags & BG_ROOT_ALIGN) |
328 | if (bg_flags & BG_ROOT_ALIGN) |
… | |
… | |
363 | y = make_align_position (v_align, target_height, h); |
336 | y = make_align_position (v_align, target_height, h); |
364 | } |
337 | } |
365 | |
338 | |
366 | bg_flags &= ~BG_IS_SIZE_SENSITIVE; |
339 | bg_flags &= ~BG_IS_SIZE_SENSITIVE; |
367 | if (!(bg_flags & BG_TILE) |
340 | if (!(bg_flags & BG_TILE) |
368 | || (bg_flags & BG_PROP_SCALE) || h_scale || v_scale |
341 | || h_scale || v_scale |
369 | || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) |
342 | || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) |
370 | || w > target_width || h > target_height) |
343 | || w > target_width || h > target_height) |
371 | bg_flags |= BG_IS_SIZE_SENSITIVE; |
344 | bg_flags |= BG_IS_SIZE_SENSITIVE; |
372 | } |
345 | } |
373 | |
|
|
374 | # ifdef HAVE_AFTERIMAGE |
|
|
375 | bool |
|
|
376 | rxvt_term::render_image (unsigned long tr_flags) |
|
|
377 | { |
|
|
378 | init_asv (); |
|
|
379 | |
|
|
380 | ASImage *background = NULL; |
|
|
381 | ARGB32 background_tint = TINT_LEAVE_SAME; |
|
|
382 | |
|
|
383 | # ifdef ENABLE_TRANSPARENCY |
|
|
384 | if (tr_flags) |
|
|
385 | background = pixmap2ximage (asv, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, 100); |
|
|
386 | |
|
|
387 | if (tr_flags & BG_NEEDS_TINT) |
|
|
388 | { |
|
|
389 | ShadingInfo as_shade; |
|
|
390 | as_shade.shading = shade; |
|
|
391 | |
|
|
392 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
393 | if (bg_flags & BG_TINT_SET) |
|
|
394 | tint.get (c); |
|
|
395 | as_shade.tintColor.red = c.r; |
|
|
396 | as_shade.tintColor.green = c.g; |
|
|
397 | as_shade.tintColor.blue = c.b; |
|
|
398 | |
|
|
399 | background_tint = shading2tint32 (&as_shade); |
|
|
400 | } |
|
|
401 | |
|
|
402 | if ((tr_flags & BG_NEEDS_BLUR) && background != NULL) |
|
|
403 | { |
|
|
404 | ASImage *tmp = blur_asimage_gauss (asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
|
|
405 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
|
|
406 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
407 | if (tmp) |
|
|
408 | { |
|
|
409 | destroy_asimage (&background); |
|
|
410 | background = tmp; |
|
|
411 | } |
|
|
412 | } |
|
|
413 | # endif |
|
|
414 | |
|
|
415 | ASImage *result = 0; |
|
|
416 | |
|
|
417 | int target_width = szHint.width; |
|
|
418 | int target_height = szHint.height; |
|
|
419 | int new_pmap_width = target_width; |
|
|
420 | int new_pmap_height = target_height; |
|
|
421 | |
|
|
422 | int x = 0; |
|
|
423 | int y = 0; |
|
|
424 | int w = 0; |
|
|
425 | int h = 0; |
|
|
426 | |
|
|
427 | if (original_asim) |
|
|
428 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
|
|
429 | |
|
|
430 | if (!original_asim |
|
|
431 | || (!(bg_flags & BG_ROOT_ALIGN) |
|
|
432 | && (x >= target_width |
|
|
433 | || y >= target_height |
|
|
434 | || (x + w <= 0) |
|
|
435 | || (y + h <= 0)))) |
|
|
436 | { |
|
|
437 | if (background) |
|
|
438 | { |
|
|
439 | new_pmap_width = background->width; |
|
|
440 | new_pmap_height = background->height; |
|
|
441 | result = background; |
|
|
442 | |
|
|
443 | if (background_tint != TINT_LEAVE_SAME) |
|
|
444 | { |
|
|
445 | ASImage *tmp = tile_asimage (asv, background, 0, 0, |
|
|
446 | target_width, target_height, background_tint, |
|
|
447 | ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
448 | if (tmp) |
|
|
449 | result = tmp; |
|
|
450 | } |
|
|
451 | } |
|
|
452 | else |
|
|
453 | new_pmap_width = new_pmap_height = 0; |
|
|
454 | } |
|
|
455 | else |
|
|
456 | { |
|
|
457 | result = original_asim; |
|
|
458 | |
|
|
459 | if ((w != original_asim->width) |
|
|
460 | || (h != original_asim->height)) |
|
|
461 | { |
|
|
462 | result = scale_asimage (asv, original_asim, |
|
|
463 | w, h, |
|
|
464 | background ? ASA_ASImage : ASA_XImage, |
|
|
465 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
466 | } |
|
|
467 | |
|
|
468 | if (background == NULL) |
|
|
469 | { |
|
|
470 | if (bg_flags & BG_TILE) |
|
|
471 | { |
|
|
472 | /* if tiling - pixmap has to be sized exactly as the image, |
|
|
473 | but there is no need to make it bigger than the window! */ |
|
|
474 | new_pmap_width = min (result->width, target_width); |
|
|
475 | new_pmap_height = min (result->height, target_height); |
|
|
476 | |
|
|
477 | /* we also need to tile our image in both directions */ |
|
|
478 | ASImage *tmp = tile_asimage (asv, result, |
|
|
479 | (int)result->width - x, |
|
|
480 | (int)result->height - y, |
|
|
481 | new_pmap_width, |
|
|
482 | new_pmap_height, |
|
|
483 | TINT_LEAVE_SAME, ASA_XImage, |
|
|
484 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
485 | if (tmp) |
|
|
486 | { |
|
|
487 | if (result != original_asim) |
|
|
488 | destroy_asimage (&result); |
|
|
489 | |
|
|
490 | result = tmp; |
|
|
491 | } |
|
|
492 | } |
|
|
493 | } |
|
|
494 | else |
|
|
495 | { |
|
|
496 | /* if blending background and image - pixmap has to be sized same as target window */ |
|
|
497 | ASImageLayer *layers = create_image_layers (2); |
|
|
498 | |
|
|
499 | layers[0].im = background; |
|
|
500 | layers[0].clip_width = target_width; |
|
|
501 | layers[0].clip_height = target_height; |
|
|
502 | layers[0].tint = background_tint; |
|
|
503 | layers[1].im = result; |
|
|
504 | |
|
|
505 | if (bg_flags & BG_TILE) |
|
|
506 | { |
|
|
507 | /* tile horizontally */ |
|
|
508 | while (x > 0) x -= (int)result->width; |
|
|
509 | layers[1].dst_x = x; |
|
|
510 | layers[1].clip_width = result->width+target_width; |
|
|
511 | } |
|
|
512 | else |
|
|
513 | { |
|
|
514 | /* clip horizontally */ |
|
|
515 | layers[1].dst_x = x; |
|
|
516 | layers[1].clip_width = result->width; |
|
|
517 | } |
|
|
518 | |
|
|
519 | if (bg_flags & BG_TILE) |
|
|
520 | { |
|
|
521 | while (y > 0) y -= (int)result->height; |
|
|
522 | layers[1].dst_y = y; |
|
|
523 | layers[1].clip_height = result->height + target_height; |
|
|
524 | } |
|
|
525 | else |
|
|
526 | { |
|
|
527 | layers[1].dst_y = y; |
|
|
528 | layers[1].clip_height = result->height; |
|
|
529 | } |
|
|
530 | |
|
|
531 | if (rs[Rs_blendtype]) |
|
|
532 | { |
|
|
533 | layers[1].merge_scanlines = blend_scanlines_name2func (rs[Rs_blendtype]); |
|
|
534 | if (layers[1].merge_scanlines == NULL) |
|
|
535 | layers[1].merge_scanlines = alphablend_scanlines; |
|
|
536 | } |
|
|
537 | |
|
|
538 | ASImage *tmp = merge_layers (asv, layers, 2, target_width, target_height, |
|
|
539 | ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT); |
|
|
540 | |
|
|
541 | if (tmp) |
|
|
542 | { |
|
|
543 | if (result != original_asim) |
|
|
544 | destroy_asimage (&result); |
|
|
545 | |
|
|
546 | result = tmp; |
|
|
547 | } |
|
|
548 | |
|
|
549 | free (layers); |
|
|
550 | } |
|
|
551 | } |
|
|
552 | |
|
|
553 | bool ret = false; |
|
|
554 | |
|
|
555 | if (result) |
|
|
556 | { |
|
|
557 | XGCValues gcv; |
|
|
558 | GC gc; |
|
|
559 | |
|
|
560 | /* create Pixmap */ |
|
|
561 | if (bg_pixmap == None |
|
|
562 | || bg_pmap_width != new_pmap_width |
|
|
563 | || bg_pmap_height != new_pmap_height) |
|
|
564 | { |
|
|
565 | if (bg_pixmap) |
|
|
566 | XFreePixmap (dpy, bg_pixmap); |
|
|
567 | bg_pixmap = XCreatePixmap (dpy, vt, new_pmap_width, new_pmap_height, depth); |
|
|
568 | bg_pmap_width = new_pmap_width; |
|
|
569 | bg_pmap_height = new_pmap_height; |
|
|
570 | } |
|
|
571 | /* fill with background color (if result's not completely overlapping it) */ |
|
|
572 | gcv.foreground = pix_colors[Color_bg]; |
|
|
573 | gc = XCreateGC (dpy, vt, GCForeground, &gcv); |
|
|
574 | |
|
|
575 | int src_x = 0, src_y = 0, dst_x = 0, dst_y = 0; |
|
|
576 | int dst_width = result->width, dst_height = result->height; |
|
|
577 | if (background == NULL) |
|
|
578 | { |
|
|
579 | if (!(bg_flags & BG_TILE)) |
|
|
580 | { |
|
|
581 | src_x = make_clip_rectangle (x, result->width , new_pmap_width , dst_x, dst_width ); |
|
|
582 | src_y = make_clip_rectangle (y, result->height, new_pmap_height, dst_y, dst_height); |
|
|
583 | } |
|
|
584 | |
|
|
585 | if (dst_x > 0 || dst_y > 0 |
|
|
586 | || dst_x + dst_width < new_pmap_width |
|
|
587 | || dst_y + dst_height < new_pmap_height) |
|
|
588 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, new_pmap_width, new_pmap_height); |
|
|
589 | } |
|
|
590 | |
|
|
591 | /* put result on pixmap */ |
|
|
592 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
|
|
593 | asimage2drawable (asv, bg_pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
|
|
594 | |
|
|
595 | if (result != background && result != original_asim) |
|
|
596 | destroy_asimage (&result); |
|
|
597 | |
|
|
598 | XFreeGC (dpy, gc); |
|
|
599 | |
|
|
600 | ret = true; |
|
|
601 | } |
|
|
602 | |
|
|
603 | if (background) |
|
|
604 | destroy_asimage (&background); |
|
|
605 | |
|
|
606 | return ret; |
|
|
607 | } |
|
|
608 | # endif /* HAVE_AFTERIMAGE */ |
|
|
609 | |
346 | |
610 | # ifdef HAVE_PIXBUF |
347 | # ifdef HAVE_PIXBUF |
611 | bool |
348 | bool |
612 | rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
349 | rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
613 | int src_x, int src_y, int dst_x, int dst_y, |
350 | int src_x, int src_y, int dst_x, int dst_y, |
… | |
… | |
690 | XDestroyImage (ximage); |
427 | XDestroyImage (ximage); |
691 | return true; |
428 | return true; |
692 | } |
429 | } |
693 | |
430 | |
694 | bool |
431 | bool |
695 | rxvt_term::render_image (unsigned long tr_flags) |
432 | rxvt_term::render_image (bool transparent) |
696 | { |
433 | { |
697 | if (!pixbuf) |
434 | if (!pixbuf) |
698 | return false; |
435 | return false; |
699 | |
436 | |
700 | if (tr_flags |
437 | if (transparent |
701 | && !(bg_flags & BG_HAS_RENDER)) |
438 | && !(bg_flags & BG_HAS_RENDER)) |
702 | return false; |
439 | return false; |
703 | |
440 | |
704 | GdkPixbuf *result; |
441 | GdkPixbuf *result; |
705 | |
442 | |
… | |
… | |
719 | get_image_geometry (image_width, image_height, w, h, x, y); |
456 | get_image_geometry (image_width, image_height, w, h, x, y); |
720 | |
457 | |
721 | if (!(bg_flags & BG_ROOT_ALIGN) |
458 | if (!(bg_flags & BG_ROOT_ALIGN) |
722 | && (x >= target_width |
459 | && (x >= target_width |
723 | || y >= target_height |
460 | || y >= target_height |
724 | || (x + w <= 0) |
461 | || x + w <= 0 |
725 | || (y + h <= 0))) |
462 | || y + h <= 0)) |
726 | return false; |
463 | return false; |
727 | |
464 | |
728 | result = pixbuf; |
465 | result = pixbuf; |
729 | |
466 | |
730 | if ((w != image_width) |
467 | if (w != image_width |
731 | || (h != image_height)) |
468 | || h != image_height) |
732 | { |
469 | { |
733 | result = gdk_pixbuf_scale_simple (pixbuf, |
470 | result = gdk_pixbuf_scale_simple (pixbuf, |
734 | w, h, |
471 | w, h, |
735 | GDK_INTERP_BILINEAR); |
472 | GDK_INTERP_BILINEAR); |
736 | } |
473 | } |
… | |
… | |
745 | Pixmap root_pmap; |
482 | Pixmap root_pmap; |
746 | |
483 | |
747 | image_width = gdk_pixbuf_get_width (result); |
484 | image_width = gdk_pixbuf_get_width (result); |
748 | image_height = gdk_pixbuf_get_height (result); |
485 | image_height = gdk_pixbuf_get_height (result); |
749 | |
486 | |
750 | if (tr_flags) |
487 | if (transparent) |
751 | { |
488 | { |
752 | root_pmap = bg_pixmap; |
489 | root_pmap = bg_pixmap; |
753 | bg_pixmap = None; |
490 | bg_pixmap = None; |
754 | } |
491 | } |
755 | else |
492 | else |
… | |
… | |
813 | dst_x, dst_y, |
550 | dst_x, dst_y, |
814 | dst_width, dst_height); |
551 | dst_width, dst_height); |
815 | } |
552 | } |
816 | |
553 | |
817 | #if XRENDER |
554 | #if XRENDER |
818 | if (tr_flags) |
555 | if (transparent) |
819 | { |
556 | { |
820 | XRenderPictureAttributes pa; |
|
|
821 | |
|
|
822 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, visual); |
557 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
|
|
558 | |
823 | Picture src = XRenderCreatePicture (dpy, root_pmap, src_format, 0, &pa); |
559 | Picture src = XRenderCreatePicture (dpy, root_pmap, format, 0, 0); |
824 | |
560 | |
825 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, visual); |
|
|
826 | Picture dst = XRenderCreatePicture (dpy, bg_pixmap, dst_format, 0, &pa); |
561 | Picture dst = XRenderCreatePicture (dpy, bg_pixmap, format, 0, 0); |
827 | |
562 | |
828 | pa.repeat = True; |
563 | Picture mask = create_xrender_mask (dpy, vt, False, False); |
829 | Pixmap mask_pmap = XCreatePixmap (dpy, vt, 1, 1, 8); |
|
|
830 | XRenderPictFormat *mask_format = XRenderFindStandardFormat (dpy, PictStandardA8); |
|
|
831 | Picture mask = XRenderCreatePicture (dpy, mask_pmap, mask_format, CPRepeat, &pa); |
|
|
832 | XFreePixmap (dpy, mask_pmap); |
|
|
833 | |
564 | |
834 | XRenderColor mask_c; |
565 | XRenderColor mask_c; |
835 | |
566 | |
836 | mask_c.alpha = 0x8000; |
567 | mask_c.alpha = 0x8000; |
837 | mask_c.red = 0; |
568 | mask_c.red = |
838 | mask_c.green = 0; |
569 | mask_c.green = |
839 | mask_c.blue = 0; |
570 | mask_c.blue = 0; |
840 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
571 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
|
|
572 | |
841 | XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, target_width, target_height); |
573 | XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, target_width, target_height); |
842 | |
574 | |
843 | XRenderFreePicture (dpy, src); |
575 | XRenderFreePicture (dpy, src); |
844 | XRenderFreePicture (dpy, dst); |
576 | XRenderFreePicture (dpy, dst); |
845 | XRenderFreePicture (dpy, mask); |
577 | XRenderFreePicture (dpy, mask); |
… | |
… | |
852 | } |
584 | } |
853 | |
585 | |
854 | if (result != pixbuf) |
586 | if (result != pixbuf) |
855 | g_object_unref (result); |
587 | g_object_unref (result); |
856 | |
588 | |
857 | if (tr_flags) |
589 | if (transparent) |
858 | XFreePixmap (dpy, root_pmap); |
590 | XFreePixmap (dpy, root_pmap); |
859 | |
591 | |
860 | return ret; |
592 | return ret; |
861 | } |
593 | } |
862 | # endif /* HAVE_PIXBUF */ |
594 | # endif /* HAVE_PIXBUF */ |
… | |
… | |
865 | rxvt_term::bg_set_file (const char *file) |
597 | rxvt_term::bg_set_file (const char *file) |
866 | { |
598 | { |
867 | if (!file || !*file) |
599 | if (!file || !*file) |
868 | return false; |
600 | return false; |
869 | |
601 | |
|
|
602 | bool ret = false; |
870 | if (const char *p = strchr (file, ';')) |
603 | const char *p = strchr (file, ';'); |
|
|
604 | |
|
|
605 | if (p) |
871 | { |
606 | { |
872 | size_t len = p - file; |
607 | size_t len = p - file; |
873 | char *f = rxvt_temp_buf<char> (len + 1); |
608 | char *f = rxvt_temp_buf<char> (len + 1); |
874 | memcpy (f, file, len); |
609 | memcpy (f, file, len); |
875 | f[len] = '\0'; |
610 | f[len] = '\0'; |
876 | file = f; |
611 | file = f; |
877 | } |
612 | } |
878 | |
613 | |
879 | # ifdef HAVE_AFTERIMAGE |
|
|
880 | if (!asimman) |
|
|
881 | asimman = create_generic_imageman (rs[Rs_path]); |
|
|
882 | ASImage *image = get_asimage (asimman, file, 0xFFFFFFFF, 100); |
|
|
883 | if (image) |
|
|
884 | { |
|
|
885 | if (original_asim) |
|
|
886 | safe_asimage_destroy (original_asim); |
|
|
887 | original_asim = image; |
|
|
888 | bg_flags |= BG_IS_FROM_FILE | BG_CLIENT_RENDER; |
|
|
889 | return true; |
|
|
890 | } |
|
|
891 | # endif |
|
|
892 | |
|
|
893 | # ifdef HAVE_PIXBUF |
614 | # ifdef HAVE_PIXBUF |
894 | GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); |
615 | GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); |
895 | if (image) |
616 | if (image) |
896 | { |
617 | { |
897 | if (pixbuf) |
618 | if (pixbuf) |
898 | g_object_unref (pixbuf); |
619 | g_object_unref (pixbuf); |
899 | pixbuf = image; |
620 | pixbuf = image; |
900 | bg_flags |= BG_IS_FROM_FILE; |
621 | bg_flags |= BG_IS_FROM_FILE; |
901 | return true; |
622 | ret = true; |
902 | } |
623 | } |
903 | # endif |
624 | # endif |
904 | |
625 | |
|
|
626 | if (ret) |
|
|
627 | { |
|
|
628 | if (p) |
|
|
629 | bg_set_geometry (p + 1); |
|
|
630 | else |
|
|
631 | bg_set_default_geometry (); |
|
|
632 | } |
|
|
633 | |
905 | return false; |
634 | return ret; |
906 | } |
635 | } |
907 | |
636 | |
908 | # endif /* BG_IMAGE_FROM_FILE */ |
637 | # endif /* BG_IMAGE_FROM_FILE */ |
909 | |
638 | |
910 | # ifdef ENABLE_TRANSPARENCY |
639 | # ifdef ENABLE_TRANSPARENCY |
… | |
… | |
946 | { |
675 | { |
947 | changed = true; |
676 | changed = true; |
948 | v_blurRadius = vr; |
677 | v_blurRadius = vr; |
949 | } |
678 | } |
950 | |
679 | |
951 | if (v_blurRadius == 0 && h_blurRadius == 0) |
680 | if (h_blurRadius == 0 || v_blurRadius == 0) |
952 | bg_flags &= ~BG_NEEDS_BLUR; |
681 | bg_flags &= ~BG_NEEDS_BLUR; |
953 | else |
682 | else |
954 | bg_flags |= BG_NEEDS_BLUR; |
683 | bg_flags |= BG_NEEDS_BLUR; |
955 | |
684 | |
956 | return changed; |
685 | return changed; |
957 | } |
686 | } |
958 | |
687 | |
959 | void |
688 | void |
960 | rxvt_term::set_tint_shade_flags () |
689 | rxvt_term::set_tint_shade_flags () |
961 | { |
690 | { |
962 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
691 | if (shade != 100 || (bg_flags & BG_TINT_SET)) |
963 | bool has_shade = shade != 100; |
692 | bg_flags |= BG_NEEDS_TINT; |
|
|
693 | else |
|
|
694 | bg_flags &= ~BG_NEEDS_TINT; |
|
|
695 | } |
964 | |
696 | |
|
|
697 | bool |
|
|
698 | rxvt_term::bg_set_tint (rxvt_color &new_tint) |
|
|
699 | { |
|
|
700 | if (!(bg_flags & BG_TINT_SET) || tint != new_tint) |
|
|
701 | { |
|
|
702 | tint = new_tint; |
965 | bg_flags &= ~BG_TINT_FLAGS; |
703 | bg_flags |= BG_TINT_SET; |
966 | |
704 | |
967 | if (bg_flags & BG_TINT_SET) |
705 | rgba c; |
968 | { |
|
|
969 | tint.get (c); |
706 | tint.get (c); |
970 | if (!has_shade |
|
|
971 | && (c.r <= 0x00ff || c.r >= 0xff00) |
707 | if ((c.r <= 0x00ff || c.r >= 0xff00) |
972 | && (c.g <= 0x00ff || c.g >= 0xff00) |
708 | && (c.g <= 0x00ff || c.g >= 0xff00) |
973 | && (c.b <= 0x00ff || c.b >= 0xff00)) |
709 | && (c.b <= 0x00ff || c.b >= 0xff00)) |
974 | bg_flags |= BG_TINT_BITAND; |
710 | bg_flags |= BG_TINT_BITAND; |
975 | } |
711 | else |
976 | |
|
|
977 | if (has_shade || (bg_flags & BG_TINT_SET)) |
|
|
978 | bg_flags |= BG_NEEDS_TINT; |
|
|
979 | } |
|
|
980 | |
|
|
981 | bool |
|
|
982 | rxvt_term::bg_set_tint (rxvt_color &new_tint) |
|
|
983 | { |
|
|
984 | if (!(bg_flags & BG_TINT_SET) || tint != new_tint) |
|
|
985 | { |
|
|
986 | tint = new_tint; |
|
|
987 | bg_flags |= BG_TINT_SET; |
712 | bg_flags &= ~BG_TINT_BITAND; |
|
|
713 | |
988 | set_tint_shade_flags (); |
714 | set_tint_shade_flags (); |
989 | return true; |
715 | return true; |
990 | } |
716 | } |
991 | |
717 | |
992 | return false; |
718 | return false; |
993 | } |
719 | } |
994 | |
720 | |
995 | bool |
721 | bool |
996 | rxvt_term::bg_set_shade (const char *shade_str) |
722 | rxvt_term::bg_set_shade (const char *shade_str) |
997 | { |
723 | { |
998 | int new_shade = (shade_str) ? atoi (shade_str) : 100; |
724 | int new_shade = atoi (shade_str); |
999 | |
725 | |
1000 | clamp_it (new_shade, -100, 200); |
726 | clamp_it (new_shade, -100, 200); |
1001 | if (new_shade < 0) |
727 | if (new_shade < 0) |
1002 | new_shade = 200 - (100 + new_shade); |
728 | new_shade = 200 - (100 + new_shade); |
1003 | |
729 | |
… | |
… | |
1033 | params[i+2] = XDoubleToFixed (kernel[i] / sum); |
759 | params[i+2] = XDoubleToFixed (kernel[i] / sum); |
1034 | } |
760 | } |
1035 | #endif |
761 | #endif |
1036 | |
762 | |
1037 | bool |
763 | bool |
1038 | rxvt_term::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
764 | rxvt_term::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height, int depth) |
1039 | { |
765 | { |
1040 | bool ret = false; |
766 | bool ret = false; |
1041 | #if XRENDER |
767 | #if XRENDER |
|
|
768 | if (!(bg_flags & BG_HAS_RENDER_CONV)) |
|
|
769 | return false; |
|
|
770 | |
1042 | int size = max (h_blurRadius, v_blurRadius) * 2 + 1; |
771 | int size = max (h_blurRadius, v_blurRadius) * 2 + 1; |
1043 | double *kernel = (double *)malloc (size * sizeof (double)); |
772 | double *kernel = (double *)malloc (size * sizeof (double)); |
1044 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
773 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
1045 | |
774 | |
1046 | XRenderPictureAttributes pa; |
775 | XRenderPictureAttributes pa; |
1047 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
776 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
1048 | |
777 | |
|
|
778 | pa.repeat = RepeatPad; |
1049 | Picture src = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
779 | Picture src = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa); |
|
|
780 | Pixmap tmp = XCreatePixmap (dpy, pixmap, width, height, depth); |
1050 | Picture dst = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
781 | Picture dst = XRenderCreatePicture (dpy, tmp, format, CPRepeat, &pa); |
|
|
782 | XFreePixmap (dpy, tmp); |
1051 | |
783 | |
1052 | if (kernel && params) |
784 | if (kernel && params) |
1053 | { |
785 | { |
1054 | if (h_blurRadius) |
|
|
1055 | { |
|
|
1056 | size = h_blurRadius * 2 + 1; |
786 | size = h_blurRadius * 2 + 1; |
1057 | get_gaussian_kernel (h_blurRadius, size, kernel, params); |
787 | get_gaussian_kernel (h_blurRadius, size, kernel, params); |
1058 | |
788 | |
1059 | XRenderSetPictureFilter (dpy, src, FilterConvolution, params, size+2); |
789 | XRenderSetPictureFilter (dpy, src, FilterConvolution, params, size+2); |
1060 | XRenderComposite (dpy, |
790 | XRenderComposite (dpy, |
1061 | PictOpSrc, |
791 | PictOpSrc, |
1062 | src, |
792 | src, |
1063 | None, |
793 | None, |
1064 | dst, |
794 | dst, |
1065 | 0, 0, |
795 | 0, 0, |
1066 | 0, 0, |
796 | 0, 0, |
1067 | 0, 0, |
797 | 0, 0, |
1068 | width, height); |
798 | width, height); |
1069 | } |
|
|
1070 | |
799 | |
1071 | if (v_blurRadius) |
800 | ::swap (src, dst); |
1072 | { |
801 | |
1073 | size = v_blurRadius * 2 + 1; |
802 | size = v_blurRadius * 2 + 1; |
1074 | get_gaussian_kernel (v_blurRadius, size, kernel, params); |
803 | get_gaussian_kernel (v_blurRadius, size, kernel, params); |
1075 | ::swap (params[0], params[1]); |
804 | ::swap (params[0], params[1]); |
1076 | |
805 | |
1077 | XRenderSetPictureFilter (dpy, src, FilterConvolution, params, size+2); |
806 | XRenderSetPictureFilter (dpy, src, FilterConvolution, params, size+2); |
1078 | XRenderComposite (dpy, |
807 | XRenderComposite (dpy, |
1079 | PictOpSrc, |
808 | PictOpSrc, |
1080 | src, |
809 | src, |
1081 | None, |
810 | None, |
1082 | dst, |
811 | dst, |
1083 | 0, 0, |
812 | 0, 0, |
1084 | 0, 0, |
813 | 0, 0, |
1085 | 0, 0, |
814 | 0, 0, |
1086 | width, height); |
815 | width, height); |
1087 | } |
|
|
1088 | |
816 | |
1089 | ret = true; |
817 | ret = true; |
1090 | } |
818 | } |
1091 | |
819 | |
1092 | free (kernel); |
820 | free (kernel); |
… | |
… | |
1100 | bool |
828 | bool |
1101 | rxvt_term::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
829 | rxvt_term::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1102 | { |
830 | { |
1103 | bool ret = false; |
831 | bool ret = false; |
1104 | |
832 | |
1105 | if (bg_flags & BG_TINT_BITAND) |
833 | if (shade == 100 && (bg_flags & BG_TINT_BITAND)) |
1106 | { |
834 | { |
1107 | XGCValues gcv; |
835 | XGCValues gcv; |
1108 | GC gc; |
836 | GC gc; |
1109 | |
837 | |
1110 | /* In this case we can tint image server-side getting significant |
838 | /* In this case we can tint image server-side getting significant |
… | |
… | |
1119 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
847 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1120 | ret = true; |
848 | ret = true; |
1121 | XFreeGC (dpy, gc); |
849 | XFreeGC (dpy, gc); |
1122 | } |
850 | } |
1123 | } |
851 | } |
1124 | else |
|
|
1125 | { |
|
|
1126 | # if XRENDER |
852 | # if XRENDER |
|
|
853 | else if (bg_flags & BG_HAS_RENDER) |
|
|
854 | { |
1127 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
855 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
1128 | |
856 | |
1129 | if (bg_flags & BG_TINT_SET) |
857 | if (bg_flags & BG_TINT_SET) |
1130 | tint.get (c); |
858 | tint.get (c); |
1131 | |
859 | |
… | |
… | |
1140 | c.r = c.r * (200 - shade) / 100; |
868 | c.r = c.r * (200 - shade) / 100; |
1141 | c.g = c.g * (200 - shade) / 100; |
869 | c.g = c.g * (200 - shade) / 100; |
1142 | c.b = c.b * (200 - shade) / 100; |
870 | c.b = c.b * (200 - shade) / 100; |
1143 | } |
871 | } |
1144 | |
872 | |
1145 | XRenderPictFormat *solid_format = XRenderFindStandardFormat (dpy, PictStandardARGB32); |
|
|
1146 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
873 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
1147 | XRenderPictureAttributes pa; |
|
|
1148 | |
874 | |
1149 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
875 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, format, 0, 0); |
1150 | |
876 | |
1151 | pa.repeat = True; |
877 | Picture overlay_pic = create_xrender_mask (dpy, pixmap, True, False); |
1152 | |
878 | |
1153 | Pixmap overlay_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
879 | Picture mask_pic = create_xrender_mask (dpy, pixmap, True, True); |
1154 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
|
|
1155 | XFreePixmap (dpy, overlay_pmap); |
|
|
1156 | |
|
|
1157 | pa.component_alpha = True; |
|
|
1158 | Pixmap mask_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
|
|
1159 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat | CPComponentAlpha, &pa); |
|
|
1160 | XFreePixmap (dpy, mask_pmap); |
|
|
1161 | |
880 | |
1162 | XRenderColor mask_c; |
881 | XRenderColor mask_c; |
1163 | |
882 | |
1164 | mask_c.alpha = 0xffff; |
883 | mask_c.alpha = 0xffff; |
1165 | mask_c.red = |
884 | mask_c.red = |
… | |
… | |
1170 | mask_c.alpha = 0; |
889 | mask_c.alpha = 0; |
1171 | mask_c.red = 0xffff - c.r; |
890 | mask_c.red = 0xffff - c.r; |
1172 | mask_c.green = 0xffff - c.g; |
891 | mask_c.green = 0xffff - c.g; |
1173 | mask_c.blue = 0xffff - c.b; |
892 | mask_c.blue = 0xffff - c.b; |
1174 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
893 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
894 | |
1175 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
895 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
1176 | |
896 | |
1177 | if (shade > 100) |
897 | if (shade > 100) |
1178 | { |
898 | { |
1179 | mask_c.red = mask_c.green = mask_c.blue = 0xffff * (shade - 100) / 100; |
|
|
1180 | mask_c.alpha = 0; |
899 | mask_c.alpha = 0; |
|
|
900 | mask_c.red = |
|
|
901 | mask_c.green = |
|
|
902 | mask_c.blue = 0xffff * (shade - 100) / 100; |
1181 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
903 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
1182 | |
904 | |
1183 | XRenderComposite (dpy, PictOpOver, overlay_pic, None, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
905 | XRenderComposite (dpy, PictOpOver, overlay_pic, None, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
1184 | } |
906 | } |
1185 | |
907 | |
1186 | ret = true; |
908 | ret = true; |
1187 | |
909 | |
1188 | XRenderFreePicture (dpy, mask_pic); |
910 | XRenderFreePicture (dpy, mask_pic); |
1189 | XRenderFreePicture (dpy, overlay_pic); |
911 | XRenderFreePicture (dpy, overlay_pic); |
1190 | XRenderFreePicture (dpy, back_pic); |
912 | XRenderFreePicture (dpy, back_pic); |
|
|
913 | } |
1191 | # endif |
914 | # endif |
1192 | } |
|
|
1193 | |
915 | |
1194 | return ret; |
916 | return ret; |
1195 | } |
917 | } |
1196 | |
918 | |
1197 | /* |
919 | /* |
1198 | * Builds a pixmap of the same size as the terminal window that contains |
920 | * Builds a pixmap of the same size as the terminal window that contains |
1199 | * the tiled portion of the root pixmap that is supposed to be covered by |
921 | * the tiled portion of the root pixmap that is supposed to be covered by |
1200 | * our window. |
922 | * our window. |
1201 | */ |
923 | */ |
1202 | unsigned long |
924 | bool |
1203 | rxvt_term::make_transparency_pixmap () |
925 | rxvt_term::make_transparency_pixmap () |
1204 | { |
926 | { |
1205 | unsigned long result = 0; |
927 | bool ret = false; |
1206 | |
928 | |
1207 | /* root dimensions may change from call to call - but Display structure should |
929 | /* root dimensions may change from call to call - but Display structure should |
1208 | * be always up-to-date, so let's use it : |
930 | * be always up-to-date, so let's use it : |
1209 | */ |
931 | */ |
1210 | int screen = display->screen; |
932 | int screen = display->screen; |
… | |
… | |
1248 | #if XRENDER |
970 | #if XRENDER |
1249 | if (bg_flags & BG_HAS_RENDER) |
971 | if (bg_flags & BG_HAS_RENDER) |
1250 | { |
972 | { |
1251 | recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth); |
973 | recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth); |
1252 | |
974 | |
1253 | XRenderPictureAttributes pa; |
|
|
1254 | |
|
|
1255 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
975 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1256 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
976 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, 0); |
1257 | |
977 | |
1258 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, visual); |
978 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, visual); |
1259 | Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, &pa); |
979 | Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, 0); |
1260 | |
980 | |
1261 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height); |
981 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height); |
1262 | |
982 | |
1263 | XRenderFreePicture (dpy, src); |
983 | XRenderFreePicture (dpy, src); |
1264 | XRenderFreePicture (dpy, dst); |
984 | XRenderFreePicture (dpy, dst); |
… | |
… | |
1281 | bg_pmap_width = window_width; |
1001 | bg_pmap_width = window_width; |
1282 | bg_pmap_height = window_height; |
1002 | bg_pmap_height = window_height; |
1283 | } |
1003 | } |
1284 | |
1004 | |
1285 | /* straightforward pixmap copy */ |
1005 | /* straightforward pixmap copy */ |
1286 | while (sx < 0) sx += root_width; |
1006 | while (sx < 0) sx += root_pmap_width; |
1287 | while (sy < 0) sy += root_height; |
1007 | while (sy < 0) sy += root_pmap_height; |
1288 | |
1008 | |
1289 | gcv.tile = recoded_root_pmap; |
1009 | gcv.tile = recoded_root_pmap; |
1290 | gcv.fill_style = FillTiled; |
1010 | gcv.fill_style = FillTiled; |
1291 | gcv.ts_x_origin = -sx; |
1011 | gcv.ts_x_origin = -sx; |
1292 | gcv.ts_y_origin = -sy; |
1012 | gcv.ts_y_origin = -sy; |
1293 | gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1013 | gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1294 | |
1014 | |
1295 | if (gc) |
1015 | if (gc) |
1296 | { |
1016 | { |
1297 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); |
1017 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); |
1298 | result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); |
1018 | ret = true; |
|
|
1019 | unsigned long tr_flags = bg_flags & BG_EFFECTS_FLAGS; |
|
|
1020 | |
|
|
1021 | if (!(bg_flags & BG_CLIENT_RENDER)) |
|
|
1022 | { |
|
|
1023 | if (bg_flags & BG_NEEDS_BLUR) |
|
|
1024 | { |
|
|
1025 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height, depth)) |
|
|
1026 | tr_flags &= ~BG_NEEDS_BLUR; |
|
|
1027 | } |
|
|
1028 | if (bg_flags & BG_NEEDS_TINT) |
|
|
1029 | { |
|
|
1030 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
|
|
1031 | tr_flags &= ~BG_NEEDS_TINT; |
|
|
1032 | } |
|
|
1033 | if (tr_flags & BG_NEEDS_TINT) |
|
|
1034 | { |
|
|
1035 | XImage *ximage = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap); |
|
|
1036 | if (ximage) |
|
|
1037 | { |
|
|
1038 | /* our own client-side tinting */ |
|
|
1039 | tint_ximage (DefaultVisual (dpy, display->screen), ximage); |
|
|
1040 | |
|
|
1041 | XPutImage (dpy, bg_pixmap, gc, ximage, 0, 0, 0, 0, ximage->width, ximage->height); |
|
|
1042 | XDestroyImage (ximage); |
|
|
1043 | } |
|
|
1044 | } |
|
|
1045 | } /* server side rendering completed */ |
|
|
1046 | |
1299 | XFreeGC (dpy, gc); |
1047 | XFreeGC (dpy, gc); |
1300 | |
|
|
1301 | if (!(bg_flags & BG_CLIENT_RENDER)) |
|
|
1302 | { |
|
|
1303 | if ((bg_flags & BG_NEEDS_BLUR) |
|
|
1304 | && (bg_flags & BG_HAS_RENDER_CONV)) |
|
|
1305 | { |
|
|
1306 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
|
|
1307 | result &= ~BG_NEEDS_BLUR; |
|
|
1308 | } |
|
|
1309 | if ((bg_flags & BG_NEEDS_TINT) |
|
|
1310 | && (bg_flags & (BG_TINT_BITAND | BG_HAS_RENDER))) |
|
|
1311 | { |
|
|
1312 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
|
|
1313 | result &= ~BG_NEEDS_TINT; |
|
|
1314 | } |
|
|
1315 | } /* server side rendering completed */ |
|
|
1316 | } |
1048 | } |
1317 | |
1049 | |
1318 | if (recoded_root_pmap != root_pixmap) |
1050 | if (recoded_root_pmap != root_pixmap) |
1319 | XFreePixmap (dpy, recoded_root_pmap); |
1051 | XFreePixmap (dpy, recoded_root_pmap); |
1320 | |
1052 | |
1321 | return result; |
1053 | return ret; |
1322 | } |
1054 | } |
1323 | |
1055 | |
1324 | void |
1056 | void |
1325 | rxvt_term::bg_set_root_pixmap () |
1057 | rxvt_term::bg_set_root_pixmap () |
1326 | { |
1058 | { |
… | |
… | |
1330 | |
1062 | |
1331 | root_pixmap = new_root_pixmap; |
1063 | root_pixmap = new_root_pixmap; |
1332 | } |
1064 | } |
1333 | # endif /* ENABLE_TRANSPARENCY */ |
1065 | # endif /* ENABLE_TRANSPARENCY */ |
1334 | |
1066 | |
1335 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
|
|
1336 | static void shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c); |
|
|
1337 | # endif |
|
|
1338 | |
|
|
1339 | bool |
1067 | bool |
1340 | rxvt_term::bg_render () |
1068 | rxvt_term::bg_render () |
1341 | { |
1069 | { |
1342 | unsigned long tr_flags = 0; |
1070 | bool transparent = false; |
1343 | |
1071 | |
1344 | bg_invalidate (); |
1072 | bg_invalidate (); |
1345 | # ifdef ENABLE_TRANSPARENCY |
1073 | # ifdef ENABLE_TRANSPARENCY |
1346 | if (bg_flags & BG_IS_TRANSPARENT) |
1074 | if (bg_flags & BG_IS_TRANSPARENT) |
1347 | { |
1075 | { |
1348 | /* we need to re-generate transparency pixmap in that case ! */ |
1076 | /* we need to re-generate transparency pixmap in that case ! */ |
1349 | tr_flags = make_transparency_pixmap (); |
1077 | transparent = make_transparency_pixmap (); |
1350 | if (tr_flags == 0) |
1078 | if (transparent) |
1351 | return false; |
|
|
1352 | else if (!(tr_flags & BG_EFFECTS_FLAGS)) |
|
|
1353 | bg_flags |= BG_IS_VALID; |
1079 | bg_flags |= BG_IS_VALID; |
1354 | } |
1080 | } |
1355 | # endif |
1081 | # endif |
1356 | |
1082 | |
1357 | # ifdef BG_IMAGE_FROM_FILE |
1083 | # ifdef BG_IMAGE_FROM_FILE |
1358 | if ((bg_flags & BG_IS_FROM_FILE) |
1084 | if (bg_flags & BG_IS_FROM_FILE) |
1359 | || (tr_flags & BG_EFFECTS_FLAGS)) |
|
|
1360 | { |
1085 | { |
1361 | if (render_image (tr_flags)) |
1086 | if (render_image (transparent)) |
1362 | bg_flags |= BG_IS_VALID; |
1087 | bg_flags |= BG_IS_VALID; |
1363 | } |
|
|
1364 | # endif |
|
|
1365 | |
|
|
1366 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
|
|
1367 | XImage *result = NULL; |
|
|
1368 | |
|
|
1369 | if (tr_flags && !(bg_flags & BG_IS_VALID)) |
|
|
1370 | { |
|
|
1371 | result = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap); |
|
|
1372 | } |
|
|
1373 | |
|
|
1374 | if (result) |
|
|
1375 | { |
|
|
1376 | /* our own client-side tinting */ |
|
|
1377 | if (tr_flags & BG_NEEDS_TINT) |
|
|
1378 | { |
|
|
1379 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
1380 | if (bg_flags & BG_TINT_SET) |
|
|
1381 | tint.get (c); |
|
|
1382 | shade_ximage (DefaultVisual (dpy, display->screen), result, shade, c); |
|
|
1383 | } |
|
|
1384 | |
|
|
1385 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
|
|
1386 | |
|
|
1387 | if (gc) |
|
|
1388 | { |
|
|
1389 | XPutImage (dpy, bg_pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
|
|
1390 | |
|
|
1391 | XFreeGC (dpy, gc); |
|
|
1392 | bg_flags |= BG_IS_VALID; |
|
|
1393 | } |
|
|
1394 | |
|
|
1395 | XDestroyImage (result); |
|
|
1396 | } |
1088 | } |
1397 | # endif |
1089 | # endif |
1398 | |
1090 | |
1399 | if (!(bg_flags & BG_IS_VALID)) |
1091 | if (!(bg_flags & BG_IS_VALID)) |
1400 | { |
1092 | { |
… | |
… | |
1437 | #endif |
1129 | #endif |
1438 | } |
1130 | } |
1439 | |
1131 | |
1440 | #endif /* HAVE_BG_PIXMAP */ |
1132 | #endif /* HAVE_BG_PIXMAP */ |
1441 | |
1133 | |
1442 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1134 | #ifdef ENABLE_TRANSPARENCY |
1443 | /* taken from aterm-0.4.2 */ |
1135 | /* based on code from aterm-0.4.2 */ |
1444 | |
1136 | |
1445 | static void |
1137 | static inline void |
1446 | shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c) |
1138 | fill_lut (uint32_t *lookup, uint32_t mask, int sh, unsigned short low, unsigned short high) |
|
|
1139 | { |
|
|
1140 | for (int i = 0; i <= mask >> sh; i++) |
|
|
1141 | { |
|
|
1142 | uint32_t tmp; |
|
|
1143 | tmp = i * high; |
|
|
1144 | tmp += (mask >> sh) * low; |
|
|
1145 | lookup[i] = (tmp / 0xffff) << sh; |
|
|
1146 | } |
|
|
1147 | } |
|
|
1148 | |
|
|
1149 | void |
|
|
1150 | rxvt_term::tint_ximage (Visual *visual, XImage *ximage) |
1447 | { |
1151 | { |
1448 | int sh_r, sh_g, sh_b; |
1152 | int sh_r, sh_g, sh_b; |
1449 | uint32_t mask_r, mask_g, mask_b; |
1153 | uint32_t mask_r, mask_g, mask_b; |
1450 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1154 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1451 | rgba low; |
1155 | unsigned short low; |
1452 | rgba high; |
|
|
1453 | int i; |
|
|
1454 | int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
1156 | int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
1455 | |
1157 | |
1456 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1158 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1457 | |
1159 | |
1458 | /* for convenience */ |
1160 | /* for convenience */ |
… | |
… | |
1517 | break; |
1219 | break; |
1518 | default: |
1220 | default: |
1519 | return; /* we do not support this color depth */ |
1221 | return; /* we do not support this color depth */ |
1520 | } |
1222 | } |
1521 | |
1223 | |
|
|
1224 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
|
|
1225 | |
|
|
1226 | if (bg_flags & BG_TINT_SET) |
|
|
1227 | tint.get (c); |
|
|
1228 | |
1522 | /* prepare limits for color transformation (each channel is handled separately) */ |
1229 | /* prepare limits for color transformation (each channel is handled separately) */ |
1523 | if (shade > 100) |
1230 | if (shade > 100) |
1524 | { |
1231 | { |
1525 | shade = 200 - shade; |
|
|
1526 | |
|
|
1527 | high.r = c.r * shade / 100; |
|
|
1528 | high.g = c.g * shade / 100; |
|
|
1529 | high.b = c.b * shade / 100; |
|
|
1530 | |
|
|
1531 | low.r = 65535 * (100 - shade) / 100; |
1232 | c.r = c.r * (200 - shade) / 100; |
1532 | low.g = 65535 * (100 - shade) / 100; |
1233 | c.g = c.g * (200 - shade) / 100; |
1533 | low.b = 65535 * (100 - shade) / 100; |
1234 | c.b = c.b * (200 - shade) / 100; |
|
|
1235 | |
|
|
1236 | low = 0xffff * (shade - 100) / 100; |
1534 | } |
1237 | } |
1535 | else |
1238 | else |
1536 | { |
1239 | { |
1537 | high.r = c.r * shade / 100; |
1240 | c.r = c.r * shade / 100; |
1538 | high.g = c.g * shade / 100; |
1241 | c.g = c.g * shade / 100; |
1539 | high.b = c.b * shade / 100; |
1242 | c.b = c.b * shade / 100; |
1540 | |
1243 | |
1541 | low.r = low.g = low.b = 0; |
1244 | low = 0; |
1542 | } |
1245 | } |
1543 | |
1246 | |
1544 | /* fill our lookup tables */ |
1247 | /* fill our lookup tables */ |
1545 | for (i = 0; i <= mask_r>>sh_r; i++) |
1248 | fill_lut (lookup_r, mask_r, sh_r, low, c.r); |
1546 | { |
1249 | fill_lut (lookup_g, mask_g, sh_g, low, c.g); |
1547 | uint32_t tmp; |
1250 | fill_lut (lookup_b, mask_b, sh_b, low, c.b); |
1548 | tmp = i * high.r; |
|
|
1549 | tmp += (mask_r>>sh_r) * low.r; |
|
|
1550 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
1551 | } |
|
|
1552 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
1553 | { |
|
|
1554 | uint32_t tmp; |
|
|
1555 | tmp = i * high.g; |
|
|
1556 | tmp += (mask_g>>sh_g) * low.g; |
|
|
1557 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
1558 | } |
|
|
1559 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
1560 | { |
|
|
1561 | uint32_t tmp; |
|
|
1562 | tmp = i * high.b; |
|
|
1563 | tmp += (mask_b>>sh_b) * low.b; |
|
|
1564 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
1565 | } |
|
|
1566 | |
1251 | |
1567 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1252 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1568 | if (ximage->bits_per_pixel == 32 |
1253 | if (ximage->bits_per_pixel == 32 |
1569 | && (ximage->depth == 24 || ximage->depth == 32) |
1254 | && (ximage->depth == 24 || ximage->depth == 32) |
1570 | && ximage->byte_order == host_byte_order) |
1255 | && ximage->byte_order == host_byte_order) |
… | |
… | |
1600 | } |
1285 | } |
1601 | } |
1286 | } |
1602 | |
1287 | |
1603 | free (lookup); |
1288 | free (lookup); |
1604 | } |
1289 | } |
1605 | #endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */ |
1290 | #endif /* ENABLE_TRANSPARENCY */ |