[cairo-commit] 2 commits - src/cairo-debug.c src/cairo-gl-glyphs.c src/cairo-png.c src/cairo-qt-surface.cpp src/cairo-scaled-font.c src/cairo-script-surface.c src/cairo-surface.c src/cairo-svg-surface.c src/cairo-xcb-surface-render.c src/cairo-xlib-surface.c src/cairo-xml-surface.c src/drm util/cairo-script util/cairo-sphinx util/cairo-trace
Chris Wilson
ickle at kemper.freedesktop.org
Tue Mar 30 10:31:48 PDT 2010
src/cairo-debug.c | 3 ++
src/cairo-gl-glyphs.c | 2 +
src/cairo-png.c | 1
src/cairo-qt-surface.cpp | 2 +
src/cairo-scaled-font.c | 1
src/cairo-script-surface.c | 15 ++++++++++++
src/cairo-surface.c | 4 +--
src/cairo-svg-surface.c | 10 ++++----
src/cairo-xcb-surface-render.c | 5 ++++
src/cairo-xlib-surface.c | 5 ++++
src/cairo-xml-surface.c | 1
src/drm/cairo-drm-i915-surface.c | 3 ++
src/drm/cairo-drm-i965-shader.c | 4 +++
src/drm/cairo-drm-i965-surface.c | 1
src/drm/cairo-drm-intel-surface.c | 1
src/drm/cairo-drm-intel.c | 12 ++++++++-
src/drm/cairo-drm-radeon-surface.c | 1
util/cairo-script/cairo-script-operators.c | 35 +++++++++++++++++++++++++++++
util/cairo-sphinx/sphinx.c | 1
util/cairo-trace/trace.c | 25 ++++++++++++++++++--
20 files changed, 120 insertions(+), 12 deletions(-)
New commits:
commit be4ffa9df275513de3175415ee889b7323499a37
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Mar 28 19:40:54 2010 +0100
doc: Fix some missing '%' in gtk-doc comments
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index a47ccba..27b5c83 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -834,8 +834,8 @@ _cairo_mime_data_destroy (void *ptr)
* @surface. This approach tends to be faster and requires less
* memory and disk space.
*
- * The recognized MIME types are the following: #CAIRO_MIME_TYPE_JPEG,
- * #CAIRO_MIME_TYPE_PNG, #CAIRO_MIME_TYPE_JP2, #CAIRO_MIME_TYPE_URI.
+ * The recognized MIME types are the following: %CAIRO_MIME_TYPE_JPEG,
+ * %CAIRO_MIME_TYPE_PNG, %CAIRO_MIME_TYPE_JP2, %CAIRO_MIME_TYPE_URI.
*
* See corresponding backend surface docs for details about which MIME
* types it can handle. Caution: the associated MIME data will be
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 06aa696..97eb457 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -206,17 +206,17 @@ cairo_svg_surface_create_for_stream (cairo_write_func_t write_func,
* The SVG surface backend recognizes the following MIME types for the
* data attached to a surface (see cairo_surface_set_mime_data()) when
* it is used as a source pattern for drawing on this surface:
- * #CAIRO_MIME_TYPE_JPEG, #CAIRO_MIME_TYPE_PNG,
- * #CAIRO_MIME_TYPE_URI. If any of them is specified, the SVG backend
+ * %CAIRO_MIME_TYPE_JPEG, %CAIRO_MIME_TYPE_PNG,
+ * %CAIRO_MIME_TYPE_URI. If any of them is specified, the SVG backend
* emits a href with the content of MIME data instead of a surface
* snapshot (PNG, Base64-encoded) in the corresponding image tag.
*
- * The unofficial MIME type #CAIRO_MIME_TYPE_URI is examined
+ * The unofficial MIME type %CAIRO_MIME_TYPE_URI is examined
* first. If present, the URI is emitted as is: assuring the
* correctness of URI is left to the client code.
*
- * If #CAIRO_MIME_TYPE_URI is not present, but #CAIRO_MIME_TYPE_JPEG
- * or #CAIRO_MIME_TYPE_PNG is specified, the corresponding data is
+ * If %CAIRO_MIME_TYPE_URI is not present, but %CAIRO_MIME_TYPE_JPEG
+ * or %CAIRO_MIME_TYPE_PNG is specified, the corresponding data is
* Base64-encoded and emitted.
*
* Return value: a pointer to the newly created surface. The caller
commit 7ab350378e8597e9872dbe390b8454d0a63bff28
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Mar 28 19:38:24 2010 +0100
Silence enumeration warnings following addition of RGB16_565
diff --git a/src/cairo-debug.c b/src/cairo-debug.c
index 359018a..c4f70df 100644
--- a/src/cairo-debug.c
+++ b/src/cairo-debug.c
@@ -106,6 +106,9 @@ _cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface)
case CAIRO_FORMAT_A8:
width = image->width;
break;
+ case CAIRO_FORMAT_RGB16_565:
+ width = image->width*2;
+ break;
case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_ARGB32:
width = image->width*4;
diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 6485af6..161b270 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -154,6 +154,7 @@ cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
cairo_gl_glyph_cache_t *cache;
switch (format) {
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB24:
cache = &ctx->glyph_cache[0];
@@ -177,6 +178,7 @@ cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
switch (format) {
case CAIRO_FORMAT_A1:
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
ASSERT_NOT_REACHED;
case CAIRO_FORMAT_ARGB32:
diff --git a/src/cairo-png.c b/src/cairo-png.c
index 6e0563d..10ad804 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -231,6 +231,7 @@ write_png (cairo_surface_t *surface,
#endif
break;
case CAIRO_FORMAT_INVALID:
+ case CAIRO_FORMAT_RGB16_565:
default:
status = _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
goto BAIL4;
diff --git a/src/cairo-qt-surface.cpp b/src/cairo-qt-surface.cpp
index 5d263a9..f3b7d51 100644
--- a/src/cairo-qt-surface.cpp
+++ b/src/cairo-qt-surface.cpp
@@ -306,6 +306,8 @@ _qimage_format_from_cairo_format (cairo_format_t fmt)
return QImage::Format_ARGB32_Premultiplied;
case CAIRO_FORMAT_RGB24:
return QImage::Format_RGB32;
+ case CAIRO_FORMAT_RGB16_565:
+ return QImage::Format_RGB16;
case CAIRO_FORMAT_A8:
return QImage::Format_Indexed8; // XXX not quite
case CAIRO_FORMAT_A1:
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 58048fa..861c0ab 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2148,6 +2148,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
case CAIRO_FORMAT_A1:
mask_format = glyph_surface->format;
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_INVALID:
default:
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index 8dc74d3..eb8a29d 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -828,6 +828,7 @@ _format_to_string (cairo_format_t format)
switch (format) {
case CAIRO_FORMAT_ARGB32: return "ARGB32";
case CAIRO_FORMAT_RGB24: return "RGB24";
+ case CAIRO_FORMAT_RGB16_565: return "RGB16_565";
case CAIRO_FORMAT_A8: return "A8";
case CAIRO_FORMAT_A1: return "A1";
case CAIRO_FORMAT_INVALID: return "INVALID";
@@ -1095,6 +1096,17 @@ _write_image_surface (cairo_output_stream_t *output,
data += stride;
}
break;
+ case CAIRO_FORMAT_RGB16_565:
+ for (row = image->height; row--; ) {
+ uint16_t *src = (uint16_t *) data;
+ uint16_t *dst = (uint16_t *) rowdata;
+ int col;
+ for (col = 0; col < width; col++)
+ dst[col] = bswap_16 (src[col]);
+ _cairo_output_stream_write (output, rowdata, 2*width);
+ data += stride;
+ }
+ break;
case CAIRO_FORMAT_RGB24:
for (row = image->height; row--; ) {
uint8_t *src = data;
@@ -1235,6 +1247,9 @@ _emit_image_surface (cairo_script_surface_t *surface,
case CAIRO_FORMAT_A8:
len = clone->width;
break;
+ case CAIRO_FORMAT_RGB16_565:
+ len = clone->width * 2;
+ break;
case CAIRO_FORMAT_RGB24:
len = clone->width * 3;
break;
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index c1e480c..d8edbd1 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -3854,7 +3854,9 @@ _cairo_xcb_scaled_font_get_glyphset_info_for_format (cairo_scaled_font_t *scaled
switch (format) {
default:
case CAIRO_FORMAT_INVALID:
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
+ ASSERT_NOT_REACHED;
case CAIRO_FORMAT_ARGB32: glyphset_index = GLYPHSET_INDEX_ARGB32; break;
case CAIRO_FORMAT_A8: glyphset_index = GLYPHSET_INDEX_A8; break;
case CAIRO_FORMAT_A1: glyphset_index = GLYPHSET_INDEX_A1; break;
@@ -3918,7 +3920,9 @@ _cairo_xcb_scaled_font_get_glyphset_info_for_pending_free_glyph (
switch (surface->format) {
default:
case CAIRO_FORMAT_INVALID:
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
+ ASSERT_NOT_REACHED;
case CAIRO_FORMAT_ARGB32: i = GLYPHSET_INDEX_ARGB32; break;
case CAIRO_FORMAT_A8: i = GLYPHSET_INDEX_A8; break;
case CAIRO_FORMAT_A1: i = GLYPHSET_INDEX_A1; break;
@@ -4083,6 +4087,7 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
}
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_INVALID:
default:
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index ad7d625..4848fc4 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -3752,7 +3752,9 @@ _cairo_xlib_scaled_font_get_glyphset_info_for_format (cairo_scaled_font_t *scale
switch (format) {
default:
case CAIRO_FORMAT_INVALID:
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
+ ASSERT_NOT_REACHED;
case CAIRO_FORMAT_ARGB32: glyphset_index = GLYPHSET_INDEX_ARGB32; break;
case CAIRO_FORMAT_A8: glyphset_index = GLYPHSET_INDEX_A8; break;
case CAIRO_FORMAT_A1: glyphset_index = GLYPHSET_INDEX_A1; break;
@@ -3814,7 +3816,9 @@ _cairo_xlib_scaled_font_get_glyphset_info_for_pending_free_glyph (
switch (surface->format) {
default:
case CAIRO_FORMAT_INVALID:
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
+ ASSERT_NOT_REACHED;
case CAIRO_FORMAT_ARGB32: i = GLYPHSET_INDEX_ARGB32; break;
case CAIRO_FORMAT_A8: i = GLYPHSET_INDEX_A8; break;
case CAIRO_FORMAT_A1: i = GLYPHSET_INDEX_A1; break;
@@ -4002,6 +4006,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
data = (uint8_t *) new;
}
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_INVALID:
default:
diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c
index 407aa96..7c0c919 100644
--- a/src/cairo-xml-surface.c
+++ b/src/cairo-xml-surface.c
@@ -206,6 +206,7 @@ _format_to_string (cairo_format_t format)
switch (format) {
case CAIRO_FORMAT_ARGB32: return "ARGB32";
case CAIRO_FORMAT_RGB24: return "RGB24";
+ case CAIRO_FORMAT_RGB16_565: return "RGB16_565";
case CAIRO_FORMAT_A8: return "A8";
case CAIRO_FORMAT_A1: return "A1";
case CAIRO_FORMAT_INVALID: return "INVALID";
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index bd169a3..9214a7e 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -1600,6 +1600,7 @@ i915_surface_create_for_name (cairo_drm_device_t *base_dev,
case CAIRO_FORMAT_ARGB32:
content = CAIRO_CONTENT_COLOR_ALPHA;
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
content = CAIRO_CONTENT_COLOR;
break;
@@ -1655,6 +1656,7 @@ i915_buffer_cache_init (intel_buffer_cache_t *cache,
case CAIRO_FORMAT_INVALID:
case CAIRO_FORMAT_A1:
case CAIRO_FORMAT_RGB24:
+ case CAIRO_FORMAT_RGB16_565:
ASSERT_NOT_REACHED;
case CAIRO_FORMAT_ARGB32:
cache->buffer.map0 = MAPSURF_32BIT | MT_32BIT_ARGB8888;
@@ -1734,6 +1736,7 @@ i915_surface_create_from_cacheable_image_internal (i915_device_t *device,
switch (image->format) {
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB24:
+ case CAIRO_FORMAT_RGB16_565:
caches = &device->image_caches[0];
format = CAIRO_FORMAT_ARGB32;
bpp = 4;
diff --git a/src/drm/cairo-drm-i965-shader.c b/src/drm/cairo-drm-i965-shader.c
index 9fecbf1..fcfec29 100644
--- a/src/drm/cairo-drm-i965-shader.c
+++ b/src/drm/cairo-drm-i965-shader.c
@@ -2073,6 +2073,8 @@ i965_get_card_format (cairo_format_t format)
return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
case CAIRO_FORMAT_RGB24:
return BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
+ case CAIRO_FORMAT_RGB16_565:
+ return BRW_SURFACEFORMAT_B5G6R5_UNORM;
case CAIRO_FORMAT_A8:
return BRW_SURFACEFORMAT_A8_UNORM;
case CAIRO_FORMAT_A1:
@@ -2090,6 +2092,8 @@ i965_get_dest_format (cairo_format_t format)
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB24:
return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+ case CAIRO_FORMAT_RGB16_565:
+ return BRW_SURFACEFORMAT_B5G6R5_UNORM;
case CAIRO_FORMAT_A8:
return BRW_SURFACEFORMAT_A8_UNORM;
case CAIRO_FORMAT_A1:
diff --git a/src/drm/cairo-drm-i965-surface.c b/src/drm/cairo-drm-i965-surface.c
index 6799b16..3ef2483 100644
--- a/src/drm/cairo-drm-i965-surface.c
+++ b/src/drm/cairo-drm-i965-surface.c
@@ -1612,6 +1612,7 @@ i965_surface_create_for_name (cairo_drm_device_t *base_dev,
case CAIRO_FORMAT_ARGB32:
content = CAIRO_CONTENT_COLOR_ALPHA;
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
content = CAIRO_CONTENT_COLOR;
break;
diff --git a/src/drm/cairo-drm-intel-surface.c b/src/drm/cairo-drm-intel-surface.c
index 7c07548..269af50 100644
--- a/src/drm/cairo-drm-intel-surface.c
+++ b/src/drm/cairo-drm-intel-surface.c
@@ -356,6 +356,7 @@ intel_surface_create_for_name (cairo_drm_device_t *device,
case CAIRO_FORMAT_ARGB32:
content = CAIRO_CONTENT_COLOR_ALPHA;
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
content = CAIRO_CONTENT_COLOR;
break;
diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
index 7658cbe..351b597 100644
--- a/src/drm/cairo-drm-intel.c
+++ b/src/drm/cairo-drm-intel.c
@@ -714,6 +714,11 @@ intel_bo_put_image (intel_device_t *dev,
data += 4 * src_x;
size = 4 * width;
break;
+ case CAIRO_FORMAT_RGB16_565:
+ offset += 2 * dst_x;
+ data += 2 * src_x;
+ size = 2 * width;
+ break;
case CAIRO_FORMAT_A8:
offset += dst_x;
data += src_x;
@@ -1029,7 +1034,6 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
}
break;
- case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_ARGB32:
dst += 4*node->x;
width = 4*glyph_surface->width;
@@ -1040,6 +1044,8 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
}
break;
default:
+ case CAIRO_FORMAT_RGB16_565:
+ case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_INVALID:
ASSERT_NOT_REACHED;
return _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
@@ -1101,7 +1107,6 @@ intel_get_glyph_cache (intel_device_t *device,
switch (format) {
case CAIRO_FORMAT_ARGB32:
- case CAIRO_FORMAT_RGB24:
cache = &device->glyph_cache[0];
format = CAIRO_FORMAT_ARGB32;
break;
@@ -1111,6 +1116,8 @@ intel_get_glyph_cache (intel_device_t *device,
format = CAIRO_FORMAT_A8;
break;
default:
+ case CAIRO_FORMAT_RGB16_565:
+ case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_INVALID:
ASSERT_NOT_REACHED;
return _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
@@ -1227,6 +1234,7 @@ intel_buffer_cache_init (intel_buffer_cache_t *cache,
switch (format) {
case CAIRO_FORMAT_A1:
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_INVALID:
ASSERT_NOT_REACHED;
diff --git a/src/drm/cairo-drm-radeon-surface.c b/src/drm/cairo-drm-radeon-surface.c
index 08db8f0..f383fd4 100644
--- a/src/drm/cairo-drm-radeon-surface.c
+++ b/src/drm/cairo-drm-radeon-surface.c
@@ -370,6 +370,7 @@ radeon_surface_create_for_name (cairo_drm_device_t *device,
default:
case CAIRO_FORMAT_INVALID:
case CAIRO_FORMAT_A1:
+ case CAIRO_FORMAT_RGB16_565:
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
case CAIRO_FORMAT_ARGB32:
content = CAIRO_CONTENT_COLOR_ALPHA;
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c
index c96fd80..389249f 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -2840,6 +2840,9 @@ _image_read_raw (csi_file_t *src,
case CAIRO_FORMAT_A8:
len = width * height;
break;
+ case CAIRO_FORMAT_RGB16_565:
+ len = 2 * width * height;
+ break;
case CAIRO_FORMAT_RGB24:
len = 3 * width * height;
break;
@@ -2880,6 +2883,17 @@ _image_read_raw (csi_file_t *src,
for (x = width; x--; )
row[x] = *--bp;
break;
+ case CAIRO_FORMAT_RGB16_565:
+ for (x = width; x--; ) {
+#ifdef WORDS_BIGENDIAN
+ row[2*x + 1] = *--bp;
+ row[2*x + 0] = *--bp;
+#else
+ row[2*x + 0] = *--bp;
+ row[2*x + 1] = *--bp;
+#endif
+ }
+ break;
case CAIRO_FORMAT_RGB24:
for (x = width; x--; ) {
#ifdef WORDS_BIGENDIAN
@@ -2914,6 +2928,17 @@ _image_read_raw (csi_file_t *src,
for (x = width; x--; )
data[x] = *--bp;
break;
+ case CAIRO_FORMAT_RGB16_565:
+ for (x = width; x--; ) {
+#ifdef WORDS_BIGENDIAN
+ data[2*x + 1] = *--bp;
+ data[2*x + 0] = *--bp;
+#else
+ data[2*x + 0] = *--bp;
+ data[2*x + 1] = *--bp;
+#endif
+ }
+ break;
case CAIRO_FORMAT_RGB24:
for (x = width; --x>1; ) {
#ifdef WORDS_BIGENDIAN
@@ -2984,6 +3009,14 @@ _image_read_raw (csi_file_t *src,
data[x] = CSI_BITSWAP8_IF_LITTLE_ENDIAN (byte);
}
break;
+ case CAIRO_FORMAT_RGB16_565:
+ {
+ uint32_t *rgba = (uint32_t *) data;
+ for (x = len/2; x--; rgba++) {
+ *rgba = bswap_16 (*rgba);
+ }
+ }
+ break;
case CAIRO_FORMAT_ARGB32:
{
uint32_t *rgba = (uint32_t *) data;
@@ -5221,6 +5254,7 @@ _similar (csi_t *ctx)
case CAIRO_FORMAT_ARGB32:
content = CAIRO_CONTENT_COLOR_ALPHA;
break;
+ case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB24:
content = CAIRO_CONTENT_COLOR;
break;
@@ -6140,6 +6174,7 @@ _integer_constants[] = {
{ "A1", CAIRO_FORMAT_A1 },
{ "A8", CAIRO_FORMAT_A8 },
+ { "RGB16_565", CAIRO_FORMAT_RGB16_565 },
{ "RGB24", CAIRO_FORMAT_RGB24 },
{ "ARGB32", CAIRO_FORMAT_ARGB32 },
{ "INVALID", CAIRO_FORMAT_INVALID },
diff --git a/util/cairo-sphinx/sphinx.c b/util/cairo-sphinx/sphinx.c
index 20d9f01..067f816 100644
--- a/util/cairo-sphinx/sphinx.c
+++ b/util/cairo-sphinx/sphinx.c
@@ -620,6 +620,7 @@ compare_images (cairo_surface_t *a,
break;
case CAIRO_FORMAT_INVALID:
+ case CAIRO_FORMAT_RGB16_565: /* XXX */
break;
}
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 9bc06e0..36ca3e0 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1442,6 +1442,7 @@ _format_to_string (cairo_format_t format)
f(INVALID);
f(ARGB32);
f(RGB24);
+ f(RGB16_565);
f(A8);
f(A1);
}
@@ -1567,9 +1568,10 @@ _emit_image (cairo_surface_t *image,
}
switch (format) {
- case CAIRO_FORMAT_A1: len = (width + 7)/8; break;
- case CAIRO_FORMAT_A8: len = width; break;
- case CAIRO_FORMAT_RGB24: len = 3*width; break;
+ case CAIRO_FORMAT_A1: len = (width + 7)/8; break;
+ case CAIRO_FORMAT_A8: len = width; break;
+ case CAIRO_FORMAT_RGB16_565: len = 2*width; break;
+ case CAIRO_FORMAT_RGB24: len = 3*width; break;
default:
case CAIRO_FORMAT_INVALID:
case CAIRO_FORMAT_ARGB32: len = 4*width; break;
@@ -1592,6 +1594,12 @@ _emit_image (cairo_surface_t *image,
data += stride;
}
break;
+ case CAIRO_FORMAT_RGB16_565:
+ for (row = height; row--; ) {
+ _write_data (&stream, data, 2*width);
+ data += stride;
+ }
+ break;
case CAIRO_FORMAT_RGB24:
for (row = height; row--; ) {
int col;
@@ -1637,6 +1645,17 @@ _emit_image (cairo_surface_t *image,
data += stride;
}
break;
+ case CAIRO_FORMAT_RGB16_565: /* XXX endianness */
+ for (row = height; row--; ) {
+ uint16_t *src = data;
+ uint16_t *dst = (uint16_t *)rowdata;
+ int col;
+ for (col = 0; col < width; col++)
+ dst[col] = bswap_16 (src[col]);
+ _write_data (&stream, rowdata, 2*width);
+ data += stride;
+ }
+ break;
case CAIRO_FORMAT_RGB24:
for (row = height; row--; ) {
uint8_t *src = data;
More information about the cairo-commit
mailing list