diff options
-rw-r--r-- | src/cairo-debug.c | 3 | ||||
-rw-r--r-- | src/cairo-gl-glyphs.c | 2 | ||||
-rw-r--r-- | src/cairo-png.c | 1 | ||||
-rw-r--r-- | src/cairo-qt-surface.cpp | 2 | ||||
-rw-r--r-- | src/cairo-scaled-font.c | 1 | ||||
-rw-r--r-- | src/cairo-script-surface.c | 15 | ||||
-rw-r--r-- | src/cairo-xcb-surface-render.c | 5 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 5 | ||||
-rw-r--r-- | src/cairo-xml-surface.c | 1 | ||||
-rw-r--r-- | src/drm/cairo-drm-i915-surface.c | 3 | ||||
-rw-r--r-- | src/drm/cairo-drm-i965-shader.c | 4 | ||||
-rw-r--r-- | src/drm/cairo-drm-i965-surface.c | 1 | ||||
-rw-r--r-- | src/drm/cairo-drm-intel-surface.c | 1 | ||||
-rw-r--r-- | src/drm/cairo-drm-intel.c | 12 | ||||
-rw-r--r-- | src/drm/cairo-drm-radeon-surface.c | 1 | ||||
-rw-r--r-- | util/cairo-script/cairo-script-operators.c | 35 | ||||
-rw-r--r-- | util/cairo-sphinx/sphinx.c | 1 | ||||
-rw-r--r-- | util/cairo-trace/trace.c | 25 |
18 files changed, 113 insertions, 5 deletions
diff --git a/src/cairo-debug.c b/src/cairo-debug.c index 359018ac..c4f70dfb 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 6485af6e..161b270a 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 6e0563de..10ad804f 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 5d263a92..f3b7d51b 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 58048fa5..861c0ab0 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 8dc74d3c..eb8a29d6 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 c1e480c2..d8edbd1e 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 ad7d625d..4848fc46 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 407aa969..7c0c9193 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 bd169a38..9214a7ef 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 9fecbf18..fcfec295 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 6799b162..3ef24832 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 7c075480..269af507 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 7658cbe8..351b5974 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 08db8f02..f383fd4b 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 c96fd80b..389249f2 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 20d9f01b..067f816a 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 9bc06e0c..36ca3e02 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; |