Gerd Hoffmann | daa8e5a | 2012-11-13 09:38:06 +0100 | [diff] [blame] | 1 | /* |
| 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. |
| 4 | */ |
| 5 | |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 6 | #ifndef QEMU_PIXMAN_H |
| 7 | #define QEMU_PIXMAN_H |
| 8 | |
Gerd Hoffmann | 092bb30 | 2013-01-09 10:17:08 +0100 | [diff] [blame] | 9 | /* pixman-0.16.0 headers have a redundant declaration */ |
| 10 | #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE |
Markus Armbruster | e6f53fd | 2013-04-16 13:51:06 +0200 | [diff] [blame] | 11 | #pragma GCC diagnostic push |
Gerd Hoffmann | 092bb30 | 2013-01-09 10:17:08 +0100 | [diff] [blame] | 12 | #pragma GCC diagnostic ignored "-Wredundant-decls" |
| 13 | #endif |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 14 | #include <pixman.h> |
Gerd Hoffmann | 092bb30 | 2013-01-09 10:17:08 +0100 | [diff] [blame] | 15 | #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE |
Markus Armbruster | e6f53fd | 2013-04-16 13:51:06 +0200 | [diff] [blame] | 16 | #pragma GCC diagnostic pop |
Gerd Hoffmann | 092bb30 | 2013-01-09 10:17:08 +0100 | [diff] [blame] | 17 | #endif |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 18 | |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 19 | /* |
| 20 | * pixman image formats are defined to be native endian, |
| 21 | * that means host byte order on qemu. So we go define |
| 22 | * fixed formats here for cases where it is needed, like |
| 23 | * feeding libjpeg / libpng and writing screenshots. |
| 24 | */ |
| 25 | |
| 26 | #ifdef HOST_WORDS_BIGENDIAN |
| 27 | # define PIXMAN_BE_r8g8b8 PIXMAN_r8g8b8 |
Gerd Hoffmann | 43db7c3 | 2015-01-16 14:44:59 +0100 | [diff] [blame] | 28 | # define PIXMAN_BE_x8r8g8b8 PIXMAN_x8r8g8b8 |
| 29 | # define PIXMAN_BE_a8r8g8b8 PIXMAN_a8r8g8b8 |
| 30 | # define PIXMAN_BE_b8g8r8x8 PIXMAN_b8g8r8x8 |
| 31 | # define PIXMAN_BE_b8g8r8a8 PIXMAN_b8g8r8a8 |
| 32 | # define PIXMAN_BE_r8g8b8x8 PIXMAN_r8g8b8x8 |
| 33 | # define PIXMAN_BE_r8g8b8a8 PIXMAN_r8g8b8a8 |
| 34 | # define PIXMAN_BE_x8b8g8r8 PIXMAN_x8b8g8r8 |
| 35 | # define PIXMAN_BE_a8b8g8r8 PIXMAN_a8b8g8r8 |
Gerd Hoffmann | c1d37cd | 2015-04-14 08:56:21 +0200 | [diff] [blame] | 36 | # define PIXMAN_LE_x8r8g8b8 PIXMAN_b8g8r8x8 |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 37 | #else |
| 38 | # define PIXMAN_BE_r8g8b8 PIXMAN_b8g8r8 |
Gerd Hoffmann | 43db7c3 | 2015-01-16 14:44:59 +0100 | [diff] [blame] | 39 | # define PIXMAN_BE_x8r8g8b8 PIXMAN_b8g8r8x8 |
| 40 | # define PIXMAN_BE_a8r8g8b8 PIXMAN_b8g8r8a8 |
| 41 | # define PIXMAN_BE_b8g8r8x8 PIXMAN_x8r8g8b8 |
| 42 | # define PIXMAN_BE_b8g8r8a8 PIXMAN_a8r8g8b8 |
| 43 | # define PIXMAN_BE_r8g8b8x8 PIXMAN_x8b8g8r8 |
| 44 | # define PIXMAN_BE_r8g8b8a8 PIXMAN_a8b8g8r8 |
| 45 | # define PIXMAN_BE_x8b8g8r8 PIXMAN_r8g8b8x8 |
| 46 | # define PIXMAN_BE_a8b8g8r8 PIXMAN_r8g8b8a8 |
Gerd Hoffmann | c1d37cd | 2015-04-14 08:56:21 +0200 | [diff] [blame] | 47 | # define PIXMAN_LE_x8r8g8b8 PIXMAN_x8r8g8b8 |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 48 | #endif |
| 49 | |
| 50 | /* -------------------------------------------------------------------- */ |
| 51 | |
Gerd Hoffmann | a93a3af | 2014-06-18 09:00:00 +0200 | [diff] [blame] | 52 | PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format); |
Gerd Hoffmann | 1527a25 | 2014-06-18 11:31:42 +0200 | [diff] [blame] | 53 | pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian); |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 54 | int qemu_pixman_get_type(int rshift, int gshift, int bshift); |
| 55 | pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf); |
Gerd Hoffmann | 8cd996f | 2015-01-09 08:49:20 +0100 | [diff] [blame] | 56 | bool qemu_pixman_check_format(DisplayChangeListener *dcl, |
| 57 | pixman_format_code_t format); |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 58 | |
| 59 | pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format, |
| 60 | int width); |
| 61 | void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb, |
Gerd Hoffmann | bc210eb | 2012-12-14 07:54:24 +0000 | [diff] [blame] | 62 | int width, int x, int y); |
Gerd Hoffmann | 43c7d8b | 2014-06-19 13:19:01 +0200 | [diff] [blame] | 63 | void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y, |
| 64 | pixman_image_t *linebuf); |
Gerd Hoffmann | d9a8656 | 2012-11-02 09:12:49 +0100 | [diff] [blame] | 65 | pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format, |
| 66 | pixman_image_t *image); |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 67 | void qemu_pixman_image_unref(pixman_image_t *image); |
| 68 | |
Gerd Hoffmann | 867c538 | 2013-03-06 14:14:17 +0100 | [diff] [blame] | 69 | pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color); |
Gerd Hoffmann | b762795 | 2013-03-07 15:23:48 +0100 | [diff] [blame] | 70 | pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *font, |
| 71 | unsigned int ch); |
| 72 | void qemu_pixman_glyph_render(pixman_image_t *glyph, |
| 73 | pixman_image_t *surface, |
| 74 | pixman_color_t *fgcol, |
| 75 | pixman_color_t *bgcol, |
| 76 | int x, int y, int cw, int ch); |
Gerd Hoffmann | 867c538 | 2013-03-06 14:14:17 +0100 | [diff] [blame] | 77 | |
Gerd Hoffmann | d2ec7e2 | 2012-09-25 16:23:24 +0200 | [diff] [blame] | 78 | #endif /* QEMU_PIXMAN_H */ |