[cairo-commit] cairo/src Makefile.am, 1.22, 1.23 cairo.c, 1.34, 1.35 cairo.h, 1.51, 1.52 cairo_ft_font.c, 1.20, 1.21 cairo_gstate.c, 1.44, 1.45 cairo_image_surface.c, 1.9, 1.10 cairo_png_surface.c, 1.2, 1.3 cairo_ps_surface.c, 1.8, 1.9 cairo_surface.c, 1.24, 1.25 cairo_traps.c, 1.14, 1.15 cairo_xcb_surface.c, 1.3, 1.4 cairo_xlib_surface.c, 1.18, 1.19 cairoint.h, 1.54, 1.55

David Reveman commit at pdx.freedesktop.org
Tue Apr 6 09:36:15 PDT 2004


Committed by: davidr

Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv17981/src

Modified Files:
	Makefile.am cairo.c cairo.h cairo_ft_font.c cairo_gstate.c 
	cairo_image_surface.c cairo_png_surface.c cairo_ps_surface.c 
	cairo_surface.c cairo_traps.c cairo_xcb_surface.c 
	cairo_xlib_surface.c cairoint.h 
Log Message:
Added new pattern API

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/src/Makefile.am,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** a/Makefile.am	31 Mar 2004 02:55:48 -0000	1.22
--- b/Makefile.am	6 Apr 2004 16:36:12 -0000	1.23
***************
*** 46,49 ****
--- 46,50 ----
  	cairo_surface.c		\
  	cairo_traps.c		\
+ 	cairo_pattern.c		\
  	$(libcairo_ps_sources)  \
  	$(libcairo_png_sources) \
***************
*** 56,59 ****
  INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS) $(FONTCONFIG_CFLAGS) $(XRENDER_CFLAGS) $(XCB_CFLAGS) $(PNG_CFLAGS)
  
! libcairo_la_LIBADD = $(CAIRO_LIBS) $(FONTCONFIG_LIBS) $(XRENDER_LIBS) $(XCB_LIBS) $(PNG_LIBS) -lm -lz
! 
--- 57,59 ----
  INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS) $(FONTCONFIG_CFLAGS) $(XRENDER_CFLAGS) $(XCB_CFLAGS) $(PNG_CFLAGS)
  
! libcairo_la_LIBADD = $(CAIRO_LIBS) $(FONTCONFIG_LIBS) $(XRENDER_LIBS) $(XCB_LIBS) $(PS_LIBS) $(PNG_LIBS) -lm

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** a/cairo.c	19 Mar 2004 23:47:25 -0000	1.34
--- b/cairo.c	6 Apr 2004 16:36:12 -0000	1.35
***************
*** 30,36 ****
  #define CAIRO_TOLERANCE_MINIMUM	0.0002 /* We're limited by 16 bits of sub-pixel precision */
  
- static void
- _cairo_restrict_value (double *value, double min, double max);
- 
  cairo_t *
  cairo_create (void)
--- 30,33 ----
***************
*** 221,225 ****
  
  void
! cairo_set_pattern (cairo_t *cr, cairo_surface_t *pattern)
  {
      if (cr->status)
--- 218,222 ----
  
  void
! cairo_set_pattern (cairo_t *cr, cairo_pattern_t *pattern)
  {
      if (cr->status)
***************
*** 229,232 ****
--- 226,235 ----
  }
  
+ cairo_pattern_t *
+ cairo_current_pattern (cairo_t *cr)
+ {
+     return _cairo_gstate_current_pattern (cr->gstate);
+ }
+ 
  void
  cairo_set_tolerance (cairo_t *cr, double tolerance)
***************
*** 637,640 ****
--- 640,663 ----
  
  void
+ cairo_stroke_extents (cairo_t *cr,
+                       double *x1, double *y1, double *x2, double *y2)
+ {
+     if (cr->status)
+ 	return;
+     
+     cr->status = _cairo_gstate_stroke_extents (cr->gstate, x1, y1, x2, y2);
+ }
+ 
+ void
+ cairo_fill_extents (cairo_t *cr,
+                     double *x1, double *y1, double *x2, double *y2)
+ {
+     if (cr->status)
+ 	return;
+     
+     cr->status = _cairo_gstate_fill_extents (cr->gstate, x1, y1, x2, y2);
+ }
+ 
+ void
  cairo_init_clip (cairo_t *cr)
  {
***************
*** 943,947 ****
  DEPRECATE (cairo_get_status_string, cairo_status_string);
  
! static void
  _cairo_restrict_value (double *value, double min, double max)
  {
--- 966,970 ----
  DEPRECATE (cairo_get_status_string, cairo_status_string);
  
! void
  _cairo_restrict_value (double *value, double min, double max)
  {

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** a/cairo.h	2 Apr 2004 16:01:09 -0000	1.51
--- b/cairo.h	6 Apr 2004 16:36:12 -0000	1.52
***************
*** 37,40 ****
--- 37,41 ----
  typedef struct cairo_surface cairo_surface_t;
  typedef struct cairo_matrix cairo_matrix_t;
+ typedef struct cairo_pattern cairo_pattern_t;
  
  #ifdef __cplusplus
***************
*** 182,189 ****
  
  void
! cairo_set_alpha (cairo_t *cr, double alpha);
  
  void
! cairo_set_pattern (cairo_t *cr, cairo_surface_t *pattern);
  
  /* XXX: Currently, the tolerance value is specified by the user in
--- 183,190 ----
  
  void
! cairo_set_pattern (cairo_t *cr, cairo_pattern_t *pattern);
  
  void
! cairo_set_alpha (cairo_t *cr, double alpha);
  
  /* XXX: Currently, the tolerance value is specified by the user in
***************
*** 354,357 ****
--- 355,369 ----
  cairo_in_fill (cairo_t *cr, double x, double y);
  
+ /* Rectangular extents */
+ void
+ cairo_stroke_extents (cairo_t *cr,
+ 		      double *x1, double *y1,
+ 		      double *x2, double *y2);
+ 
+ void
+ cairo_fill_extents (cairo_t *cr,
+ 		    double *x1, double *y1,
+ 		    double *x2, double *y2);
+ 
  /* Clipping */
  void
***************
*** 506,509 ****
--- 518,523 ----
  void
  cairo_current_rgb_color (cairo_t *cr, double *red, double *green, double *blue);
+ cairo_pattern_t *
+ cairo_current_pattern (cairo_t *cr);
  
  double
***************
*** 641,652 ****
  cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix);
  
! typedef enum cairo_filter {
      CAIRO_FILTER_FAST,
      CAIRO_FILTER_GOOD,
      CAIRO_FILTER_BEST,
      CAIRO_FILTER_NEAREST,
!     CAIRO_FILTER_BILINEAR
  } cairo_filter_t;
! 
  /* XXX: Rework this as a cairo function: cairo_set_pattern_filter */
  cairo_status_t
--- 655,667 ----
  cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix);
  
! typedef enum {
      CAIRO_FILTER_FAST,
      CAIRO_FILTER_GOOD,
      CAIRO_FILTER_BEST,
      CAIRO_FILTER_NEAREST,
!     CAIRO_FILTER_BILINEAR,
!     CAIRO_FILTER_GAUSSIAN
  } cairo_filter_t;
!   
  /* XXX: Rework this as a cairo function: cairo_set_pattern_filter */
  cairo_status_t
***************
*** 670,673 ****
--- 685,736 ----
  				     int			stride);
  
+ /* Pattern creation functions */
+ cairo_pattern_t *
+ cairo_pattern_create_for_surface (cairo_surface_t *surface);
+ 
+ cairo_pattern_t *
+ cairo_pattern_create_linear (double x0, double y0,
+ 			     double x1, double y1);
+ 
+ cairo_pattern_t *
+ cairo_pattern_create_radial (double cx0, double cy0, double radius0,
+ 			     double cx1, double cy1, double radius1);
+ 
+ void
+ cairo_pattern_reference (cairo_pattern_t *pattern);
+ 
+ void
+ cairo_pattern_destroy (cairo_pattern_t *pattern);
+   
+ cairo_status_t
+ cairo_pattern_add_color_stop (cairo_pattern_t *pattern,
+ 			      double offset,
+ 			      double red, double green, double blue,
+ 			      double alpha);
+   
+ cairo_status_t
+ cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
+ 
+ cairo_status_t
+ cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
+ 
+ typedef enum {
+     CAIRO_EXTEND_NONE,
+     CAIRO_EXTEND_REPEAT,
+     CAIRO_EXTEND_REFLECT
+ } cairo_extend_t;
+ 
+ cairo_status_t
+ cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
+ 
+ cairo_extend_t
+ cairo_pattern_get_extend (cairo_pattern_t *pattern);
+ 
+ cairo_status_t
+ cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
+ 
+ cairo_filter_t
+ cairo_pattern_get_filter (cairo_pattern_t *pattern);
+ 
  #ifdef CAIRO_HAS_PS_SURFACE
  
***************
*** 708,712 ****
  			   cairo_format_t	format,
  			   Colormap		colormap);
! 
  /* XXX: This has been proposed
  cairo_status_t
--- 771,775 ----
  			   cairo_format_t	format,
  			   Colormap		colormap);
!   
  /* XXX: This has been proposed
  cairo_status_t

Index: cairo_ft_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ft_font.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** a/cairo_ft_font.c	31 Mar 2004 02:55:48 -0000	1.20
--- b/cairo_ft_font.c	6 Apr 2004 16:36:12 -0000	1.21
***************
*** 478,481 ****
--- 478,482 ----
      FT_GlyphSlot glyphslot;
      cairo_surface_t *mask = NULL;
+     cairo_point_double_t origin;
  
      double x, y;
***************
*** 505,509 ****
     
  	x = glyphs[i].x;
! 	y = glyphs[i].y;      
  
          /* X gets upset with zero-sized images (such as whitespace) */
--- 506,515 ----
     
  	x = glyphs[i].x;
! 	y = glyphs[i].y;
! 
! 	if (i == 0) {
! 	    origin.x = x;
! 	    origin.y = y;
! 	}
  
          /* X gets upset with zero-sized images (such as whitespace) */
***************
*** 548,556 ****
  	}
  	
! 	status = _cairo_surface_composite (operator, source, mask, surface,
! 					   0, 0, 0, 0, 
! 					   x + glyphslot->bitmap_left, 
! 					   y - glyphslot->bitmap_top, 
! 					   (double)width, (double)height);
  	
  	cairo_surface_destroy (mask);
--- 554,565 ----
  	}
  	
! 	status =
! 	    _cairo_surface_composite (operator, source, mask, surface,
! 				      -origin.x + x + glyphslot->bitmap_left,
! 				      -origin.y + y - glyphslot->bitmap_top,
! 				      0, 0, 
! 				      x + glyphslot->bitmap_left, 
! 				      y - glyphslot->bitmap_top, 
! 				      (double) width, (double) height);
  	
  	cairo_surface_destroy (mask);

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** a/cairo_gstate.c	31 Mar 2004 01:49:31 -0000	1.44
--- b/cairo_gstate.c	6 Apr 2004 16:36:12 -0000	1.45
***************
*** 32,40 ****
  
  static cairo_status_t
- _cairo_gstate_ensure_source (cairo_gstate_t *gstate);
- 
- static cairo_status_t
  _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate,
! 					     cairo_surface_t *src,
  					     cairo_operator_t operator,
  					     cairo_surface_t *dst,
--- 32,37 ----
[...1069 lines suppressed...]
-     if (status)
- 	return status;
- 
      cairo_matrix_copy (&saved_font_matrix, &gstate->font->matrix);
      cairo_matrix_multiply (&gstate->font->matrix, &gstate->ctm, &gstate->font->matrix);
--- 2143,2146 ----
***************
*** 2098,2103 ****
  
      cairo_matrix_copy (&gstate->font->matrix, &saved_font_matrix);
!     restore_text_rendering_context (gstate, &user_to_source);
!     
      free (transformed_glyphs);
      return status;
--- 2151,2155 ----
  
      cairo_matrix_copy (&gstate->font->matrix, &saved_font_matrix);
! 
      free (transformed_glyphs);
      return status;

Index: cairo_image_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_image_surface.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** a/cairo_image_surface.c	31 Mar 2004 01:49:31 -0000	1.9
--- b/cairo_image_surface.c	6 Apr 2004 16:36:12 -0000	1.10
***************
*** 468,471 ****
--- 468,491 ----
  }
  
+ static cairo_status_t
+ _cairo_image_abstract_surface_create_pattern (void *abstract_surface,
+ 					      cairo_pattern_t *pattern,
+ 					      cairo_box_t *box)
+ {
+     cairo_image_surface_t *image;
+ 
+     /* Fall back to general pattern creation for surface patterns. */
+     if (pattern->type == CAIRO_PATTERN_SURFACE)
+ 	return CAIRO_INT_STATUS_UNSUPPORTED;
+     
+     image = _cairo_pattern_get_image (pattern, box);
+     if (image) {
+ 	pattern->source = &image->base;
+ 	
+ 	return CAIRO_STATUS_SUCCESS;
+     } else
+ 	return CAIRO_STATUS_NO_MEMORY;
+ }
+   
  static const cairo_surface_backend_t cairo_image_surface_backend = {
      _cairo_image_surface_create_similar,
***************
*** 482,485 ****
      _cairo_image_surface_copy_page,
      _cairo_image_surface_show_page,
!     _cairo_image_abstract_surface_set_clip_region
  };
--- 502,506 ----
      _cairo_image_surface_copy_page,
      _cairo_image_surface_show_page,
!     _cairo_image_abstract_surface_set_clip_region,
!     _cairo_image_abstract_surface_create_pattern
  };

Index: cairo_png_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_png_surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/cairo_png_surface.c	23 Mar 2004 18:33:32 -0000	1.2
--- b/cairo_png_surface.c	6 Apr 2004 16:36:12 -0000	1.3
***************
*** 307,310 ****
--- 307,317 ----
  }
  
+ static cairo_int_status_t
+ _cairo_png_surface_create_pattern (void *abstract_surface,
+                                    cairo_pattern_t *pattern,
+                                    cairo_box_t *extents)
+ {
+     return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
  
  static const cairo_surface_backend_t cairo_png_surface_backend = {
***************
*** 322,325 ****
      _cairo_png_surface_copy_page,
      _cairo_png_surface_show_page,
!     _cairo_png_surface_set_clip_region
  };
--- 329,333 ----
      _cairo_png_surface_copy_page,
      _cairo_png_surface_show_page,
!     _cairo_png_surface_set_clip_region,
!     _cairo_png_surface_create_pattern
  };

Index: cairo_ps_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ps_surface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** a/cairo_ps_surface.c	23 Mar 2004 18:33:32 -0000	1.8
--- b/cairo_ps_surface.c	6 Apr 2004 16:36:12 -0000	1.9
***************
*** 404,407 ****
--- 404,414 ----
  }
  
+ static cairo_int_status_t
+ _cairo_ps_surface_create_pattern (void *abstract_surface,
+                                   cairo_pattern_t *pattern,
+                                   cairo_box_t *extents)
+ {
+     return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
  
  static const cairo_surface_backend_t cairo_ps_surface_backend = {
***************
*** 419,422 ****
      _cairo_ps_surface_copy_page,
      _cairo_ps_surface_show_page,
!     _cairo_ps_surface_set_clip_region
  };
--- 426,430 ----
      _cairo_ps_surface_copy_page,
      _cairo_ps_surface_show_page,
!     _cairo_ps_surface_set_clip_region,
!     _cairo_ps_surface_create_pattern
  };

Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** a/cairo_surface.c	19 Mar 2004 23:47:25 -0000	1.24
--- b/cairo_surface.c	6 Apr 2004 16:36:12 -0000	1.25
***************
*** 378,379 ****
--- 378,487 ----
      return surface->backend->set_clip_region (surface, region);
  }
+ 
+ cairo_status_t
+ _cairo_surface_create_pattern (cairo_surface_t *surface,
+ 			       cairo_pattern_t *pattern,
+ 			       cairo_box_t *box)
+ {
+     cairo_int_status_t status;
+ 
+     status = surface->backend->create_pattern (surface, pattern, box);
+   
+     /* The backend cannot accelerate this pattern, lets create an
+        unaccelerated source instead. */
+     if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+ 
+ 	status = CAIRO_STATUS_SUCCESS;
+ 	switch (pattern->type) {
+ 	case CAIRO_PATTERN_LINEAR:
+ 	case CAIRO_PATTERN_RADIAL: {
+ 	    cairo_image_surface_t *image;
+       
+ 	    image = _cairo_pattern_get_image (pattern, box);
+ 	    if (image) {
+ 		pattern->source = &image->base;
+         
+ 		return CAIRO_STATUS_SUCCESS;
+ 	    } else
+ 		return CAIRO_STATUS_NO_MEMORY;
+       
+ 	} break;
+ 	case CAIRO_PATTERN_SOLID:
+ 	    pattern->source =
+ 		_cairo_surface_create_similar_solid (surface,
+ 						     CAIRO_FORMAT_ARGB32,
+ 						     1, 1,
+ 						     &pattern->color);
+ 	    if (pattern->source) {
+ 		cairo_surface_set_repeat (pattern->source, 1);
+         
+ 		return CAIRO_STATUS_SUCCESS;
+ 	    } else
+ 		return CAIRO_STATUS_NO_MEMORY;
+ 	    break;    
+ 	case CAIRO_PATTERN_SURFACE:
+ 	    status = CAIRO_INT_STATUS_UNSUPPORTED;
+ 
+ 	    /* handle pattern opacity */
+ 	    if (pattern->color.alpha != 1.0) {
+ 		int width = ceil (_cairo_fixed_to_double (box->p2.x) -
+ 				  _cairo_fixed_to_double (box->p1.x));
+ 		int height = ceil (_cairo_fixed_to_double (box->p2.y) -
+ 				   _cairo_fixed_to_double (box->p1.y));
+ 		cairo_pattern_t alpha;
+         
+ 		pattern->source =
+ 		    cairo_surface_create_similar (surface,
+ 						  CAIRO_FORMAT_ARGB32,
+ 						  width, height);
+ 		if (pattern->source) {
+ 		    _cairo_pattern_init_solid (&alpha, 1.0, 1.0, 1.0);
+ 		    _cairo_pattern_set_alpha (&alpha, pattern->color.alpha);
+           
+ 		    status = _cairo_surface_create_pattern (pattern->source,
+ 							    &alpha, box);
+           
+ 		    if (status == CAIRO_STATUS_SUCCESS) {
+ 			int save_repeat = pattern->u.surface.surface->repeat;
+ 
+ 			if (pattern->extend == CAIRO_EXTEND_REPEAT ||
+ 			    pattern->u.surface.surface->repeat == 1)
+ 			    cairo_surface_set_repeat (pattern->u.surface.surface, 1);
+ 			else
+ 			    cairo_surface_set_repeat (pattern->u.surface.surface, 0);
+ 			
+ 			status =
+ 			    _cairo_surface_composite (CAIRO_OPERATOR_OVER,
+ 						      pattern->u.surface.surface,
+ 						      alpha.source,
+ 						      pattern->source,
+ 						      0, 0, 0, 0, 0, 0,
+ 						      width, height);
+ 
+ 			cairo_surface_set_repeat (pattern->u.surface.surface,
+ 						  save_repeat);
+             
+ 			if (status == CAIRO_STATUS_SUCCESS) {
+ 			    _cairo_pattern_add_source_offset (pattern,
+ 							      _cairo_fixed_to_double (box->p1.x),
+ 							      _cairo_fixed_to_double (box->p1.y));
+ 			} else
+ 			    cairo_surface_destroy (pattern->source);
+ 		    }
+           
+ 		    _cairo_pattern_fini (&alpha);
+ 		}
+ 	    }
+ 
+ 	    if (status != CAIRO_STATUS_SUCCESS) {
+ 		pattern->source = pattern->u.surface.surface;
+ 		cairo_surface_reference (pattern->u.surface.surface);
+ 		
+ 		return CAIRO_STATUS_SUCCESS;
+ 	    }
+ 	    break;
+ 	}
+     }
+   
+     return status;
+ }

Index: cairo_traps.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_traps.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** a/cairo_traps.c	13 Feb 2004 03:02:33 -0000	1.14
--- b/cairo_traps.c	6 Apr 2004 16:36:12 -0000	1.15
***************
*** 609,610 ****
--- 609,647 ----
      return 0;
  }
+ 
+ #define MIN(a,b) ((a) < (b) ? (a) : (b))
+ #define MAX(a,b) ((a) > (b) ? (a) : (b))
+ 
+ static void
+ _cairo_trap_extents (cairo_trapezoid_t *t, cairo_box_t *extents)
+ {
+     cairo_fixed_t x;
+     
+     if (t->top < extents->p1.y)
+ 	extents->p1.y = t->top;
+     
+     if (t->bottom > extents->p2.y)
+ 	extents->p2.y = t->bottom;
+     
+     x = MIN (_compute_x (&t->left, t->top),
+ 	     _compute_x (&t->left, t->bottom));
+     if (x < extents->p1.x)
+ 	extents->p1.x = x;
+     
+     x = MAX (_compute_x (&t->right, t->top),
+ 	     _compute_x (&t->right, t->bottom));
+     if (x > extents->p2.x)
+ 	extents->p2.x = x;
+ }
+ 
+ void
+ _cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents)
+ {
+     int i;
+   
+     extents->p1.x = extents->p1.y = SHRT_MAX << 16;
+     extents->p2.x = extents->p2.y = SHRT_MIN << 16;
+     
+     for (i = 0; i < traps->num_traps; i++)
+ 	_cairo_trap_extents (&traps->traps[i], extents);
+ }

Index: cairo_xcb_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xcb_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/cairo_xcb_surface.c	23 Mar 2004 18:33:32 -0000	1.3
--- b/cairo_xcb_surface.c	6 Apr 2004 16:36:12 -0000	1.4
***************
*** 713,716 ****
--- 713,724 ----
  }
  
+ static cairo_int_status_t
+ _cairo_xcb_surface_create_pattern (void *abstract_surface,
+ 				   cairo_pattern_t *pattern,
+ 				   cairo_box_t *extents)
+ {
+     return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+ 
  static const struct cairo_surface_backend cairo_xcb_surface_backend = {
      _cairo_xcb_surface_create_similar,
***************
*** 727,731 ****
      _cairo_xcb_surface_copy_page,
      _cairo_xcb_surface_show_page,
!     _cairo_xcb_surface_set_clip_region
  };
  
--- 735,740 ----
      _cairo_xcb_surface_copy_page,
      _cairo_xcb_surface_show_page,
!     _cairo_xcb_surface_set_clip_region,
!     _cairo_xcb_surface_create_pattern
  };
  

Index: cairo_xlib_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xlib_surface.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** a/cairo_xlib_surface.c	31 Mar 2004 01:49:31 -0000	1.18
--- b/cairo_xlib_surface.c	6 Apr 2004 16:36:12 -0000	1.19
***************
*** 456,460 ****
      cairo_xlib_surface_t *src_clone = NULL;
      cairo_xlib_surface_t *mask_clone = NULL;
! 
  
      if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
--- 456,460 ----
      cairo_xlib_surface_t *src_clone = NULL;
      cairo_xlib_surface_t *mask_clone = NULL;
!     
  
      if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
***************
*** 620,623 ****
--- 620,631 ----
  }
  
+ static cairo_int_status_t
+ _cairo_xlib_surface_create_pattern (void *abstract_surface,
+ 				    cairo_pattern_t *pattern,
+ 				    cairo_box_t *extents)
+ {
+     return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+ 
  static const struct cairo_surface_backend cairo_xlib_surface_backend = {
      _cairo_xlib_surface_create_similar,
***************
*** 634,638 ****
      _cairo_xlib_surface_copy_page,
      _cairo_xlib_surface_show_page,
!     _cairo_xlib_surface_set_clip_region
  };
  
--- 642,647 ----
      _cairo_xlib_surface_copy_page,
      _cairo_xlib_surface_show_page,
!     _cairo_xlib_surface_set_clip_region,
!     _cairo_xlib_surface_create_pattern
  };
  
***************
*** 693,697 ****
      else
  	surface->picture = 0;
!     
      return (cairo_surface_t *) surface;
  }
--- 702,706 ----
      else
  	surface->picture = 0;
! 
      return (cairo_surface_t *) surface;
  }

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** a/cairoint.h	31 Mar 2004 01:49:31 -0000	1.54
--- b/cairoint.h	6 Apr 2004 16:36:12 -0000	1.55
***************
*** 136,143 ****
  } cairo_point_double_t;
  
  typedef struct cairo_line {
      cairo_point_t p1;
      cairo_point_t p2;
! } cairo_line_t;
  
  typedef struct cairo_trapezoid {
--- 136,148 ----
  } cairo_point_double_t;
  
+ typedef struct cairo_distance_double {
+     double dx;
+     double dy;
+ } cairo_distance_double_t;
+ 
  typedef struct cairo_line {
      cairo_point_t p1;
      cairo_point_t p2;
! } cairo_line_t, cairo_box_t;
  
  typedef struct cairo_trapezoid {
***************
*** 377,380 ****
--- 382,389 ----
      (*set_clip_region)		(void			*surface,
  				 pixman_region16_t	*region);
+     cairo_int_status_t
+     (*create_pattern)		(void			*surface,
+ 				 cairo_pattern_t	*pattern,
+ 				 cairo_box_t		*extents);
  } cairo_surface_backend_t;
  
***************
*** 434,437 ****
--- 443,499 ----
  };
  
+ #define CAIRO_EXTEND_DEFAULT CAIRO_EXTEND_NONE
+ #define CAIRO_FILTER_DEFAULT CAIRO_FILTER_NEAREST
+ 
+ typedef enum {
+     CAIRO_PATTERN_SOLID,
+     CAIRO_PATTERN_SURFACE,
+     CAIRO_PATTERN_LINEAR,
+     CAIRO_PATTERN_RADIAL
+ } cairo_pattern_type_t;
+ 
+ typedef struct cairo_color_stop {
+     double offset;
+     int id;
+     cairo_color_t color;
+     unsigned char color_char[4];
+ } cairo_color_stop_t;
+ 
+ struct cairo_pattern {
+     unsigned int ref_count;
+   
+     cairo_extend_t extend;
+     cairo_filter_t filter;
+     cairo_matrix_t matrix;
+   
+     cairo_color_stop_t *stops;
+     int n_stops;
+ 
+     cairo_color_t color;
+   
+     cairo_surface_t *source;
+     cairo_point_double_t source_offset;
+   
+     cairo_pattern_type_t type;
+     union {
+         struct {
+             cairo_surface_t *surface;
+             cairo_matrix_t save_matrix;
+             int save_repeat;
+             cairo_filter_t save_filter;
+         } surface;
+         struct {
+             cairo_point_double_t point0;
+             cairo_point_double_t point1;
+         } linear;
+         struct {
+             cairo_point_double_t center0;
+             cairo_point_double_t center1;
+             cairo_distance_double_t radius0;
+             cairo_distance_double_t radius1;
+         } radial;
+     } u;
+ };
+ 
  typedef struct cairo_traps {
      cairo_trapezoid_t *traps;
***************
*** 493,505 ****
      cairo_surface_t *surface;
  
!     cairo_surface_t *source;
!     cairo_point_double_t source_offset;
!     int source_is_solid;
  
      cairo_clip_rec_t clip;
  
-     double alpha;
-     cairo_color_t color;
- 
      double pixels_per_inch;
      cairo_matrix_t ctm;
--- 555,564 ----
      cairo_surface_t *surface;
  
!     cairo_pattern_t *pattern;
!     cairo_point_double_t pattern_offset;
!     double alpha;
  
      cairo_clip_rec_t clip;
  
      double pixels_per_inch;
      cairo_matrix_t ctm;
***************
*** 527,530 ****
--- 586,593 ----
  } cairo_stroke_face_t;
  
+ /* cairo.c */
+ extern void __internal_linkage
+ _cairo_restrict_value (double *value, double min, double max);
+ 
  /* cairo_fixed.c */
  extern cairo_fixed_t __internal_linkage
***************
*** 575,579 ****
  
  extern cairo_status_t __internal_linkage
! _cairo_gstate_set_pattern (cairo_gstate_t *gstate, cairo_surface_t *pattern);
  
  extern cairo_status_t __internal_linkage
--- 638,645 ----
  
  extern cairo_status_t __internal_linkage
! _cairo_gstate_set_pattern (cairo_gstate_t *gstate, cairo_pattern_t *pattern);
! 
! extern cairo_pattern_t *__internal_linkage
! _cairo_gstate_current_pattern (cairo_gstate_t *gstate);
  
  extern cairo_status_t __internal_linkage
***************
*** 746,749 ****
--- 812,825 ----
  
  extern cairo_status_t __internal_linkage
+ _cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
+                               double *x1, double *y1,
+ 			      double *x2, double *y2);
+ 
+ extern cairo_status_t __internal_linkage
+ _cairo_gstate_fill_extents (cairo_gstate_t *gstate,
+                             double *x1, double *y1,
+ 			    double *x2, double *y2);
+ 
+ extern cairo_status_t __internal_linkage
  _cairo_gstate_in_stroke (cairo_gstate_t	*gstate,
  			 double		x,
***************
*** 1043,1049 ****
  _cairo_surface_show_page (cairo_surface_t *surface);
  
- extern cairo_status_t __internal_linkage
- _cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region);
- 
  extern double __internal_linkage
  _cairo_surface_pixels_per_inch (cairo_surface_t *surface);
--- 1119,1122 ----
***************
*** 1056,1059 ****
--- 1129,1140 ----
  			  cairo_image_surface_t	*image);
  
+ extern cairo_status_t __internal_linkage
+ _cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region);
+ 
+ extern cairo_status_t __internal_linkage
+ _cairo_surface_create_pattern (cairo_surface_t *surface,
+ 			       cairo_pattern_t *pattern,
+ 			       cairo_box_t *extents);
+ 
  /* cairo_image_surface.c */
  
***************
*** 1210,1213 ****
--- 1291,1297 ----
  _cairo_traps_contain (cairo_traps_t *traps, double x, double y);
  
+ extern void __internal_linkage
+ _cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents);
+ 
  /* cairo_slope.c */
  extern void __internal_linkage
***************
*** 1223,1226 ****
--- 1307,1354 ----
  _cairo_slope_counter_clockwise (cairo_slope_t *a, cairo_slope_t *b);
  
+ /* cairo_pattern.c */
+ extern void __internal_linkage
+ _cairo_pattern_init (cairo_pattern_t *pattern);
+ 
+ extern cairo_status_t __internal_linkage
+ _cairo_pattern_init_copy (cairo_pattern_t *pattern, cairo_pattern_t *other);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_fini (cairo_pattern_t *pattern);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_init_solid (cairo_pattern_t *pattern,
+ 			   double red, double green, double blue);
+ 
+ extern cairo_pattern_t *__internal_linkage
+ _cairo_pattern_create_solid (double red, double green, double blue);
+ 
+ extern cairo_status_t __internal_linkage
+ _cairo_pattern_get_rgb (cairo_pattern_t *pattern,
+ 			double *red, double *green, double *blue);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_set_alpha (cairo_pattern_t *pattern, double alpha);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_add_source_offset (cairo_pattern_t *pattern,
+ 				  double x, double y);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_transform (cairo_pattern_t *pattern,
+ 			  cairo_matrix_t *matrix,
+ 			  cairo_matrix_t *matrix_inverse);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_prepare_surface (cairo_pattern_t *pattern);
+ 
+ extern void __internal_linkage
+ _cairo_pattern_calc_color_at_pixel (cairo_pattern_t *pattern,
+ 				    double factor,
+ 				    int *pixel);
+ 
+ extern cairo_image_surface_t *__internal_linkage
+ _cairo_pattern_get_image (cairo_pattern_t *pattern, cairo_box_t *box);
+ 
  /* Avoid unnecessary PLT entries.  */
  





More information about the cairo-commit mailing list