Bug 12756

Summary: Cairo doesn't support a 16bit visual (RGB16 5/5/5)
Product: cairo Reporter: Chris Heath <chris>
Component: image backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: chris
Version: 1.4.9   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Chris Heath 2007-10-09 16:27:35 UTC
15-bit color is all my poor video hardware can handle. Please don't drop support for this!

BTW, I'm using version 1.4.10, but this wasn't an option in bugzilla.

Here's the patch that fixed it for me:

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index ad41a4c..14c4b7c 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -168,6 +168,11 @@ _cairo_format_from_pixman_format (pixman_format_t *pixman_format)
 	    gm == 0x07e0 &&
 	    bm == 0x001f)
 	    return CAIRO_INTERNAL_FORMAT_RGB16_565;
+	if (am == 0x0 &&
+	    rm == 0x7c00 &&
+	    gm == 0x03e0 &&
+	    bm == 0x001f)
+	    return CAIRO_INTERNAL_FORMAT_RGB15;
 	break;
     case 8:
 	if (am == 0xff &&
@@ -561,6 +566,7 @@ _cairo_content_from_format (cairo_format_t format)
 	return CAIRO_CONTENT_COLOR_ALPHA;
     case CAIRO_FORMAT_RGB24:
     case CAIRO_INTERNAL_FORMAT_RGB16_565:
+    case CAIRO_INTERNAL_FORMAT_RGB15:
     case CAIRO_INTERNAL_FORMAT_BGR24:
 	return CAIRO_CONTENT_COLOR;
     case CAIRO_FORMAT_A8:
diff --git a/src/cairoint.h b/src/cairoint.h
index 07846b8..5bf6212 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -344,7 +344,8 @@ typedef enum cairo_internal_surface_type {
 typedef enum cairo_internal_format {
     CAIRO_INTERNAL_FORMAT_ABGR32 = 0x1000,
     CAIRO_INTERNAL_FORMAT_BGR24,
-    CAIRO_INTERNAL_FORMAT_RGB16_565
+    CAIRO_INTERNAL_FORMAT_RGB16_565,
+    CAIRO_INTERNAL_FORMAT_RGB15
 } cairo_internal_format_t;
 
 typedef enum cairo_direction {
Comment 1 Behdad Esfahbod 2008-01-18 13:59:54 UTC
Can you try again?  What do you get?  I tried today with 1.4.14 and with master, couldn't reproduce.  This is the server I tested against:

Xvfb -screen 0 650x480x15 :1 -pixdepths 15 -render

cairo 1.2 did have problem with that one, but not 1.4 or 1.5.
Comment 2 Chris Wilson 2008-04-11 07:25:57 UTC
Mass closing of 8-/15-/16-/32-bit unsupported image formats as these should now all work in 1.6.0. Please test and reopen if you have any issues.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.