2 * This work is licensed under the terms of the GNU GPL, version 2 or later.
3 * See the COPYING file in the top-level directory.
6 #include "qemu-pixman.h"
8 int qemu_pixman_get_type(int rshift
, int gshift
, int bshift
)
10 int type
= PIXMAN_TYPE_OTHER
;
12 if (rshift
> gshift
&& gshift
> bshift
) {
14 type
= PIXMAN_TYPE_ARGB
;
16 #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)
17 type
= PIXMAN_TYPE_RGBA
;
20 } else if (rshift
< gshift
&& gshift
< bshift
) {
22 type
= PIXMAN_TYPE_ABGR
;
24 #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)
25 type
= PIXMAN_TYPE_BGRA
;
32 pixman_format_code_t
qemu_pixman_get_format(PixelFormat
*pf
)
34 pixman_format_code_t format
;
37 type
= qemu_pixman_get_type(pf
->rshift
, pf
->gshift
, pf
->bshift
);
38 format
= PIXMAN_FORMAT(pf
->bits_per_pixel
, type
,
39 pf
->abits
, pf
->rbits
, pf
->gbits
, pf
->bbits
);
40 if (!pixman_format_supported_source(format
)) {
46 pixman_image_t
*qemu_pixman_linebuf_create(pixman_format_code_t format
,
49 pixman_image_t
*image
= pixman_image_create_bits(format
, width
, 1, NULL
, 0);
50 assert(image
!= NULL
);
54 void qemu_pixman_linebuf_fill(pixman_image_t
*linebuf
, pixman_image_t
*fb
,
57 pixman_image_composite(PIXMAN_OP_SRC
, fb
, NULL
, linebuf
,
58 0, y
, 0, 0, 0, 0, width
, 1);
61 pixman_image_t
*qemu_pixman_mirror_create(pixman_format_code_t format
,
62 pixman_image_t
*image
)
64 pixman_image_t
*mirror
;
66 mirror
= pixman_image_create_bits(format
,
67 pixman_image_get_width(image
),
68 pixman_image_get_height(image
),
70 pixman_image_get_stride(image
));
74 void qemu_pixman_image_unref(pixman_image_t
*image
)
79 pixman_image_unref(image
);