Backed out changeset 85335f212ac3, attempt to fix oranges
authorOleg Romashin <romaxa@gmail.com>
Fri, 11 Jun 2010 08:36:08 -0400
changeset 43501 ef1a401774530fa9a91a7b6a7196e8ffe049d9ed
parent 43498 85335f212ac3e5211e2d64b4b4294ce4297a95ab
child 43502 a377b468c4dfd3a21cfc3c6e68e65d950876255c
push idunknown
push userunknown
push dateunknown
milestone1.9.3a6pre
backs out85335f212ac3e5211e2d64b4b4294ce4297a95ab
Backed out changeset 85335f212ac3, attempt to fix oranges
gfx/cairo/cairo/src/cairo-deprecated.h
gfx/cairo/cairo/src/cairo-image-surface.c
gfx/cairo/cairo/src/cairo-xlib-display.c
gfx/cairo/cairo/src/cairo.h
gfx/cairo/cairo/src/cairoint.h
--- a/gfx/cairo/cairo/src/cairo-deprecated.h
+++ b/gfx/cairo/cairo/src/cairo-deprecated.h
@@ -43,17 +43,17 @@
  * backend can work fine with 16-bit visuals in the same way it works
  * with BGR visuals without any BGR formats in
  * #cairo_format_t).
  *
  * Additionally, the support for the RGB16_565 format was never
  * completely implemented. So while this format value is currently
  * deprecated, it may eventually acquire complete support in the future.
  */
-/* #define CAIRO_FORMAT_RGB16_565 4 */
+#define CAIRO_FORMAT_RGB16_565 4
 
 #define CAIRO_FONT_TYPE_ATSUI CAIRO_FONT_TYPE_QUARTZ
 
 /* Obsolete functions. These definitions exist to coerce the compiler
  * into providing a little bit of guidance with its error
  * messages. The idea is to help users port their old code without
  * having to dig through lots of documentation.
  *
--- a/gfx/cairo/cairo/src/cairo-image-surface.c
+++ b/gfx/cairo/cairo/src/cairo-image-surface.c
@@ -59,20 +59,18 @@ static cairo_format_t
     case PIXMAN_a8r8g8b8:
 	return CAIRO_FORMAT_ARGB32;
     case PIXMAN_x8r8g8b8:
 	return CAIRO_FORMAT_RGB24;
     case PIXMAN_a8:
 	return CAIRO_FORMAT_A8;
     case PIXMAN_a1:
 	return CAIRO_FORMAT_A1;
-    case PIXMAN_r5g6b5:
-	return CAIRO_FORMAT_RGB16_565;
     case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
-    case PIXMAN_b8g8r8:   case PIXMAN_b5g6r5:
+    case PIXMAN_b8g8r8:   case PIXMAN_r5g6b5:   case PIXMAN_b5g6r5:
     case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
     case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
     case PIXMAN_a4b4g4r4: case PIXMAN_x4b4g4r4: case PIXMAN_r3g3b2:
     case PIXMAN_b2g3r3:   case PIXMAN_a2r2g2b2: case PIXMAN_a2b2g2r2:
     case PIXMAN_c8:       case PIXMAN_g8:       case PIXMAN_x4a4:
     case PIXMAN_a4:       case PIXMAN_r1g2b1:   case PIXMAN_b1g2r1:
     case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4:
     case PIXMAN_g4:       case PIXMAN_g1:
@@ -352,19 +350,16 @@ static pixman_format_code_t
 	ret = PIXMAN_a1;
 	break;
     case CAIRO_FORMAT_A8:
 	ret = PIXMAN_a8;
 	break;
     case CAIRO_FORMAT_RGB24:
 	ret = PIXMAN_x8r8g8b8;
 	break;
-    case CAIRO_FORMAT_RGB16_565:
-	ret = PIXMAN_r5g6b5;
-	break;
     case CAIRO_FORMAT_ARGB32:
     default:
 	ret = PIXMAN_a8r8g8b8;
 	break;
     }
     return ret;
 }
 
@@ -731,18 +726,16 @@ cairo_format_t
 cairo_content_t
 _cairo_content_from_format (cairo_format_t format)
 {
     switch (format) {
     case CAIRO_FORMAT_ARGB32:
 	return CAIRO_CONTENT_COLOR_ALPHA;
     case CAIRO_FORMAT_RGB24:
 	return CAIRO_CONTENT_COLOR;
-    case CAIRO_FORMAT_RGB16_565:
-	return CAIRO_CONTENT_COLOR;
     case CAIRO_FORMAT_A8:
     case CAIRO_FORMAT_A1:
 	return CAIRO_CONTENT_ALPHA;
     }
 
     ASSERT_NOT_REACHED;
     return CAIRO_CONTENT_COLOR_ALPHA;
 }
@@ -750,18 +743,16 @@ cairo_content_t
 int
 _cairo_format_bits_per_pixel (cairo_format_t format)
 {
     switch (format) {
     case CAIRO_FORMAT_ARGB32:
 	return 32;
     case CAIRO_FORMAT_RGB24:
 	return 32;
-    case CAIRO_FORMAT_RGB16_565:
-	return 16;
     case CAIRO_FORMAT_A8:
 	return 8;
     case CAIRO_FORMAT_A1:
 	return 1;
     default:
 	ASSERT_NOT_REACHED;
 	return 0;
     }
@@ -1726,21 +1717,16 @@ cairo_image_transparency_t
 
     if ((image->base.content & CAIRO_CONTENT_COLOR) == 0) {
 	if (image->format == CAIRO_FORMAT_A1)
 	    return image->transparency = CAIRO_IMAGE_HAS_BILEVEL_ALPHA;
 	else
 	    return image->transparency = CAIRO_IMAGE_HAS_ALPHA;
     }
 
-    if (image->format == CAIRO_FORMAT_RGB16_565) {
-	image->transparency = CAIRO_IMAGE_IS_OPAQUE;
-	return CAIRO_IMAGE_IS_OPAQUE;
-    }
-
     if (image->format != CAIRO_FORMAT_ARGB32)
 	return image->transparency = CAIRO_IMAGE_HAS_ALPHA;
 
     image->transparency = CAIRO_IMAGE_IS_OPAQUE;
     for (y = 0; y < image->height; y++) {
 	uint32_t *pixel = (uint32_t *) (image->data + y * image->stride);
 
 	for (x = 0; x < image->width; x++, pixel++) {
--- a/gfx/cairo/cairo/src/cairo-xlib-display.c
+++ b/gfx/cairo/cairo/src/cairo-xlib-display.c
@@ -47,17 +47,17 @@ struct _cairo_xlib_display {
     cairo_reference_count_t ref_count;
     cairo_mutex_t mutex;
 
     Display *display;
     cairo_xlib_screen_t *screens;
 
     int render_major;
     int render_minor;
-    XRenderPictFormat *cached_xrender_formats[CAIRO_FORMAT_RGB16_565 + 1];
+    XRenderPictFormat *cached_xrender_formats[CAIRO_FORMAT_A1 + 1];
 
     cairo_xlib_job_t *workqueue;
     cairo_freelist_t wq_freelist;
 
     cairo_xlib_hook_t *close_display_hooks;
     unsigned int buggy_gradients :1;
     unsigned int buggy_pad_reflect :1;
     unsigned int buggy_repeat :1;
@@ -611,45 +611,23 @@ XRenderPictFormat *
 
 	switch (format) {
 	case CAIRO_FORMAT_A1:
 	    pict_format = PictStandardA1; break;
 	case CAIRO_FORMAT_A8:
 	    pict_format = PictStandardA8; break;
 	case CAIRO_FORMAT_RGB24:
 	    pict_format = PictStandardRGB24; break;
-	case CAIRO_FORMAT_RGB16_565: {
-	    Visual *visual = NULL;
-	    Screen *screen = DefaultScreenOfDisplay(display->display);
-	    int j;
-	    for (j = 0; j < screen->ndepths; j++) {
-	        Depth *d = &screen->depths[j];
-	        if (d->depth == 16 && d->nvisuals && &d->visuals[0]) {
-	            if (d->visuals[0].red_mask   == 0xf800 &&
-	                d->visuals[0].green_mask == 0x7e0 &&
-	                d->visuals[0].blue_mask  == 0x1f)
-	                visual = &d->visuals[0];
-	            break;
-	        }
-	    }
-	    if (!visual) {
-	        CAIRO_MUTEX_UNLOCK (display->mutex);
-	        return NULL;
-	    }
-	    xrender_format = XRenderFindVisualFormat(display->display, visual);
-	    break;
-	}
 	default:
 	    ASSERT_NOT_REACHED;
 	case CAIRO_FORMAT_ARGB32:
 	    pict_format = PictStandardARGB32; break;
 	}
-	if (!xrender_format)
-	    xrender_format = XRenderFindStandardFormat (display->display,
-		                                        pict_format);
+	xrender_format = XRenderFindStandardFormat (display->display,
+		                                    pict_format);
 	display->cached_xrender_formats[format] = xrender_format;
     }
     CAIRO_MUTEX_UNLOCK (display->mutex);
 
     return xrender_format;
 }
 
 Display *
--- a/gfx/cairo/cairo/src/cairo.h
+++ b/gfx/cairo/cairo/src/cairo.h
@@ -2136,18 +2136,21 @@ cairo_surface_has_show_text_glyphs (cair
  * image data.
  *
  * New entries may be added in future versions.
  **/
 typedef enum _cairo_format {
     CAIRO_FORMAT_ARGB32,
     CAIRO_FORMAT_RGB24,
     CAIRO_FORMAT_A8,
-    CAIRO_FORMAT_A1,
-    CAIRO_FORMAT_RGB16_565
+    CAIRO_FORMAT_A1
+    /* The value of 4 is reserved by a deprecated enum value.
+     * The next format added must have an explicit value of 5.
+    CAIRO_FORMAT_RGB16_565 = 4,
+    */
 } cairo_format_t;
 
 cairo_public cairo_surface_t *
 cairo_image_surface_create (cairo_format_t	format,
 			    int			width,
 			    int			height);
 
 cairo_public int
--- a/gfx/cairo/cairo/src/cairoint.h
+++ b/gfx/cairo/cairo/src/cairoint.h
@@ -2182,17 +2182,17 @@ cairo_private cairo_bool_t
  *
  * If we do decide to start fully supporting RGB16_565 as an external
  * format, then %CAIRO_FORMAT_VALID needs to be adjusted to include
  * it. But that should not happen before all necessary code is fixed
  * to support it (at least cairo_surface_write_to_png() and a few spots
  * in cairo-xlib-surface.c--again see -Wswitch-enum).
  */
 #define CAIRO_FORMAT_INVALID ((unsigned int) -1)
-#define CAIRO_FORMAT_VALID(format) ((format) <= CAIRO_FORMAT_RGB16_565)
+#define CAIRO_FORMAT_VALID(format) ((format) <= CAIRO_FORMAT_A1)
 
 /* pixman-required stride alignment in bytes. */
 #define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
 #define CAIRO_STRIDE_FOR_WIDTH_BPP(w,bpp) \
    ((((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & -CAIRO_STRIDE_ALIGNMENT)
 
 #define CAIRO_CONTENT_VALID(content) ((content) && 			         \
 				      (((content) & ~(CAIRO_CONTENT_COLOR |      \