[cairo] [PATCH] share code common to Xlib and XCB backends

Ian Osgood iano at quirkster.com
Fri Oct 13 09:57:47 PDT 2006


From 33e5a195b850e9e7b88583ca965d70aeb932822c Mon Sep 17 00:00:00 2001
From: Ian Osgood <iano at quirkster.com>
Date: Thu, 12 Oct 2006 20:17:22 -0700
Subject: [PATCH] Move XCB sections next to XLIB sections.

---
 configure.in    |   16 ++++++++--------
 src/Makefile.am |   14 +++++++-------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/configure.in b/configure.in
index 0d81131..2817470 100644
--- a/configure.in
+++ b/configure.in
@@ -254,6 +254,14 @@ CAIRO_BACKEND_ENABLE(xlib_xrender, Xlib 
 
 dnl ===========================================================================
 
+CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [
+  xcb_REQUIRES="xcb >= 0.9.92 xcb-render >= 0.9.92 xcb-renderutil"
+  PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [
+  use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
+])
+
+dnl ===========================================================================
+
 CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
   dnl There is no pkgconfig for quartz; lets do a header check
   AC_CHECK_HEADER(Carbon/Carbon.h, , [use_quartz="no (Carbon headers not found)"])
@@ -268,14 +276,6 @@ CAIRO_BACKEND_ENABLE(nquartz, NativeQuar
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [
-  xcb_REQUIRES="xcb >= 0.9.92 xcb-render >= 0.9.92 xcb-renderutil"
-  PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [
-  use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
-])
-
-dnl ===========================================================================
-
 CAIRO_BACKEND_ENABLE(win32, Microsoft Windows, win32, WIN32_SURFACE, auto, [
   case "$host" in
     *-*-mingw*|*-*-cygwin*)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6e7f385..f6ac7d0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,6 +53,12 @@ libcairo_xlib_xrender_headers = cairo-xl
 backend_pkgconfigs += cairo-xlib-xrender.pc
 endif
 
+if CAIRO_HAS_XCB_SURFACE
+libcairo_xcb_headers = cairo-xcb.h cairo-xcb-xrender.h
+libcairo_xcb_sources = cairo-xcb-surface.c
+backend_pkgconfigs += cairo-xcb.pc
+endif
+
 if CAIRO_HAS_QUARTZ_SURFACE
 libcairo_quartz_headers = cairo-quartz.h
 libcairo_quartz_sources = cairo-quartz-surface.c cairo-quartz-private.h
@@ -65,12 +71,6 @@ libcairo_nquartz_sources = cairo-nquartz
 backend_pkgconfigs += cairo-nquartz.pc
 endif
 
-if CAIRO_HAS_XCB_SURFACE
-libcairo_xcb_headers = cairo-xcb.h cairo-xcb-xrender.h
-libcairo_xcb_sources = cairo-xcb-surface.c
-backend_pkgconfigs += cairo-xcb.pc
-endif
-
 libcairo_win32_sources =
 if CAIRO_HAS_WIN32_SURFACE
 libcairo_win32_headers = cairo-win32.h
@@ -228,9 +228,9 @@ libcairo_la_SOURCES =				\
 	$(libcairo_test_sources)		\
 	$(libcairo_font_subset_sources)		\
 	$(libcairo_xlib_sources)		\
+	$(libcairo_xcb_sources)			\
 	$(libcairo_quartz_sources)		\
 	$(libcairo_nquartz_sources)		\
-	$(libcairo_xcb_sources)			\
 	$(libcairo_glitz_sources)		\
 	$(libcairo_win32_sources)		\
 	$(libcairo_os2_sources)			\
-- 
1.4.2.3

-------------- next part --------------
From 21a533c87c94d51148655e27bb22c6178f1d07f2 Mon Sep 17 00:00:00 2001
From: Ian Osgood <iano at quirkster.com>
Date: Thu, 12 Oct 2006 20:55:14 -0700
Subject: [PATCH] Merge code common to XCB and Xlib backends.

Add cairo-x-common.c and cairo-x-private.h for code common to the X
based backends. So far, just the XRENDER feature checkers
_CAIRO_FORMAT_DEPTH are in there.
---
 configure.in             |    6 ++++
 src/Makefile.am          |    5 ++++
 src/cairo-x-common.c     |   58 ++++++++++++++++++++++++++++++++++++++++++
 src/cairo-x-private.h    |   63 ++++++++++++++++++++++++++++++++++++++++++++++
 src/cairo-xcb-surface.c  |   17 +-----------
 src/cairo-xlib-surface.c |   39 +---------------------------
 6 files changed, 134 insertions(+), 54 deletions(-)

diff --git a/configure.in b/configure.in
index 2817470..f7e5f29 100644
--- a/configure.in
+++ b/configure.in
@@ -262,6 +262,12 @@ CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_
 
 dnl ===========================================================================
 
+AM_CONDITIONAL(CAIRO_HAS_X_SURFACES,
+  [ test "x$use_xlib" = xyes -o "x$use_xcb" = xyes ] dnl
+)
+
+dnl ===========================================================================
+
 CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
   dnl There is no pkgconfig for quartz; lets do a header check
   AC_CHECK_HEADER(Carbon/Carbon.h, , [use_quartz="no (Carbon headers not found)"])
diff --git a/src/Makefile.am b/src/Makefile.am
index f6ac7d0..326aed7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,6 +59,10 @@ libcairo_xcb_sources = cairo-xcb-surface
 backend_pkgconfigs += cairo-xcb.pc
 endif
 
+if CAIRO_HAS_X_SURFACES
+libcairo_x_sources = cairo-x-common.c cairo-x-private.h
+endif
+
 if CAIRO_HAS_QUARTZ_SURFACE
 libcairo_quartz_headers = cairo-quartz.h
 libcairo_quartz_sources = cairo-quartz-surface.c cairo-quartz-private.h
@@ -229,6 +233,7 @@ libcairo_la_SOURCES =				\
 	$(libcairo_font_subset_sources)		\
 	$(libcairo_xlib_sources)		\
 	$(libcairo_xcb_sources)			\
+	$(libcairo_x_sources)			\
 	$(libcairo_quartz_sources)		\
 	$(libcairo_nquartz_sources)		\
 	$(libcairo_glitz_sources)		\
diff --git a/src/cairo-x-common.c b/src/cairo-x-common.c
new file mode 100644
index 0000000..4044ce7
--- /dev/null
+++ b/src/cairo-x-common.c
@@ -0,0 +1,58 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * This file is for common routines shared between all X based backends.
+ * Currently this includes the Xlib and XCB backends.
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Carl D. Worth <cworth at cworth.org>
+ */
+
+#include "cairoint.h"
+#include "cairo-x-private.h"
+
+int
+_CAIRO_FORMAT_DEPTH (cairo_format_t format)
+{
+    switch (format) {
+    case CAIRO_FORMAT_A1:
+	return 1;
+    case CAIRO_FORMAT_A8:
+	return 8;
+    case CAIRO_FORMAT_RGB24:
+	return 24;
+    case CAIRO_FORMAT_ARGB32:
+    default:
+	return 32;
+    }
+}
diff --git a/src/cairo-x-private.h b/src/cairo-x-private.h
new file mode 100644
index 0000000..24d9810
--- /dev/null
+++ b/src/cairo-x-private.h
@@ -0,0 +1,63 @@
+/* Cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2006 Ian Osgood
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ */
+
+#ifndef CAIRO_X_PRIVATE_H
+#define CAIRO_X_PRIVATE_H
+
+#include "cairoint.h"
+
+#define CAIRO_SURFACE_RENDER_AT_LEAST(surface, major, minor)	\
+	(((surface)->render_major > major) ||			\
+	 (((surface)->render_major == major) && ((surface)->render_minor >= minor)))
+
+#define CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
+#define CAIRO_SURFACE_RENDER_HAS_COMPOSITE(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
+#define CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
+
+#define CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLE(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 1)
+#define CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLES(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 1)
+
+#define CAIRO_SURFACE_RENDER_HAS_DISJOINT(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 2)
+#define CAIRO_SURFACE_RENDER_HAS_CONJOINT(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 2)
+
+#define CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
+#define CAIRO_SURFACE_RENDER_HAS_TRIANGLES(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
+#define CAIRO_SURFACE_RENDER_HAS_TRISTRIP(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
+#define CAIRO_SURFACE_RENDER_HAS_TRIFAN(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
+
+#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
+#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
+
+
+int _CAIRO_FORMAT_DEPTH (cairo_format_t format);
+
+#endif
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index c28b7ab..7f3c802 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -37,6 +37,7 @@
 #include "cairoint.h"
 #include "cairo-xcb.h"
 #include "cairo-xcb-xrender.h"
+#include "cairo-x-private.h"
 #include <xcb/xcb_renderutil.h>
 
 #define AllPlanes               ((unsigned long)~0L)
@@ -127,22 +128,6 @@ #define CAIRO_SURFACE_RENDER_HAS_FILTERS
 static void
 _cairo_xcb_surface_ensure_gc (cairo_xcb_surface_t *surface);
 
-static int
-_CAIRO_FORMAT_DEPTH (cairo_format_t format)
-{
-    switch (format) {
-    case CAIRO_FORMAT_A1:
-	return 1;
-    case CAIRO_FORMAT_A8:
-	return 8;
-    case CAIRO_FORMAT_RGB24:
-	return 24;
-    case CAIRO_FORMAT_ARGB32:
-    default:
-	return 32;
-    }
-}
-
 static cairo_surface_t *
 _cairo_xcb_surface_create_similar (void		       *abstract_src,
 				   cairo_content_t	content,
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index d0f9158..1da16c9 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -41,6 +41,7 @@ #include "cairo-xlib-xrender.h"
 #include "cairo-xlib-test.h"
 #include "cairo-xlib-private.h"
 #include "cairo-clip-private.h"
+#include "cairo-x-private.h"
 #include <X11/extensions/Xrender.h>
 #include <X11/extensions/renderproto.h>
 
@@ -128,28 +129,6 @@ struct _cairo_xlib_surface {
     XRenderPictFormat *xrender_format;
 };
 
-#define CAIRO_SURFACE_RENDER_AT_LEAST(surface, major, minor)	\
-	(((surface)->render_major > major) ||			\
-	 (((surface)->render_major == major) && ((surface)->render_minor >= minor)))
-
-#define CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
-#define CAIRO_SURFACE_RENDER_HAS_COMPOSITE(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
-#define CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
-
-#define CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLE(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 1)
-#define CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLES(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 1)
-
-#define CAIRO_SURFACE_RENDER_HAS_DISJOINT(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 2)
-#define CAIRO_SURFACE_RENDER_HAS_CONJOINT(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 2)
-
-#define CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
-#define CAIRO_SURFACE_RENDER_HAS_TRIANGLES(surface)		CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
-#define CAIRO_SURFACE_RENDER_HAS_TRISTRIP(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
-#define CAIRO_SURFACE_RENDER_HAS_TRIFAN(surface)			CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
-
-#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
-#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
-
 static cairo_bool_t cairo_xlib_render_disabled = FALSE;
 
 /**
@@ -169,22 +148,6 @@ _cairo_xlib_test_disable_render (void)
     cairo_xlib_render_disabled = TRUE;
 }
 
-static int
-_CAIRO_FORMAT_DEPTH (cairo_format_t format)
-{
-    switch (format) {
-    case CAIRO_FORMAT_A1:
-	return 1;
-    case CAIRO_FORMAT_A8:
-	return 8;
-    case CAIRO_FORMAT_RGB24:
-	return 24;
-    case CAIRO_FORMAT_ARGB32:
-    default:
-	return 32;
-    }
-}
-
 static XRenderPictFormat *
 _CAIRO_FORMAT_TO_XRENDER_FORMAT(Display *dpy, cairo_format_t format)
 {
-- 
1.4.2.3

-------------- next part --------------
From 4abb4484ed4b55fadb0f4a4e690e89725100ba47 Mon Sep 17 00:00:00 2001
From: Ian Osgood <iano at quirkster.com>
Date: Thu, 12 Oct 2006 21:01:23 -0700
Subject: [PATCH] Add _CAIRO_MASK_FORMAT to x_common.

---
 src/cairo-x-common.c     |   40 ++++++++++++++++++++++++++++++++++++++++
 src/cairo-x-private.h    |    6 +++++-
 src/cairo-xcb-surface.c  |   40 ----------------------------------------
 src/cairo-xlib-surface.c |   40 ----------------------------------------
 4 files changed, 45 insertions(+), 81 deletions(-)

diff --git a/src/cairo-x-common.c b/src/cairo-x-common.c
index 4044ce7..33d87c5 100644
--- a/src/cairo-x-common.c
+++ b/src/cairo-x-common.c
@@ -56,3 +56,43 @@ _CAIRO_FORMAT_DEPTH (cairo_format_t form
 	return 32;
     }
 }
+
+cairo_bool_t
+_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
+{
+    switch (masks->bpp) {
+    case 32:
+	if (masks->alpha_mask == 0xff000000 &&
+	    masks->red_mask == 0x00ff0000 &&
+	    masks->green_mask == 0x0000ff00 &&
+	    masks->blue_mask == 0x000000ff)
+	{
+	    *format = CAIRO_FORMAT_ARGB32;
+	    return TRUE;
+	}
+	if (masks->alpha_mask == 0x00000000 &&
+	    masks->red_mask == 0x00ff0000 &&
+	    masks->green_mask == 0x0000ff00 &&
+	    masks->blue_mask == 0x000000ff)
+	{
+	    *format = CAIRO_FORMAT_RGB24;
+	    return TRUE;
+	}
+	break;
+    case 8:
+	if (masks->alpha_mask == 0xff)
+	{
+	    *format = CAIRO_FORMAT_A8;
+	    return TRUE;
+	}
+	break;
+    case 1:
+	if (masks->alpha_mask == 0x1)
+	{
+	    *format = CAIRO_FORMAT_A1;
+	    return TRUE;
+	}
+	break;
+    }
+    return FALSE;
+}
diff --git a/src/cairo-x-private.h b/src/cairo-x-private.h
index 24d9810..34f8f57 100644
--- a/src/cairo-x-private.h
+++ b/src/cairo-x-private.h
@@ -58,6 +58,10 @@ #define CAIRO_SURFACE_RENDER_HAS_PICTURE
 #define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
 
 
-int _CAIRO_FORMAT_DEPTH (cairo_format_t format);
+int
+_CAIRO_FORMAT_DEPTH (cairo_format_t format);
+
+cairo_bool_t
+_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format);
 
 #endif
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 7f3c802..86879c4 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -216,46 +216,6 @@ _bytes_per_line(xcb_connection_t *c, int
     return ((bpp * width + bitmap_pad - 1) & -bitmap_pad) >> 3;
 }
 
-static cairo_bool_t
-_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
-{
-    switch (masks->bpp) {
-    case 32:
-	if (masks->alpha_mask == 0xff000000 &&
-	    masks->red_mask == 0x00ff0000 &&
-	    masks->green_mask == 0x0000ff00 &&
-	    masks->blue_mask == 0x000000ff)
-	{
-	    *format = CAIRO_FORMAT_ARGB32;
-	    return TRUE;
-	}
-	if (masks->alpha_mask == 0x00000000 &&
-	    masks->red_mask == 0x00ff0000 &&
-	    masks->green_mask == 0x0000ff00 &&
-	    masks->blue_mask == 0x000000ff)
-	{
-	    *format = CAIRO_FORMAT_RGB24;
-	    return TRUE;
-	}
-	break;
-    case 8:
-	if (masks->alpha_mask == 0xff)
-	{
-	    *format = CAIRO_FORMAT_A8;
-	    return TRUE;
-	}
-	break;
-    case 1:
-	if (masks->alpha_mask == 0x1)
-	{
-	    *format = CAIRO_FORMAT_A1;
-	    return TRUE;
-	}
-	break;
-    }
-    return FALSE;
-}
-
 static cairo_status_t
 _get_image_surface (cairo_xcb_surface_t     *surface,
 		    cairo_rectangle_int16_t *interest_rect,
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 1da16c9..bc7e1f1 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -315,46 +315,6 @@ _noop_error_handler (Display     *displa
     return False;		/* return value is ignored */
 }
 
-static cairo_bool_t
-_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
-{
-    switch (masks->bpp) {
-    case 32:
-	if (masks->alpha_mask == 0xff000000 &&
-	    masks->red_mask == 0x00ff0000 &&
-	    masks->green_mask == 0x0000ff00 &&
-	    masks->blue_mask == 0x000000ff)
-	{
-	    *format = CAIRO_FORMAT_ARGB32;
-	    return True;
-	}
-	if (masks->alpha_mask == 0x00000000 &&
-	    masks->red_mask == 0x00ff0000 &&
-	    masks->green_mask == 0x0000ff00 &&
-	    masks->blue_mask == 0x000000ff)
-	{
-	    *format = CAIRO_FORMAT_RGB24;
-	    return True;
-	}
-	break;
-    case 8:
-	if (masks->alpha_mask == 0xff)
-	{
-	    *format = CAIRO_FORMAT_A8;
-	    return True;
-	}
-	break;
-    case 1:
-	if (masks->alpha_mask == 0x1)
-	{
-	    *format = CAIRO_FORMAT_A1;
-	    return True;
-	}
-	break;
-    }
-    return False;
-}
-
 static void
 _swap_ximage_2bytes (XImage *ximage)
 {
-- 
1.4.2.3



More information about the cairo mailing list