[cairo-commit] cairo/src cairo-glitz-surface.c, 1.62, 1.63 cairo-image-surface.c, 1.60, 1.61 cairo-pattern.c, 1.65, 1.66 cairo-pdf-surface.c, 1.59, 1.60 cairo-xcb-surface.c, 1.47, 1.48 cairo-xlib-surface.c, 1.122, 1.123 cairo.h, 1.152, 1.153 cairoint.h, 1.211, 1.212

Billy Biggs commit at pdx.freedesktop.org
Sun Oct 9 09:18:18 PDT 2005


Committed by: vektor

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

Modified Files:
	cairo-glitz-surface.c cairo-image-surface.c cairo-pattern.c 
	cairo-pdf-surface.c cairo-xcb-surface.c cairo-xlib-surface.c 
	cairo.h cairoint.h 
Log Message:
2005-10-09  Billy Biggs  <vektor at dumbterm.net>

	reviewed by: davidr, cworth, otaylor

	* src/cairo.h: Add a "nearest" extend mode, where the closest pixel
	is repeated for pixels outside of the source area.  Note that
	for gradients, applications which had explicitly set a repeat mode
	of NONE will now need to change to use NEAREST to get the same
	behaviour.
	* src/cairoint.h: Split CARIO_EXTEND_DEFAULT to indicate defaults
	for surfaces and gradients.  The default for gradients is still
	the NEAREST beaviour.
	* src/cairo-glitz-surface.c (_cairo_glitz_pattern_acquire_surface):
	Support the NEAREST mode, change NONE to be TRANSPARENT.
	* src/cairo-image-surface.c: (_cairo_image_surface_set_attributes):
	Update the extend mode code to use the pixman support.
	* src/cairo-pattern.c (_cairo_pattern_init),
	(_cairo_pattern_calc_color_at_pixel): Handle NEAREST, note that
	support for NONE is not yet handled for gradients.
	* src/cairo-xcb-surface.c (_cairo_xcb_surface_set_attributes):
	Add a check for NEAREST but don't do anything useful.
	* src/cairo-xlib-surface.c (_cairo_xlib_surface_set_attributes):
	Add a check for NEAREST but don't do anything useful.
	* src/cairo-pdf-surface.c: Update a comment about the extend support
	in the image backend.



Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- cairo-glitz-surface.c	19 Sep 2005 14:18:51 -0000	1.62
+++ cairo-glitz-surface.c	9 Oct 2005 16:18:16 -0000	1.63
@@ -674,7 +674,7 @@
 
 	switch (pattern->extend) {
 	case CAIRO_EXTEND_NONE:
-	    attr->fill = GLITZ_FILL_NEAREST;
+	    attr->fill = GLITZ_FILL_TRANSPARENT;
 	    break;
 	case CAIRO_EXTEND_REPEAT:
 	    attr->fill = GLITZ_FILL_REPEAT;
@@ -682,6 +682,9 @@
 	case CAIRO_EXTEND_REFLECT:
 	    attr->fill = GLITZ_FILL_REFLECT;
 	    break;
+	case CAIRO_EXTEND_NEAREST:
+	    attr->fill = GLITZ_FILL_NEAREST;
+	    break;
 	}
 
 	attr->params	    = params;

Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- cairo-image-surface.c	28 Aug 2005 01:40:47 -0000	1.60
+++ cairo-image-surface.c	9 Oct 2005 16:18:16 -0000	1.61
@@ -480,14 +480,6 @@
     return CAIRO_STATUS_SUCCESS;
 }
 
-static cairo_status_t
-_cairo_image_surface_set_repeat (cairo_image_surface_t *surface, int repeat)
-{
-    pixman_image_set_repeat (surface->pixman_image, repeat);
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
 static cairo_int_status_t
 _cairo_image_surface_set_attributes (cairo_image_surface_t      *surface,
 				     cairo_surface_attributes_t *attributes)
@@ -500,14 +492,16 @@
 
     switch (attributes->extend) {
     case CAIRO_EXTEND_NONE:
-	_cairo_image_surface_set_repeat (surface, 0);
+        pixman_image_set_repeat (surface->pixman_image, PIXMAN_REPEAT_NONE);
 	break;
     case CAIRO_EXTEND_REPEAT:
-	_cairo_image_surface_set_repeat (surface, 1);
+        pixman_image_set_repeat (surface->pixman_image, PIXMAN_REPEAT_NORMAL);
 	break;
     case CAIRO_EXTEND_REFLECT:
-	/* XXX: Obviously wrong. */
-	_cairo_image_surface_set_repeat (surface, 1);
+        pixman_image_set_repeat (surface->pixman_image, PIXMAN_REPEAT_REFLECT);
+	break;
+    case CAIRO_EXTEND_NEAREST:
+        pixman_image_set_repeat (surface->pixman_image, PIXMAN_REPEAT_PAD);
 	break;
     }
     

Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- cairo-pattern.c	30 Aug 2005 17:42:17 -0000	1.65
+++ cairo-pattern.c	9 Oct 2005 16:18:16 -0000	1.66
@@ -50,7 +50,7 @@
       CAIRO_STATUS_NO_MEMORY,	/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
-      CAIRO_EXTEND_DEFAULT },	/* extend */
+      CAIRO_EXTEND_GRADIENT_DEFAULT },	/* extend */
 };
 
 static const cairo_solid_pattern_t cairo_pattern_nil_null_pointer = {
@@ -59,7 +59,7 @@
       CAIRO_STATUS_NULL_POINTER,/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
-      CAIRO_EXTEND_DEFAULT },	/* extend */
+      CAIRO_EXTEND_GRADIENT_DEFAULT },	/* extend */
 };
 
 static const cairo_solid_pattern_t cairo_pattern_nil_file_not_found = {
@@ -68,7 +68,7 @@
       CAIRO_STATUS_FILE_NOT_FOUND, /* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
-      CAIRO_EXTEND_DEFAULT },	/* extend */
+      CAIRO_EXTEND_GRADIENT_DEFAULT },	/* extend */
 };
 
 static const cairo_solid_pattern_t cairo_pattern_nil_read_error = {
@@ -77,7 +77,7 @@
       CAIRO_STATUS_READ_ERROR,	/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
-      CAIRO_EXTEND_DEFAULT },	/* extend */
+      CAIRO_EXTEND_GRADIENT_DEFAULT },	/* extend */
 };
 
 static const cairo_pattern_t *
@@ -131,7 +131,12 @@
     pattern->type      = type; 
     pattern->ref_count = 1;
     pattern->status    = CAIRO_STATUS_SUCCESS;
-    pattern->extend    = CAIRO_EXTEND_DEFAULT;
+
+    if (type == CAIRO_PATTERN_SURFACE)
+	pattern->extend = CAIRO_EXTEND_SURFACE_DEFAULT;
+    else
+	pattern->extend = CAIRO_EXTEND_GRADIENT_DEFAULT;
+
     pattern->filter    = CAIRO_FILTER_DEFAULT;
 
     cairo_matrix_init_identity (&pattern->matrix);
@@ -930,6 +935,7 @@
 		factor -= factor & 0xffff0000;
 	}
 	break;
+    case CAIRO_EXTEND_NEAREST:
     case CAIRO_EXTEND_NONE:
 	break;
     }

Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo-pdf-surface.c	7 Oct 2005 20:21:01 -0000	1.59
+++ cairo-pdf-surface.c	9 Oct 2005 16:18:16 -0000	1.60
@@ -79,8 +79,6 @@
  *
  * - Add test case for RGBA gradients.
  *
- * - Pattern extend isn't honoured by image backend.
- *
  * - Coordinate space for create_similar() args?
  *
  * - Investigate /Matrix entry in content stream dicts for pages

Index: cairo-xcb-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xcb-surface.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- cairo-xcb-surface.c	10 Aug 2005 21:30:15 -0000	1.47
+++ cairo-xcb-surface.c	9 Oct 2005 16:18:16 -0000	1.48
@@ -787,6 +787,8 @@
 	break;
     case CAIRO_EXTEND_REFLECT:
 	return CAIRO_INT_STATUS_UNSUPPORTED;
+    case CAIRO_EXTEND_NEAREST:
+	return CAIRO_INT_STATUS_UNSUPPORTED;
     }
 
     status = _cairo_xcb_surface_set_filter (surface, attributes->filter);

Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- cairo-xlib-surface.c	6 Oct 2005 18:32:54 -0000	1.122
+++ cairo-xlib-surface.c	9 Oct 2005 16:18:16 -0000	1.123
@@ -937,6 +937,7 @@
 	_cairo_xlib_surface_set_repeat (surface, 1);
 	break;
     case CAIRO_EXTEND_REFLECT:
+    case CAIRO_EXTEND_NEAREST:
 	return CAIRO_INT_STATUS_UNSUPPORTED;
     }
 

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- cairo.h	7 Sep 2005 23:31:22 -0000	1.152
+++ cairo.h	9 Oct 2005 16:18:16 -0000	1.153
@@ -1292,7 +1292,8 @@
 typedef enum _cairo_extend {
     CAIRO_EXTEND_NONE,
     CAIRO_EXTEND_REPEAT,
-    CAIRO_EXTEND_REFLECT
+    CAIRO_EXTEND_REFLECT,
+    CAIRO_EXTEND_NEAREST
 } cairo_extend_t;
 
 cairo_public void

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- cairoint.h	19 Sep 2005 21:24:00 -0000	1.211
+++ cairoint.h	9 Oct 2005 16:18:16 -0000	1.212
@@ -821,7 +821,8 @@
     CAIRO_STOCK_TRANSPARENT
 } cairo_stock_t;
 
-#define CAIRO_EXTEND_DEFAULT CAIRO_EXTEND_NONE
+#define CAIRO_EXTEND_SURFACE_DEFAULT CAIRO_EXTEND_NONE
+#define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_NEAREST
 #define CAIRO_FILTER_DEFAULT CAIRO_FILTER_BEST
 
 typedef enum {



More information about the cairo-commit mailing list