1 #include "qemu-pixman.h"
3 int qemu_pixman_get_type(int rshift
, int gshift
, int bshift
)
5 int type
= PIXMAN_TYPE_OTHER
;
7 if (rshift
> gshift
&& gshift
> bshift
) {
9 type
= PIXMAN_TYPE_ARGB
;
11 #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)
12 type
= PIXMAN_TYPE_RGBA
;
15 } else if (rshift
< gshift
&& gshift
< bshift
) {
17 type
= PIXMAN_TYPE_ABGR
;
19 type
= PIXMAN_TYPE_BGRA
;
25 pixman_format_code_t
qemu_pixman_get_format(PixelFormat
*pf
)
27 pixman_format_code_t format
;
30 type
= qemu_pixman_get_type(pf
->rshift
, pf
->gshift
, pf
->bshift
);
31 format
= PIXMAN_FORMAT(pf
->bits_per_pixel
, type
,
32 pf
->abits
, pf
->rbits
, pf
->gbits
, pf
->bbits
);
33 if (!pixman_format_supported_source(format
)) {
39 pixman_image_t
*qemu_pixman_linebuf_create(pixman_format_code_t format
,
42 pixman_image_t
*image
= pixman_image_create_bits(format
, width
, 1, NULL
, 0);
43 assert(image
!= NULL
);
47 void qemu_pixman_linebuf_fill(pixman_image_t
*linebuf
, pixman_image_t
*fb
,
50 pixman_image_composite(PIXMAN_OP_SRC
, fb
, NULL
, linebuf
,
51 0, y
, 0, 0, 0, 0, width
, 1);
54 pixman_image_t
*qemu_pixman_mirror_create(pixman_format_code_t format
,
55 pixman_image_t
*image
)
57 pixman_image_t
*mirror
;
59 mirror
= pixman_image_create_bits(format
,
60 pixman_image_get_width(image
),
61 pixman_image_get_height(image
),
63 pixman_image_get_stride(image
));
67 void qemu_pixman_image_unref(pixman_image_t
*image
)
72 pixman_image_unref(image
);