]> git.proxmox.com Git - mirror_qemu.git/blame - qemu-pixman.c
qxl: call dpy_gfx_resize when entering vga mode
[mirror_qemu.git] / qemu-pixman.c
CommitLineData
d2ec7e24
GH
1#include "qemu-pixman.h"
2
3int qemu_pixman_get_type(int rshift, int gshift, int bshift)
4{
5 int type = PIXMAN_TYPE_OTHER;
6
7 if (rshift > gshift && gshift > bshift) {
8 if (bshift == 0) {
9 type = PIXMAN_TYPE_ARGB;
10 } else {
11#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)
12 type = PIXMAN_TYPE_RGBA;
13#endif
14 }
15 } else if (rshift < gshift && gshift < bshift) {
16 if (rshift == 0) {
17 type = PIXMAN_TYPE_ABGR;
18 } else {
19 type = PIXMAN_TYPE_BGRA;
20 }
21 }
22 return type;
23}
24
25pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf)
26{
27 pixman_format_code_t format;
28 int type;
29
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)) {
34 return 0;
35 }
36 return format;
37}
38
39pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
40 int width)
41{
42 pixman_image_t *image = pixman_image_create_bits(format, width, 1, NULL, 0);
43 assert(image != NULL);
44 return image;
45}
46
47void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb,
48 int width, int y)
49{
50 pixman_image_composite(PIXMAN_OP_SRC, fb, NULL, linebuf,
51 0, y, 0, 0, 0, 0, width, 1);
52}
53
54void qemu_pixman_image_unref(pixman_image_t *image)
55{
56 if (image == NULL) {
57 return;
58 }
59 pixman_image_unref(image);
60}