From e749462f1f9c5c5c5bd15b0da48ac86b5f632520 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 5 Mar 2010 15:07:24 +0100 Subject: Add CAIRO_FORMAT_PLANAR_420 --- src/cairo-image-surface.c | 7 +++++++ src/cairo-xlib-display.c | 1 + src/cairo.h | 7 ++++++- src/cairoint.h | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 2040a394..feec906e 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -98,6 +98,8 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format) return CAIRO_FORMAT_PLANAR_444; case PIXMAN_y422: return CAIRO_FORMAT_PLANAR_422; + case PIXMAN_y420: + return CAIRO_FORMAT_PLANAR_420; case PIXMAN_yuy2: return CAIRO_FORMAT_PACKED_YUYV; case PIXMAN_yvyu: @@ -299,6 +301,9 @@ _cairo_format_to_pixman_format_code (cairo_format_t format) case CAIRO_FORMAT_PLANAR_422: ret = PIXMAN_y422; break; + case CAIRO_FORMAT_PLANAR_420: + ret = PIXMAN_y420; + break; case CAIRO_FORMAT_PACKED_YUYV: ret = PIXMAN_yuy2; break; @@ -827,6 +832,7 @@ _cairo_content_from_format (cairo_format_t format) case CAIRO_FORMAT_RGB16_565: case CAIRO_FORMAT_PLANAR_444: case CAIRO_FORMAT_PLANAR_422: + case CAIRO_FORMAT_PLANAR_420: case CAIRO_FORMAT_PACKED_YUYV: case CAIRO_FORMAT_PACKED_YVYU: case CAIRO_FORMAT_PACKED_UYVY: @@ -862,6 +868,7 @@ _cairo_format_bits_per_pixel (cairo_format_t format) case CAIRO_FORMAT_A8: case CAIRO_FORMAT_PLANAR_444: case CAIRO_FORMAT_PLANAR_422: + case CAIRO_FORMAT_PLANAR_420: return 8; case CAIRO_FORMAT_A1: return 1; diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c index 6bacf402..5834cef2 100644 --- a/src/cairo-xlib-display.c +++ b/src/cairo-xlib-display.c @@ -600,6 +600,7 @@ _cairo_xlib_display_get_xrender_format (cairo_xlib_display_t *display, case CAIRO_FORMAT_BGRA32: case CAIRO_FORMAT_PLANAR_444: case CAIRO_FORMAT_PLANAR_422: + case CAIRO_FORMAT_PLANAR_420: case CAIRO_FORMAT_PACKED_YUYV: case CAIRO_FORMAT_PACKED_YVYU: case CAIRO_FORMAT_PACKED_UYVY: diff --git a/src/cairo.h b/src/cairo.h index 70302a7e..c47c66b6 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -2286,6 +2286,10 @@ cairo_surface_has_show_text_glyphs (cairo_surface_t *surface); * planes. The red plane contains all values, the green and * blue planes are subsampled in the horizontal direction and * each pixel covers 2 red pixels. + * @CAIRO_FORMAT_PLANAR_420: A subsampled planar format with 3 + * planes. The red plane contains all values, the green and + * blue planes are subsampled in the horizontal and vertical + * direction so that each pixel covers 2x2 red pixels. * * #cairo_format_t is used to identify the memory format of * image data. @@ -2316,7 +2320,8 @@ typedef enum _cairo_format { CAIRO_FORMAT_PACKED_YVYU = 10, CAIRO_FORMAT_PACKED_UYVY = 11, CAIRO_FORMAT_PACKED_VYUY = 12, - CAIRO_FORMAT_PLANAR_422 = 13 + CAIRO_FORMAT_PLANAR_422 = 13, + CAIRO_FORMAT_PLANAR_420 = 14 } cairo_format_t; /** diff --git a/src/cairoint.h b/src/cairoint.h index a9f9422d..50f1f040 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_422) + (format) <= CAIRO_FORMAT_PLANAR_420) #define CAIRO_FORMAT_MAX_PLANES 4 #define CAIRO_COLOR_SPACE_VALID(colorspace) ((colorspace) <= CAIRO_COLOR_SPACE_YCBCR_JPEG) -- cgit v1.2.3