1
2
3
4
5
6#ifndef QEMU_PIXMAN_H
7#define QEMU_PIXMAN_H
8
9
10#pragma GCC diagnostic push
11#pragma GCC diagnostic ignored "-Wredundant-decls"
12#include <pixman.h>
13#pragma GCC diagnostic pop
14
15
16
17
18
19
20
21
22#ifdef HOST_WORDS_BIGENDIAN
23# define PIXMAN_BE_r8g8b8 PIXMAN_r8g8b8
24# define PIXMAN_BE_x8r8g8b8 PIXMAN_x8r8g8b8
25# define PIXMAN_BE_a8r8g8b8 PIXMAN_a8r8g8b8
26# define PIXMAN_BE_b8g8r8x8 PIXMAN_b8g8r8x8
27# define PIXMAN_BE_b8g8r8a8 PIXMAN_b8g8r8a8
28# define PIXMAN_BE_r8g8b8x8 PIXMAN_r8g8b8x8
29# define PIXMAN_BE_r8g8b8a8 PIXMAN_r8g8b8a8
30# define PIXMAN_BE_x8b8g8r8 PIXMAN_x8b8g8r8
31# define PIXMAN_BE_a8b8g8r8 PIXMAN_a8b8g8r8
32# define PIXMAN_LE_r8g8b8 PIXMAN_b8g8r8
33# define PIXMAN_LE_a8r8g8b8 PIXMAN_b8g8r8a8
34# define PIXMAN_LE_x8r8g8b8 PIXMAN_b8g8r8x8
35#else
36# define PIXMAN_BE_r8g8b8 PIXMAN_b8g8r8
37# define PIXMAN_BE_x8r8g8b8 PIXMAN_b8g8r8x8
38# define PIXMAN_BE_a8r8g8b8 PIXMAN_b8g8r8a8
39# define PIXMAN_BE_b8g8r8x8 PIXMAN_x8r8g8b8
40# define PIXMAN_BE_b8g8r8a8 PIXMAN_a8r8g8b8
41# define PIXMAN_BE_r8g8b8x8 PIXMAN_x8b8g8r8
42# define PIXMAN_BE_r8g8b8a8 PIXMAN_a8b8g8r8
43# define PIXMAN_BE_x8b8g8r8 PIXMAN_r8g8b8x8
44# define PIXMAN_BE_a8b8g8r8 PIXMAN_r8g8b8a8
45# define PIXMAN_LE_r8g8b8 PIXMAN_r8g8b8
46# define PIXMAN_LE_a8r8g8b8 PIXMAN_a8r8g8b8
47# define PIXMAN_LE_x8r8g8b8 PIXMAN_x8r8g8b8
48#endif
49
50
51
52typedef struct PixelFormat {
53 uint8_t bits_per_pixel;
54 uint8_t bytes_per_pixel;
55 uint8_t depth;
56 uint32_t rmask, gmask, bmask, amask;
57 uint8_t rshift, gshift, bshift, ashift;
58 uint8_t rmax, gmax, bmax, amax;
59 uint8_t rbits, gbits, bbits, abits;
60} PixelFormat;
61
62PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format);
63pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian);
64pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format);
65uint32_t qemu_pixman_to_drm_format(pixman_format_code_t pixman);
66int qemu_pixman_get_type(int rshift, int gshift, int bshift);
67pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf);
68bool qemu_pixman_check_format(DisplayChangeListener *dcl,
69 pixman_format_code_t format);
70
71pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
72 int width);
73void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb,
74 int width, int x, int y);
75void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y,
76 pixman_image_t *linebuf);
77pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
78 pixman_image_t *image);
79void qemu_pixman_image_unref(pixman_image_t *image);
80
81pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color);
82pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *font,
83 unsigned int ch);
84void qemu_pixman_glyph_render(pixman_image_t *glyph,
85 pixman_image_t *surface,
86 pixman_color_t *fgcol,
87 pixman_color_t *bgcol,
88 int x, int y, int cw, int ch);
89
90G_DEFINE_AUTOPTR_CLEANUP_FUNC(pixman_image_t, qemu_pixman_image_unref)
91
92#endif
93