diff options
author | Benjamin Otte <otte@redhat.com> | 2010-02-24 22:46:52 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-04-23 23:30:09 +0200 |
commit | 812b669a3574434d2f0a9c4cd0bb23f9404c45af (patch) | |
tree | acb4dbcddf83a78aeb8073e4728e8fb9b3ba2d44 | |
parent | dbee7858d994a4bc54b003ee8dee25a5e66b3bd6 (diff) |
Add packed YUV formats
-rw-r--r-- | src/cairo-image-surface.c | 33 | ||||
-rw-r--r-- | src/cairo-xlib-display.c | 4 | ||||
-rw-r--r-- | src/cairo.h | 6 | ||||
-rw-r--r-- | src/cairoint.h | 2 |
4 files changed, 41 insertions, 4 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 48ef658e..105d0ae7 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -96,6 +96,14 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format) return CAIRO_FORMAT_BGRA32; case PIXMAN_y444: return CAIRO_FORMAT_PLANAR_444; + case PIXMAN_yuy2: + return CAIRO_FORMAT_PACKED_YUYV; + case PIXMAN_yvyu: + return CAIRO_FORMAT_PACKED_YVYU; + case PIXMAN_uyvy: + return CAIRO_FORMAT_PACKED_UYVY; + case PIXMAN_vyuy: + return CAIRO_FORMAT_PACKED_VYUY; case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8: case PIXMAN_b8g8r8: case PIXMAN_b5g6r5: case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5: @@ -106,7 +114,7 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format) case PIXMAN_a4: case PIXMAN_r1g2b1: case PIXMAN_b1g2r1: case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4: case PIXMAN_g4: case PIXMAN_g1: - case PIXMAN_yuy2: case PIXMAN_yv12: + case PIXMAN_yv12: case PIXMAN_b8g8r8x8: case PIXMAN_x2b10g10r10: case PIXMAN_a2b10g10r10: @@ -125,7 +133,8 @@ _cairo_content_from_pixman_format (pixman_format_code_t pixman_format) cairo_content_t content; content = 0; - if (PIXMAN_FORMAT_RGB (pixman_format)) + if (PIXMAN_FORMAT_RGB (pixman_format) || + pixman_format == PIXMAN_yuy2) content |= CAIRO_CONTENT_COLOR; if (PIXMAN_FORMAT_A (pixman_format)) content |= CAIRO_CONTENT_ALPHA; @@ -285,6 +294,18 @@ _cairo_format_to_pixman_format_code (cairo_format_t format) case CAIRO_FORMAT_PLANAR_444: ret = PIXMAN_y444; break; + case CAIRO_FORMAT_PACKED_YUYV: + ret = PIXMAN_yuy2; + break; + case CAIRO_FORMAT_PACKED_YVYU: + ret = PIXMAN_yvyu; + break; + case CAIRO_FORMAT_PACKED_UYVY: + ret = PIXMAN_uyvy; + break; + case CAIRO_FORMAT_PACKED_VYUY: + ret = PIXMAN_vyuy; + break; case CAIRO_FORMAT_RGB24: ret = PIXMAN_x8r8g8b8; break; @@ -800,6 +821,10 @@ _cairo_content_from_format (cairo_format_t format) case CAIRO_FORMAT_RGB24: case CAIRO_FORMAT_RGB16_565: case CAIRO_FORMAT_PLANAR_444: + case CAIRO_FORMAT_PACKED_YUYV: + case CAIRO_FORMAT_PACKED_YVYU: + case CAIRO_FORMAT_PACKED_UYVY: + case CAIRO_FORMAT_PACKED_VYUY: return CAIRO_CONTENT_COLOR; case CAIRO_FORMAT_A8: case CAIRO_FORMAT_A1: @@ -823,6 +848,10 @@ _cairo_format_bits_per_pixel (cairo_format_t format) case CAIRO_FORMAT_RGB24: return 32; case CAIRO_FORMAT_RGB16_565: + case CAIRO_FORMAT_PACKED_YUYV: + case CAIRO_FORMAT_PACKED_YVYU: + case CAIRO_FORMAT_PACKED_UYVY: + case CAIRO_FORMAT_PACKED_VYUY: return 16; case CAIRO_FORMAT_A8: case CAIRO_FORMAT_PLANAR_444: diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c index 8a4e6679..5470558b 100644 --- a/src/cairo-xlib-display.c +++ b/src/cairo-xlib-display.c @@ -599,6 +599,10 @@ _cairo_xlib_display_get_xrender_format (cairo_xlib_display_t *display, case CAIRO_FORMAT_ABGR32: case CAIRO_FORMAT_BGRA32: case CAIRO_FORMAT_PLANAR_444: + case CAIRO_FORMAT_PACKED_YUYV: + case CAIRO_FORMAT_PACKED_YVYU: + case CAIRO_FORMAT_PACKED_UYVY: + case CAIRO_FORMAT_PACKED_VYUY: ASSERT_NOT_REACHED; case CAIRO_FORMAT_ARGB32: pict_format = PictStandardARGB32; break; diff --git a/src/cairo.h b/src/cairo.h index 4a06785c..e1bb7f1a 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -2307,7 +2307,11 @@ typedef enum _cairo_format { CAIRO_FORMAT_RGBA32 = 5, CAIRO_FORMAT_ABGR32 = 6, CAIRO_FORMAT_BGRA32 = 7, - CAIRO_FORMAT_PLANAR_444 = 8 + CAIRO_FORMAT_PLANAR_444 = 8, + CAIRO_FORMAT_PACKED_YUYV = 9, + CAIRO_FORMAT_PACKED_YVYU = 10, + CAIRO_FORMAT_PACKED_UYVY = 11, + CAIRO_FORMAT_PACKED_VYUY = 12 } cairo_format_t; /** diff --git a/src/cairoint.h b/src/cairoint.h index 12124c0b..3a4d86aa 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -2117,7 +2117,7 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface) cairo_pure; /* cairo-image-surface.c */ #define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \ - (format) <= CAIRO_FORMAT_PLANAR_444) + (format) <= CAIRO_FORMAT_PACKED_VYUY) #define CAIRO_FORMAT_MAX_PLANES 4 #define CAIRO_COLOR_SPACE_VALID(colorspace) ((colorspace) <= CAIRO_COLOR_SPACE_YCBCR_JPEG) |