[cairo-commit] cairo/src cairo-pattern.c, 1.45, 1.46 cairo.c, 1.109, 1.110 cairoint.h, 1.156, 1.157

Carl Worth commit at pdx.freedesktop.org
Mon Jun 20 11:09:53 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv6835/src

Modified Files:
	cairo-pattern.c cairo.c cairoint.h 
Log Message:

        * src/cairoint.h:
        * src/cairo-pattern.c: (_cairo_pattern_is_opaque_solid): Abstract
        CAIRO_ALPHA_IS_OPAQUE out for general internal use.

        * src/cairo.c: (cairo_paint_with_alpha): Optimize to defer to
        cairo_paint if the alpha value is actually opaque.


Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- cairo-pattern.c	17 Jun 2005 20:25:19 -0000	1.45
+++ cairo-pattern.c	20 Jun 2005 18:09:51 -0000	1.46
@@ -1115,7 +1115,7 @@
 
     solid = (cairo_solid_pattern_t *) pattern;
 
-    return (solid->color.alpha >= ((double)0xff00 / (double)0xffff));
+    return CAIRO_ALPHA_IS_OPAQUE (solid->color.alpha);
 }
 
 static cairo_int_status_t

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- cairo.c	20 Jun 2005 16:59:23 -0000	1.109
+++ cairo.c	20 Jun 2005 18:09:51 -0000	1.110
@@ -1249,6 +1249,11 @@
 	return;
     }
 
+    if (CAIRO_ALPHA_IS_OPAQUE (alpha)) {
+	cairo_paint (cr);
+	return;
+    }
+
     _cairo_color_init_rgba (&color, 1., 1., 1., alpha);
     _cairo_pattern_init_solid (&pattern.solid, &color);
 

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- cairoint.h	17 Jun 2005 20:25:19 -0000	1.156
+++ cairoint.h	20 Jun 2005 18:09:51 -0000	1.157
@@ -147,6 +147,8 @@
 #define CAIRO_MAXSHORT SHRT_MAX
 #define CAIRO_MINSHORT SHRT_MIN
 
+#define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff))
+
 typedef struct _cairo_point {
     cairo_fixed_t x;
     cairo_fixed_t y;




More information about the cairo-commit mailing list