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);
91 if (!info || mask_image)
94 is_source_opaque = src_image->common.flags & FAST_PATH_IS_OPAQUE;
95 is_dest_opaque = dst_image->common.flags & FAST_PATH_IS_OPAQUE;
97 if (!is_source_opaque && !is_dest_opaque)
100 if (is_source_opaque && is_dest_opaque)
101 return info->op_src_dst_opaque;
102 else if (is_source_opaque)
103 return info->op_src_opaque;
104 else if (is_dest_opaque)
105 return info->op_dst_opaque;
112 apply_workaround (pixman_image_t *image,
115 uint32_t ** save_bits,
119 if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
121 /* Some X servers generate images that point to the
122 * wrong place in memory, but then set the clip region
123 * to point to the right place. Because of an old bug
124 * in pixman, this would actually work.
126 * Here we try and undo the damage
128 int bpp = PIXMAN_FORMAT_BPP (image->bits.format) / 8;
129 pixman_box32_t *extents;
133 extents = pixman_region32_extents (&(image->common.clip_region));
137 *save_bits = image->bits.bits;
141 pixman_region32_translate (&(image->common.clip_region), -dx, -dy);
143 t = (uint8_t *)image->bits.bits;
144 t += dy * image->bits.rowstride * 4 + dx * bpp;
145 image->bits.bits = (uint32_t *)t;
153 unapply_workaround (pixman_image_t *image, uint32_t *bits, int dx, int dy)
155 if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
157 image->bits.bits = bits;
158 pixman_region32_translate (&image->common.clip_region, dx, dy);
163 * Computing composite region
165 static inline pixman_bool_t
166 clip_general_image (pixman_region32_t * region,
167 pixman_region32_t * clip,
171 if (pixman_region32_n_rects (region) == 1 &&
172 pixman_region32_n_rects (clip) == 1)
174 pixman_box32_t * rbox = pixman_region32_rectangles (region, NULL);
175 pixman_box32_t * cbox = pixman_region32_rectangles (clip, NULL);
178 if (rbox->x1 < (v = cbox->x1 + dx))
180 if (rbox->x2 > (v = cbox->x2 + dx))
182 if (rbox->y1 < (v = cbox->y1 + dy))
184 if (rbox->y2 > (v = cbox->y2 + dy))
186 if (rbox->x1 >= rbox->x2 || rbox->y1 >= rbox->y2)
188 pixman_region32_init (region);
192 else if (!pixman_region32_not_empty (clip))
199 pixman_region32_translate (region, -dx, -dy);
201 if (!pixman_region32_intersect (region, region, clip))
205 pixman_region32_translate (region, dx, dy);
208 return pixman_region32_not_empty (region);
211 static inline pixman_bool_t
212 clip_source_image (pixman_region32_t * region,
213 pixman_image_t * image,
217 /* Source clips are ignored, unless they are explicitly turned on
218 * and the clip in question was set by an X client. (Because if
219 * the clip was not set by a client, then it is a hierarchy
220 * clip and those should always be ignored for sources).
222 if (!image->common.clip_sources || !image->common.client_clip)
225 return clip_general_image (region,
226 &image->common.clip_region,
231 * returns FALSE if the final region is empty. Indistinguishable from
232 * an allocation failure, but rendering ignores those anyways.
235 pixman_compute_composite_region32 (pixman_region32_t * region,
236 pixman_image_t * src_image,
237 pixman_image_t * mask_image,
238 pixman_image_t * dst_image,
248 region->extents.x1 = dest_x;
249 region->extents.x2 = dest_x + width;
250 region->extents.y1 = dest_y;
251 region->extents.y2 = dest_y + height;
253 region->extents.x1 = MAX (region->extents.x1, 0);
254 region->extents.y1 = MAX (region->extents.y1, 0);
255 region->extents.x2 = MIN (region->extents.x2, dst_image->bits.width);
256 region->extents.y2 = MIN (region->extents.y2, dst_image->bits.height);
260 /* Check for empty operation */
261 if (region->extents.x1 >= region->extents.x2 ||
262 region->extents.y1 >= region->extents.y2)
264 pixman_region32_init (region);
268 if (dst_image->common.have_clip_region)
270 if (!clip_general_image (region, &dst_image->common.clip_region, 0, 0))
272 pixman_region32_fini (region);
277 if (dst_image->common.alpha_map && dst_image->common.alpha_map->common.have_clip_region)
279 if (!clip_general_image (region, &dst_image->common.alpha_map->common.clip_region,
280 -dst_image->common.alpha_origin_x,
281 -dst_image->common.alpha_origin_y))
283 pixman_region32_fini (region);
288 /* clip against src */
289 if (src_image->common.have_clip_region)
291 if (!clip_source_image (region, src_image, dest_x - src_x, dest_y - src_y))
293 pixman_region32_fini (region);
297 if (src_image->common.alpha_map && src_image->common.alpha_map->common.have_clip_region)
299 if (!clip_source_image (region, (pixman_image_t *)src_image->common.alpha_map,
300 dest_x - (src_x - src_image->common.alpha_origin_x),
301 dest_y - (src_y - src_image->common.alpha_origin_y)))
303 pixman_region32_fini (region);
307 /* clip against mask */
308 if (mask_image && mask_image->common.have_clip_region)
310 if (!clip_source_image (region, mask_image, dest_x - mask_x, dest_y - mask_y))
312 pixman_region32_fini (region);
315 if (mask_image->common.alpha_map && mask_image->common.alpha_map->common.have_clip_region)
317 if (!clip_source_image (region, (pixman_image_t *)mask_image->common.alpha_map,
318 dest_x - (mask_x - mask_image->common.alpha_origin_x),
319 dest_y - (mask_y - mask_image->common.alpha_origin_y)))
321 pixman_region32_fini (region);
331 walk_region_internal (pixman_implementation_t *imp,
333 pixman_image_t * src_image,
334 pixman_image_t * mask_image,
335 pixman_image_t * dst_image,
344 pixman_bool_t src_repeat,
345 pixman_bool_t mask_repeat,
346 pixman_region32_t * region,
347 pixman_composite_func_t composite_rect)
349 int w, h, w_this, h_this;
350 int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
351 int src_dy = src_y - dest_y;
352 int src_dx = src_x - dest_x;
353 int mask_dy = mask_y - dest_y;
354 int mask_dx = mask_x - dest_x;
355 const pixman_box32_t *pbox;
358 pbox = pixman_region32_rectangles (region, &n);
360 /* Fast path for non-repeating sources */
361 if (!src_repeat && !mask_repeat)
365 (*composite_rect) (imp, op,
366 src_image, mask_image, dst_image,
374 pbox->y2 - pbox->y1);
384 h = pbox->y2 - pbox->y1;
385 y_src = pbox->y1 + src_dy;
386 y_msk = pbox->y1 + mask_dy;
392 w = pbox->x2 - pbox->x1;
393 x_src = pbox->x1 + src_dx;
394 x_msk = pbox->x1 + mask_dx;
399 y_msk = MOD (y_msk, mask_image->bits.height);
400 if (h_this > mask_image->bits.height - y_msk)
401 h_this = mask_image->bits.height - y_msk;
406 y_src = MOD (y_src, src_image->bits.height);
407 if (h_this > src_image->bits.height - y_src)
408 h_this = src_image->bits.height - y_src;
417 x_msk = MOD (x_msk, mask_image->bits.width);
418 if (w_this > mask_image->bits.width - x_msk)
419 w_this = mask_image->bits.width - x_msk;
424 x_src = MOD (x_src, src_image->bits.width);
425 if (w_this > src_image->bits.width - x_src)
426 w_this = src_image->bits.width - x_src;
429 (*composite_rect) (imp, op,
430 src_image, mask_image, dst_image,
431 x_src, y_src, x_msk, y_msk, x_dst, y_dst,
450 static force_inline pixman_bool_t
451 image_covers (pixman_image_t *image,
452 pixman_box32_t *extents,
456 if (image->common.type == BITS &&
457 image->common.repeat == PIXMAN_REPEAT_NONE)
459 if (x > extents->x1 || y > extents->y1 ||
460 x + image->bits.width < extents->x2 ||
461 y + image->bits.height < extents->y2)
471 do_composite (pixman_implementation_t *imp,
474 pixman_image_t *mask,
475 pixman_image_t *dest,
485 pixman_format_code_t src_format, mask_format, dest_format;
486 uint32_t src_flags, mask_flags, dest_flags;
487 pixman_region32_t region;
488 pixman_box32_t *extents;
492 int mask_dx, mask_dy;
494 int dest_dx, dest_dy;
495 pixman_bool_t need_workaround;
497 src_format = src->common.extended_format_code;
498 src_flags = src->common.flags;
502 mask_format = mask->common.extended_format_code;
503 mask_flags = mask->common.flags;
507 mask_format = PIXMAN_null;
511 dest_format = dest->common.extended_format_code;
512 dest_flags = dest->common.flags;
514 /* Check for pixbufs */
515 if ((mask_format == PIXMAN_a8r8g8b8 || mask_format == PIXMAN_a8b8g8r8) &&
516 (src->type == BITS && src->bits.bits == mask->bits.bits) &&
517 (src->common.repeat == mask->common.repeat) &&
518 (src_x == mask_x && src_y == mask_y))
520 if (src_format == PIXMAN_x8b8g8r8)
521 src_format = mask_format = PIXMAN_pixbuf;
522 else if (src_format == PIXMAN_x8r8g8b8)
523 src_format = mask_format = PIXMAN_rpixbuf;
526 /* Check for workaround */
527 need_workaround = (src_flags | mask_flags | dest_flags) & FAST_PATH_NEEDS_WORKAROUND;
531 apply_workaround (src, &src_x, &src_y, &src_bits, &src_dx, &src_dy);
532 apply_workaround (mask, &mask_x, &mask_y, &mask_bits, &mask_dx, &mask_dy);
533 apply_workaround (dest, &dest_x, &dest_y, &dest_bits, &dest_dx, &dest_dy);
536 pixman_region32_init (®ion);
538 if (!pixman_compute_composite_region32 (
539 ®ion, src, mask, dest,
540 src_x, src_y, mask_x, mask_y, dest_x, dest_y, width, height))
545 extents = pixman_region32_extents (®ion);
547 if (image_covers (src, extents, dest_x - src_x, dest_y - src_y))
548 src_flags |= FAST_PATH_COVERS_CLIP;
550 if (mask && image_covers (mask, extents, dest_x - mask_x, dest_y - mask_y))
551 mask_flags |= FAST_PATH_COVERS_CLIP;
555 const pixman_fast_path_t *info;
557 for (info = imp->fast_paths; info->op != PIXMAN_OP_NONE; ++info)
559 if ((info->op == op || info->op == PIXMAN_OP_any) &&
561 ((info->src_format == src_format) ||
562 (info->src_format == PIXMAN_any)) &&
563 (info->src_flags & src_flags) == info->src_flags &&
565 ((info->mask_format == mask_format) ||
566 (info->mask_format == PIXMAN_any)) &&
567 (info->mask_flags & mask_flags) == info->mask_flags &&
569 ((info->dest_format == dest_format) ||
570 (info->dest_format == PIXMAN_any)) &&
571 (info->dest_flags & dest_flags) == info->dest_flags)
573 walk_region_internal (imp, op,
575 src_x, src_y, mask_x, mask_y,
578 (src_flags & FAST_PATH_SIMPLE_REPEAT),
579 (mask_flags & FAST_PATH_SIMPLE_REPEAT),
593 unapply_workaround (src, src_bits, src_dx, src_dy);
594 unapply_workaround (mask, mask_bits, mask_dx, mask_dy);
595 unapply_workaround (dest, dest_bits, dest_dx, dest_dy);
598 pixman_region32_fini (®ion);
602 * Work around GCC bug causing crashes in Mozilla with SSE2
604 * When using -msse, gcc generates movdqa instructions assuming that
605 * the stack is 16 byte aligned. Unfortunately some applications, such
606 * as Mozilla and Mono, end up aligning the stack to 4 bytes, which
607 * causes the movdqa instructions to fail.
609 * The __force_align_arg_pointer__ makes gcc generate a prologue that
610 * realigns the stack pointer to 16 bytes.
612 * On x86-64 this is not necessary because the standard ABI already
613 * calls for a 16 byte aligned stack.
615 * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
617 #if defined (USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
618 __attribute__((__force_align_arg_pointer__))
621 pixman_image_composite (pixman_op_t op,
622 pixman_image_t * src,
623 pixman_image_t * mask,
624 pixman_image_t * dest,
634 pixman_image_composite32 (op, src, mask, dest, src_x, src_y,
635 mask_x, mask_y, dest_x, dest_y, width, height);
639 pixman_image_composite32 (pixman_op_t op,
640 pixman_image_t * src,
641 pixman_image_t * mask,
642 pixman_image_t * dest,
652 _pixman_image_validate (src);
654 _pixman_image_validate (mask);
655 _pixman_image_validate (dest);
658 * Check if we can replace our operator by a simpler one
659 * if the src or dest are opaque. The output operator should be
660 * mathematically equivalent to the source.
662 op = pixman_optimize_operator(op, src, mask, dest);
663 if (op == PIXMAN_OP_DST ||
664 op == PIXMAN_OP_CONJOINT_DST ||
665 op == PIXMAN_OP_DISJOINT_DST)
671 imp = _pixman_choose_implementation ();
673 do_composite (imp, op,
681 PIXMAN_EXPORT pixman_bool_t
682 pixman_blt (uint32_t *src_bits,
696 imp = _pixman_choose_implementation ();
698 return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
705 PIXMAN_EXPORT pixman_bool_t
706 pixman_fill (uint32_t *bits,
716 imp = _pixman_choose_implementation ();
718 return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
722 color_to_uint32 (const pixman_color_t *color)
725 (color->alpha >> 8 << 24) |
726 (color->red >> 8 << 16) |
727 (color->green & 0xff00) |
732 color_to_pixel (pixman_color_t * color,
734 pixman_format_code_t format)
736 uint32_t c = color_to_uint32 (color);
738 if (!(format == PIXMAN_a8r8g8b8 ||
739 format == PIXMAN_x8r8g8b8 ||
740 format == PIXMAN_a8b8g8r8 ||
741 format == PIXMAN_x8b8g8r8 ||
742 format == PIXMAN_b8g8r8a8 ||
743 format == PIXMAN_b8g8r8x8 ||
744 format == PIXMAN_r5g6b5 ||
745 format == PIXMAN_b5g6r5 ||
746 format == PIXMAN_a8))
751 if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
753 c = ((c & 0xff000000) >> 0) |
754 ((c & 0x00ff0000) >> 16) |
755 ((c & 0x0000ff00) >> 0) |
756 ((c & 0x000000ff) << 16);
758 if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_BGRA)
760 c = ((c & 0xff000000) >> 24) |
761 ((c & 0x00ff0000) >> 8) |
762 ((c & 0x0000ff00) << 8) |
763 ((c & 0x000000ff) << 24);
766 if (format == PIXMAN_a8)
768 else if (format == PIXMAN_r5g6b5 ||
769 format == PIXMAN_b5g6r5)
770 c = CONVERT_8888_TO_0565 (c);
773 printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
774 printf ("pixel: %x\n", c);
781 PIXMAN_EXPORT pixman_bool_t
782 pixman_image_fill_rectangles (pixman_op_t op,
783 pixman_image_t * dest,
784 pixman_color_t * color,
786 const pixman_rectangle16_t *rects)
788 pixman_box32_t stack_boxes[6];
789 pixman_box32_t *boxes;
790 pixman_bool_t result;
795 boxes = pixman_malloc_ab (sizeof (pixman_box32_t), n_rects);
804 for (i = 0; i < n_rects; ++i)
806 boxes[i].x1 = rects[i].x;
807 boxes[i].y1 = rects[i].y;
808 boxes[i].x2 = boxes[i].x1 + rects[i].width;
809 boxes[i].y2 = boxes[i].y1 + rects[i].height;
812 result = pixman_image_fill_boxes (op, dest, color, n_rects, boxes);
814 if (boxes != stack_boxes)
820 PIXMAN_EXPORT pixman_bool_t
821 pixman_image_fill_boxes (pixman_op_t op,
822 pixman_image_t * dest,
823 pixman_color_t * color,
825 const pixman_box32_t *boxes)
827 pixman_image_t *solid;
831 _pixman_image_validate (dest);
833 if (color->alpha == 0xffff)
835 if (op == PIXMAN_OP_OVER)
839 if (op == PIXMAN_OP_CLEAR)
851 if (op == PIXMAN_OP_SRC)
855 if (color_to_pixel (color, &pixel, dest->bits.format))
857 pixman_region32_t fill_region;
859 pixman_box32_t *rects;
861 if (!pixman_region32_init_rects (&fill_region, boxes, n_boxes))
864 if (dest->common.have_clip_region)
866 if (!pixman_region32_intersect (&fill_region,
868 &dest->common.clip_region))
872 rects = pixman_region32_rectangles (&fill_region, &n_rects);
873 for (j = 0; j < n_rects; ++j)
875 const pixman_box32_t *rect = &(rects[j]);
876 pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
877 rect->x1, rect->y1, rect->x2 - rect->x1, rect->y2 - rect->y1,
881 pixman_region32_fini (&fill_region);
886 solid = pixman_image_create_solid_fill (color);
890 for (i = 0; i < n_boxes; ++i)
892 const pixman_box32_t *box = &(boxes[i]);
894 pixman_image_composite32 (op, solid, NULL, dest,
897 box->x2 - box->x1, box->y2 - box->y1);
900 pixman_image_unref (solid);
908 * Returns the version of the pixman library encoded in a single
909 * integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that
910 * later versions compare greater than earlier versions.
912 * A run-time comparison to check that pixman's version is greater than
913 * or equal to version X.Y.Z could be performed as follows:
915 * <informalexample><programlisting>
916 * if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...}
917 * </programlisting></informalexample>
919 * See also pixman_version_string() as well as the compile-time
920 * equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING.
922 * Return value: the encoded version.
925 pixman_version (void)
927 return PIXMAN_VERSION;
931 * pixman_version_string:
933 * Returns the version of the pixman library as a human-readable string
934 * of the form "X.Y.Z".
936 * See also pixman_version() as well as the compile-time equivalents
937 * %PIXMAN_VERSION_STRING and %PIXMAN_VERSION.
939 * Return value: a string containing the version.
941 PIXMAN_EXPORT const char*
942 pixman_version_string (void)
944 return PIXMAN_VERSION_STRING;
948 * pixman_format_supported_source:
949 * @format: A pixman_format_code_t format
951 * Return value: whether the provided format code is a supported
952 * format for a pixman surface used as a source in
955 * Currently, all pixman_format_code_t values are supported.
957 PIXMAN_EXPORT pixman_bool_t
958 pixman_format_supported_source (pixman_format_code_t format)
963 case PIXMAN_a2b10g10r10:
964 case PIXMAN_x2b10g10r10:
965 case PIXMAN_a2r10g10b10:
966 case PIXMAN_x2r10g10b10:
967 case PIXMAN_a8r8g8b8:
968 case PIXMAN_x8r8g8b8:
969 case PIXMAN_a8b8g8r8:
970 case PIXMAN_x8b8g8r8:
971 case PIXMAN_b8g8r8a8:
972 case PIXMAN_b8g8r8x8:
978 case PIXMAN_a1r5g5b5:
979 case PIXMAN_x1r5g5b5:
980 case PIXMAN_a1b5g5r5:
981 case PIXMAN_x1b5g5r5:
982 case PIXMAN_a4r4g4b4:
983 case PIXMAN_x4r4g4b4:
984 case PIXMAN_a4b4g4r4:
985 case PIXMAN_x4b4g4r4:
990 case PIXMAN_a2r2g2b2:
991 case PIXMAN_a2b2g2r2:
995 /* Collides with PIXMAN_c8
998 /* Collides with PIXMAN_g8
1005 case PIXMAN_a1r1g1b1:
1006 case PIXMAN_a1b1g1r1:
1023 * pixman_format_supported_destination:
1024 * @format: A pixman_format_code_t format
1026 * Return value: whether the provided format code is a supported
1027 * format for a pixman surface used as a destination in
1030 * Currently, all pixman_format_code_t values are supported
1031 * except for the YUV formats.
1033 PIXMAN_EXPORT pixman_bool_t
1034 pixman_format_supported_destination (pixman_format_code_t format)
1036 /* YUV formats cannot be written to at the moment */
1037 if (format == PIXMAN_yuy2 || format == PIXMAN_yv12)
1040 return pixman_format_supported_source (format);
1043 PIXMAN_EXPORT pixman_bool_t
1044 pixman_compute_composite_region (pixman_region16_t * region,
1045 pixman_image_t * src_image,
1046 pixman_image_t * mask_image,
1047 pixman_image_t * dst_image,
1057 pixman_region32_t r32;
1058 pixman_bool_t retval;
1060 pixman_region32_init (&r32);
1062 retval = pixman_compute_composite_region32 (
1063 &r32, src_image, mask_image, dst_image,
1064 src_x, src_y, mask_x, mask_y, dest_x, dest_y,
1069 if (!pixman_region16_copy_from_region32 (region, &r32))
1073 pixman_region32_fini (&r32);