1 /* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */
3 * Copyright © 2000 SuSE, Inc.
4 * Copyright © 2007 Red Hat, Inc.
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 SuSE not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. SuSE makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: Keith Packard, SuSE, Inc.
29 #include "pixman-private.h"
34 * Operator optimizations based on source or destination opacity
39 pixman_op_t op_src_dst_opaque;
40 pixman_op_t op_src_opaque;
41 pixman_op_t op_dst_opaque;
42 } optimized_operator_info_t;
44 static const optimized_operator_info_t optimized_operators[] =
46 /* Input Operator SRC&DST Opaque SRC Opaque DST Opaque */
47 { PIXMAN_OP_OVER, PIXMAN_OP_SRC, PIXMAN_OP_SRC, PIXMAN_OP_OVER },
48 { PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST, PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST },
49 { PIXMAN_OP_IN, PIXMAN_OP_SRC, PIXMAN_OP_IN, PIXMAN_OP_SRC },
50 { PIXMAN_OP_IN_REVERSE, PIXMAN_OP_DST, PIXMAN_OP_DST, PIXMAN_OP_IN_REVERSE },
51 { PIXMAN_OP_OUT, PIXMAN_OP_CLEAR, PIXMAN_OP_OUT, PIXMAN_OP_CLEAR },
52 { PIXMAN_OP_OUT_REVERSE, PIXMAN_OP_CLEAR, PIXMAN_OP_CLEAR, PIXMAN_OP_OUT_REVERSE },
53 { PIXMAN_OP_ATOP, PIXMAN_OP_SRC, PIXMAN_OP_IN, PIXMAN_OP_OVER },
54 { PIXMAN_OP_ATOP_REVERSE, PIXMAN_OP_DST, PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_IN_REVERSE },
55 { PIXMAN_OP_XOR, PIXMAN_OP_CLEAR, PIXMAN_OP_OUT, PIXMAN_OP_OUT_REVERSE },
56 { PIXMAN_OP_SATURATE, PIXMAN_OP_DST, PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST },
60 static pixman_implementation_t *imp;
63 * Check if the current operator could be optimized
65 static const optimized_operator_info_t*
66 pixman_operator_can_be_optimized (pixman_op_t op)
68 const optimized_operator_info_t *info;
70 for (info = optimized_operators; info->op != PIXMAN_OP_NONE; info++)
79 * Optimize the current operator based on opacity of source or destination
80 * The output operator should be mathematically equivalent to the source.
83 pixman_optimize_operator (pixman_op_t op,
84 pixman_image_t *src_image,
85 pixman_image_t *mask_image,
86 pixman_image_t *dst_image)
88 pixman_bool_t is_source_opaque;
89 pixman_bool_t is_dest_opaque;
90 const optimized_operator_info_t *info = pixman_operator_can_be_optimized (op);
92 if (!info || mask_image)
95 is_source_opaque = _pixman_image_is_opaque (src_image);
96 is_dest_opaque = _pixman_image_is_opaque (dst_image);
98 if (is_source_opaque == FALSE && is_dest_opaque == FALSE)
101 if (is_source_opaque && is_dest_opaque)
102 return info->op_src_dst_opaque;
103 else if (is_source_opaque)
104 return info->op_src_opaque;
105 else if (is_dest_opaque)
106 return info->op_dst_opaque;
113 apply_workaround (pixman_image_t *image,
116 uint32_t ** save_bits,
120 if (image && image->common.need_workaround)
122 /* Some X servers generate images that point to the
123 * wrong place in memory, but then set the clip region
124 * to point to the right place. Because of an old bug
125 * in pixman, this would actually work.
127 * Here we try and undo the damage
129 int bpp = PIXMAN_FORMAT_BPP (image->bits.format) / 8;
130 pixman_box32_t *extents;
134 extents = pixman_region32_extents (&(image->common.clip_region));
138 *save_bits = image->bits.bits;
142 pixman_region32_translate (&(image->common.clip_region), -dx, -dy);
144 t = (uint8_t *)image->bits.bits;
145 t += dy * image->bits.rowstride * 4 + dx * bpp;
146 image->bits.bits = (uint32_t *)t;
154 unapply_workaround (pixman_image_t *image, uint32_t *bits, int dx, int dy)
156 if (image && image->common.need_workaround)
158 image->bits.bits = bits;
159 pixman_region32_translate (&image->common.clip_region, dx, dy);
164 * Computing composite region
166 static inline pixman_bool_t
167 clip_general_image (pixman_region32_t * region,
168 pixman_region32_t * clip,
172 if (pixman_region32_n_rects (region) == 1 &&
173 pixman_region32_n_rects (clip) == 1)
175 pixman_box32_t * rbox = pixman_region32_rectangles (region, NULL);
176 pixman_box32_t * cbox = pixman_region32_rectangles (clip, NULL);
179 if (rbox->x1 < (v = cbox->x1 + dx))
181 if (rbox->x2 > (v = cbox->x2 + dx))
183 if (rbox->y1 < (v = cbox->y1 + dy))
185 if (rbox->y2 > (v = cbox->y2 + dy))
187 if (rbox->x1 >= rbox->x2 || rbox->y1 >= rbox->y2)
189 pixman_region32_init (region);
193 else if (!pixman_region32_not_empty (clip))
200 pixman_region32_translate (region, -dx, -dy);
202 if (!pixman_region32_intersect (region, region, clip))
206 pixman_region32_translate (region, dx, dy);
209 return pixman_region32_not_empty (region);
212 static inline pixman_bool_t
213 clip_source_image (pixman_region32_t * region,
214 pixman_image_t * image,
218 /* Source clips are ignored, unless they are explicitly turned on
219 * and the clip in question was set by an X client. (Because if
220 * the clip was not set by a client, then it is a hierarchy
221 * clip and those should always be ignored for sources).
223 if (!image->common.clip_sources || !image->common.client_clip)
226 return clip_general_image (region,
227 &image->common.clip_region,
232 * returns FALSE if the final region is empty. Indistinguishable from
233 * an allocation failure, but rendering ignores those anyways.
236 pixman_compute_composite_region32 (pixman_region32_t * region,
237 pixman_image_t * src_image,
238 pixman_image_t * mask_image,
239 pixman_image_t * dst_image,
249 region->extents.x1 = dest_x;
250 region->extents.x2 = dest_x + width;
251 region->extents.y1 = dest_y;
252 region->extents.y2 = dest_y + height;
254 region->extents.x1 = MAX (region->extents.x1, 0);
255 region->extents.y1 = MAX (region->extents.y1, 0);
256 region->extents.x2 = MIN (region->extents.x2, dst_image->bits.width);
257 region->extents.y2 = MIN (region->extents.y2, dst_image->bits.height);
261 /* Check for empty operation */
262 if (region->extents.x1 >= region->extents.x2 ||
263 region->extents.y1 >= region->extents.y2)
265 pixman_region32_init (region);
269 if (dst_image->common.have_clip_region)
271 if (!clip_general_image (region, &dst_image->common.clip_region, 0, 0))
273 pixman_region32_fini (region);
278 if (dst_image->common.alpha_map && dst_image->common.alpha_map->common.have_clip_region)
280 if (!clip_general_image (region, &dst_image->common.alpha_map->common.clip_region,
281 -dst_image->common.alpha_origin_x,
282 -dst_image->common.alpha_origin_y))
284 pixman_region32_fini (region);
289 /* clip against src */
290 if (src_image->common.have_clip_region)
292 if (!clip_source_image (region, src_image, dest_x - src_x, dest_y - src_y))
294 pixman_region32_fini (region);
298 if (src_image->common.alpha_map && src_image->common.alpha_map->common.have_clip_region)
300 if (!clip_source_image (region, (pixman_image_t *)src_image->common.alpha_map,
301 dest_x - (src_x - src_image->common.alpha_origin_x),
302 dest_y - (src_y - src_image->common.alpha_origin_y)))
304 pixman_region32_fini (region);
308 /* clip against mask */
309 if (mask_image && mask_image->common.have_clip_region)
311 if (!clip_source_image (region, mask_image, dest_x - mask_x, dest_y - mask_y))
313 pixman_region32_fini (region);
316 if (mask_image->common.alpha_map && mask_image->common.alpha_map->common.have_clip_region)
318 if (!clip_source_image (region, (pixman_image_t *)mask_image->common.alpha_map,
319 dest_x - (mask_x - mask_image->common.alpha_origin_x),
320 dest_y - (mask_y - mask_image->common.alpha_origin_y)))
322 pixman_region32_fini (region);
332 walk_region_internal (pixman_implementation_t *imp,
334 pixman_image_t * src_image,
335 pixman_image_t * mask_image,
336 pixman_image_t * dst_image,
345 pixman_bool_t src_repeat,
346 pixman_bool_t mask_repeat,
347 pixman_region32_t * region,
348 pixman_composite_func_t composite_rect)
350 int w, h, w_this, h_this;
351 int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
352 int src_dy = src_y - dest_y;
353 int src_dx = src_x - dest_x;
354 int mask_dy = mask_y - dest_y;
355 int mask_dx = mask_x - dest_x;
356 const pixman_box32_t *pbox;
359 pbox = pixman_region32_rectangles (region, &n);
361 /* Fast path for non-repeating sources */
362 if (!src_repeat && !mask_repeat)
366 (*composite_rect) (imp, op,
367 src_image, mask_image, dst_image,
375 pbox->y2 - pbox->y1);
385 h = pbox->y2 - pbox->y1;
386 y_src = pbox->y1 + src_dy;
387 y_msk = pbox->y1 + mask_dy;
393 w = pbox->x2 - pbox->x1;
394 x_src = pbox->x1 + src_dx;
395 x_msk = pbox->x1 + mask_dx;
400 y_msk = MOD (y_msk, mask_image->bits.height);
401 if (h_this > mask_image->bits.height - y_msk)
402 h_this = mask_image->bits.height - y_msk;
407 y_src = MOD (y_src, src_image->bits.height);
408 if (h_this > src_image->bits.height - y_src)
409 h_this = src_image->bits.height - y_src;
418 x_msk = MOD (x_msk, mask_image->bits.width);
419 if (w_this > mask_image->bits.width - x_msk)
420 w_this = mask_image->bits.width - x_msk;
425 x_src = MOD (x_src, src_image->bits.width);
426 if (w_this > src_image->bits.width - x_src)
427 w_this = src_image->bits.width - x_src;
430 (*composite_rect) (imp, op,
431 src_image, mask_image, dst_image,
432 x_src, y_src, x_msk, y_msk, x_dst, y_dst,
452 get_image_info (pixman_image_t *image,
453 pixman_format_code_t *code,
456 *flags = image->common.flags;
458 if (_pixman_image_is_solid (image))
460 *code = PIXMAN_solid;
462 else if (image->common.type == BITS)
464 *code = image->bits.format;
466 if (!image->common.transform && image->common.repeat == PIXMAN_REPEAT_NORMAL)
467 *flags |= FAST_PATH_SIMPLE_REPEAT;
471 *code = PIXMAN_unknown;
475 static force_inline pixman_bool_t
476 image_covers (pixman_image_t *image,
477 pixman_box32_t *extents,
481 if (image->common.type == BITS &&
482 image->common.repeat == PIXMAN_REPEAT_NONE)
484 if (x > extents->x1 || y > extents->y1 ||
485 x + image->bits.width < extents->x2 ||
486 y + image->bits.height < extents->y2)
496 do_composite (pixman_implementation_t *imp,
499 pixman_image_t *mask,
500 pixman_image_t *dest,
510 pixman_format_code_t src_format, mask_format, dest_format;
511 uint32_t src_flags, mask_flags, dest_flags;
512 pixman_region32_t region;
513 pixman_box32_t *extents;
515 get_image_info (src, &src_format, &src_flags);
518 get_image_info (mask, &mask_format, &mask_flags);
522 mask_format = PIXMAN_null;
525 get_image_info (dest, &dest_format, &dest_flags);
527 /* Check for pixbufs */
528 if ((mask_format == PIXMAN_a8r8g8b8 || mask_format == PIXMAN_a8b8g8r8) &&
529 (src->type == BITS && src->bits.bits == mask->bits.bits) &&
530 (src->common.repeat == mask->common.repeat) &&
531 (src_x == mask_x && src_y == mask_y))
533 if (src_format == PIXMAN_x8b8g8r8)
534 src_format = mask_format = PIXMAN_pixbuf;
535 else if (src_format == PIXMAN_x8r8g8b8)
536 src_format = mask_format = PIXMAN_rpixbuf;
539 pixman_region32_init (®ion);
541 if (!pixman_compute_composite_region32 (
542 ®ion, src, mask, dest,
543 src_x, src_y, mask_x, mask_y, dest_x, dest_y, width, height))
548 extents = pixman_region32_extents (®ion);
550 if (image_covers (src, extents, dest_x - src_x, dest_y - src_y))
551 src_flags |= FAST_PATH_COVERS_CLIP;
553 if (mask && image_covers (mask, extents, dest_x - mask_x, dest_y - mask_y))
554 mask_flags |= FAST_PATH_COVERS_CLIP;
558 const pixman_fast_path_t *info;
560 for (info = imp->fast_paths; info->op != PIXMAN_OP_NONE; ++info)
562 if ((info->op == op || info->op == PIXMAN_OP_any) &&
564 ((info->src_format == src_format) ||
565 (info->src_format == PIXMAN_any)) &&
566 (info->src_flags & src_flags) == info->src_flags &&
568 ((info->mask_format == mask_format) ||
569 (info->mask_format == PIXMAN_any)) &&
570 (info->mask_flags & mask_flags) == info->mask_flags &&
572 ((info->dest_format == dest_format) ||
573 (info->dest_format == PIXMAN_any)) &&
574 (info->dest_flags & dest_flags) == info->dest_flags)
576 walk_region_internal (imp, op,
578 src_x, src_y, mask_x, mask_y,
581 (src_flags & FAST_PATH_SIMPLE_REPEAT),
582 (mask_flags & FAST_PATH_SIMPLE_REPEAT),
594 pixman_region32_fini (®ion);
598 * Work around GCC bug causing crashes in Mozilla with SSE2
600 * When using -msse, gcc generates movdqa instructions assuming that
601 * the stack is 16 byte aligned. Unfortunately some applications, such
602 * as Mozilla and Mono, end up aligning the stack to 4 bytes, which
603 * causes the movdqa instructions to fail.
605 * The __force_align_arg_pointer__ makes gcc generate a prologue that
606 * realigns the stack pointer to 16 bytes.
608 * On x86-64 this is not necessary because the standard ABI already
609 * calls for a 16 byte aligned stack.
611 * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
613 #if defined (USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
614 __attribute__((__force_align_arg_pointer__))
617 pixman_image_composite (pixman_op_t op,
618 pixman_image_t * src,
619 pixman_image_t * mask,
620 pixman_image_t * dest,
630 pixman_image_composite32 (op, src, mask, dest, src_x, src_y,
631 mask_x, mask_y, dest_x, dest_y, width, height);
635 pixman_image_composite32 (pixman_op_t op,
636 pixman_image_t * src,
637 pixman_image_t * mask,
638 pixman_image_t * dest,
651 int mask_dx, mask_dy;
653 int dest_dx, dest_dy;
654 pixman_bool_t need_workaround;
656 _pixman_image_validate (src);
658 _pixman_image_validate (mask);
659 _pixman_image_validate (dest);
662 * Check if we can replace our operator by a simpler one
663 * if the src or dest are opaque. The output operator should be
664 * mathematically equivalent to the source.
666 op = pixman_optimize_operator(op, src, mask, dest);
667 if (op == PIXMAN_OP_DST ||
668 op == PIXMAN_OP_CONJOINT_DST ||
669 op == PIXMAN_OP_DISJOINT_DST)
675 imp = _pixman_choose_implementation ();
678 (src->common.need_workaround) ||
679 (mask && mask->common.need_workaround) ||
680 (dest->common.need_workaround);
684 apply_workaround (src, &src_x, &src_y, &src_bits, &src_dx, &src_dy);
685 apply_workaround (mask, &mask_x, &mask_y, &mask_bits, &mask_dx, &mask_dy);
686 apply_workaround (dest, &dest_x, &dest_y, &dest_bits, &dest_dx, &dest_dy);
689 do_composite (imp, op,
698 if (src->common.need_workaround)
699 unapply_workaround (src, src_bits, src_dx, src_dy);
700 if (mask && mask->common.need_workaround)
701 unapply_workaround (mask, mask_bits, mask_dx, mask_dy);
702 if (dest->common.need_workaround)
703 unapply_workaround (dest, dest_bits, dest_dx, dest_dy);
707 PIXMAN_EXPORT pixman_bool_t
708 pixman_blt (uint32_t *src_bits,
722 imp = _pixman_choose_implementation ();
724 return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
731 PIXMAN_EXPORT pixman_bool_t
732 pixman_fill (uint32_t *bits,
742 imp = _pixman_choose_implementation ();
744 return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
748 color_to_uint32 (const pixman_color_t *color)
751 (color->alpha >> 8 << 24) |
752 (color->red >> 8 << 16) |
753 (color->green & 0xff00) |
758 color_to_pixel (pixman_color_t * color,
760 pixman_format_code_t format)
762 uint32_t c = color_to_uint32 (color);
764 if (!(format == PIXMAN_a8r8g8b8 ||
765 format == PIXMAN_x8r8g8b8 ||
766 format == PIXMAN_a8b8g8r8 ||
767 format == PIXMAN_x8b8g8r8 ||
768 format == PIXMAN_b8g8r8a8 ||
769 format == PIXMAN_b8g8r8x8 ||
770 format == PIXMAN_r5g6b5 ||
771 format == PIXMAN_b5g6r5 ||
772 format == PIXMAN_a8))
777 if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
779 c = ((c & 0xff000000) >> 0) |
780 ((c & 0x00ff0000) >> 16) |
781 ((c & 0x0000ff00) >> 0) |
782 ((c & 0x000000ff) << 16);
784 if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_BGRA)
786 c = ((c & 0xff000000) >> 24) |
787 ((c & 0x00ff0000) >> 8) |
788 ((c & 0x0000ff00) << 8) |
789 ((c & 0x000000ff) << 24);
792 if (format == PIXMAN_a8)
794 else if (format == PIXMAN_r5g6b5 ||
795 format == PIXMAN_b5g6r5)
796 c = CONVERT_8888_TO_0565 (c);
799 printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
800 printf ("pixel: %x\n", c);
807 PIXMAN_EXPORT pixman_bool_t
808 pixman_image_fill_rectangles (pixman_op_t op,
809 pixman_image_t * dest,
810 pixman_color_t * color,
812 const pixman_rectangle16_t *rects)
814 pixman_box32_t stack_boxes[6];
815 pixman_box32_t *boxes;
816 pixman_bool_t result;
821 boxes = pixman_malloc_ab (sizeof (pixman_box32_t), n_rects);
830 for (i = 0; i < n_rects; ++i)
832 boxes[i].x1 = rects[i].x;
833 boxes[i].y1 = rects[i].y;
834 boxes[i].x2 = boxes[i].x1 + rects[i].width;
835 boxes[i].y2 = boxes[i].y1 + rects[i].height;
838 result = pixman_image_fill_boxes (op, dest, color, n_rects, boxes);
840 if (boxes != stack_boxes)
846 PIXMAN_EXPORT pixman_bool_t
847 pixman_image_fill_boxes (pixman_op_t op,
848 pixman_image_t * dest,
849 pixman_color_t * color,
851 const pixman_box32_t *boxes)
853 pixman_image_t *solid;
857 _pixman_image_validate (dest);
859 if (color->alpha == 0xffff)
861 if (op == PIXMAN_OP_OVER)
865 if (op == PIXMAN_OP_CLEAR)
877 if (op == PIXMAN_OP_SRC)
881 if (color_to_pixel (color, &pixel, dest->bits.format))
883 pixman_region32_t fill_region;
885 pixman_box32_t *rects;
887 if (!pixman_region32_init_rects (&fill_region, boxes, n_boxes))
890 if (dest->common.have_clip_region)
892 if (!pixman_region32_intersect (&fill_region,
894 &dest->common.clip_region))
898 rects = pixman_region32_rectangles (&fill_region, &n_rects);
899 for (j = 0; j < n_rects; ++j)
901 const pixman_box32_t *rect = &(rects[j]);
902 pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
903 rect->x1, rect->y1, rect->x2 - rect->x1, rect->y2 - rect->y1,
907 pixman_region32_fini (&fill_region);
912 solid = pixman_image_create_solid_fill (color);
916 for (i = 0; i < n_boxes; ++i)
918 const pixman_box32_t *box = &(boxes[i]);
920 pixman_image_composite32 (op, solid, NULL, dest,
923 box->x2 - box->x1, box->y2 - box->y1);
926 pixman_image_unref (solid);
934 * Returns the version of the pixman library encoded in a single
935 * integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that
936 * later versions compare greater than earlier versions.
938 * A run-time comparison to check that pixman's version is greater than
939 * or equal to version X.Y.Z could be performed as follows:
941 * <informalexample><programlisting>
942 * if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...}
943 * </programlisting></informalexample>
945 * See also pixman_version_string() as well as the compile-time
946 * equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING.
948 * Return value: the encoded version.
951 pixman_version (void)
953 return PIXMAN_VERSION;
957 * pixman_version_string:
959 * Returns the version of the pixman library as a human-readable string
960 * of the form "X.Y.Z".
962 * See also pixman_version() as well as the compile-time equivalents
963 * %PIXMAN_VERSION_STRING and %PIXMAN_VERSION.
965 * Return value: a string containing the version.
967 PIXMAN_EXPORT const char*
968 pixman_version_string (void)
970 return PIXMAN_VERSION_STRING;
974 * pixman_format_supported_source:
975 * @format: A pixman_format_code_t format
977 * Return value: whether the provided format code is a supported
978 * format for a pixman surface used as a source in
981 * Currently, all pixman_format_code_t values are supported.
983 PIXMAN_EXPORT pixman_bool_t
984 pixman_format_supported_source (pixman_format_code_t format)
989 case PIXMAN_a2b10g10r10:
990 case PIXMAN_x2b10g10r10:
991 case PIXMAN_a2r10g10b10:
992 case PIXMAN_x2r10g10b10:
993 case PIXMAN_a8r8g8b8:
994 case PIXMAN_x8r8g8b8:
995 case PIXMAN_a8b8g8r8:
996 case PIXMAN_x8b8g8r8:
997 case PIXMAN_b8g8r8a8:
998 case PIXMAN_b8g8r8x8:
1003 /* 16 bpp formats */
1004 case PIXMAN_a1r5g5b5:
1005 case PIXMAN_x1r5g5b5:
1006 case PIXMAN_a1b5g5r5:
1007 case PIXMAN_x1b5g5r5:
1008 case PIXMAN_a4r4g4b4:
1009 case PIXMAN_x4r4g4b4:
1010 case PIXMAN_a4b4g4r4:
1011 case PIXMAN_x4b4g4r4:
1016 case PIXMAN_a2r2g2b2:
1017 case PIXMAN_a2b2g2r2:
1021 /* Collides with PIXMAN_c8
1024 /* Collides with PIXMAN_g8
1031 case PIXMAN_a1r1g1b1:
1032 case PIXMAN_a1b1g1r1:
1049 * pixman_format_supported_destination:
1050 * @format: A pixman_format_code_t format
1052 * Return value: whether the provided format code is a supported
1053 * format for a pixman surface used as a destination in
1056 * Currently, all pixman_format_code_t values are supported
1057 * except for the YUV formats.
1059 PIXMAN_EXPORT pixman_bool_t
1060 pixman_format_supported_destination (pixman_format_code_t format)
1062 /* YUV formats cannot be written to at the moment */
1063 if (format == PIXMAN_yuy2 || format == PIXMAN_yv12)
1066 return pixman_format_supported_source (format);
1069 PIXMAN_EXPORT pixman_bool_t
1070 pixman_compute_composite_region (pixman_region16_t * region,
1071 pixman_image_t * src_image,
1072 pixman_image_t * mask_image,
1073 pixman_image_t * dst_image,
1083 pixman_region32_t r32;
1084 pixman_bool_t retval;
1086 pixman_region32_init (&r32);
1088 retval = pixman_compute_composite_region32 (
1089 &r32, src_image, mask_image, dst_image,
1090 src_x, src_y, mask_x, mask_y, dest_x, dest_y,
1095 if (!pixman_region16_copy_from_region32 (region, &r32))
1099 pixman_region32_fini (&r32);