[cairo-commit] cairo/src cairo.h,1.21,1.22 cairo_gstate.c,1.22,1.23 cairo_surface.c,1.16,1.17 cairoint.h,1.32,1.33

Carl Worth commit at pdx.freedesktop.org
Tue Oct 28 12:15:05 PST 2003


Committed by: cworth

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

Modified Files:
	cairo.h cairo_gstate.c cairo_surface.c cairoint.h 
Log Message:
Drop cairo_surface_create_similar_solid

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** cairo.h	24 Oct 2003 18:01:37 -0000	1.21
--- cairo.h	28 Oct 2003 20:15:03 -0000	1.22
***************
*** 539,556 ****
  			      int		height);
  
- /* XXX: One problem with having RGB and A here in one function is that
-    it introduces the question of pre-multiplied vs. non-pre-multiplied
-    alpha. Do I want to export a cairo_color_t structure instead? So far, no
-    other public functions need it. */
- extern cairo_surface_t * __external_linkage
- cairo_surface_create_similar_solid (cairo_surface_t	*other,
- 				    cairo_format_t	format,
- 				    int		width,
- 				    int		height,
- 				    double	red,
- 				    double	green,
- 				    double	blue,
- 				    double	alpha);
- 
  extern void __external_linkage
  cairo_surface_reference (cairo_surface_t *surface);
--- 539,542 ----

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** cairo_gstate.c	24 Oct 2003 17:01:34 -0000	1.22
--- cairo_gstate.c	28 Oct 2003 20:15:03 -0000	1.23
***************
*** 1117,1127 ****
  	return CAIRO_STATUS_NO_TARGET_SURFACE;
  
!     gstate->source = cairo_surface_create_similar_solid (gstate->surface,
! 							 CAIRO_FORMAT_ARGB32,
! 							 1, 1,
! 							 gstate->color.red,
! 							 gstate->color.green,
! 							 gstate->color.blue,
! 							 gstate->color.alpha);
      if (gstate->source == NULL)
  	return CAIRO_STATUS_NO_MEMORY;
--- 1117,1124 ----
  	return CAIRO_STATUS_NO_TARGET_SURFACE;
  
!     gstate->source = _cairo_surface_create_similar_solid (gstate->surface,
! 							  CAIRO_FORMAT_ARGB32,
! 							  1, 1,
! 							  &gstate->color);
      if (gstate->source == NULL)
  	return CAIRO_STATUS_NO_MEMORY;
***************
*** 1192,1207 ****
  	int i;
  
! 	cairo_surface_t *intermediate, *white;
  
! 	white = cairo_surface_create_similar_solid (gstate->surface, CAIRO_FORMAT_A8,
! 						    1, 1,
! 						    1.0, 1.0, 1.0, 1.0);
  	cairo_surface_set_repeat (white, 1);
  
! 	intermediate = cairo_surface_create_similar_solid (gstate->clip.surface,
! 							   CAIRO_FORMAT_A8,
! 							   gstate->clip.width,
! 							   gstate->clip.height,
! 							   0.0, 0.0, 0.0, 0.0);
  
  	/* Ugh. The cairo_composite/(Render) interface doesn't allow
--- 1189,1208 ----
  	int i;
  
! 	cairo_surface_t *white, *intermediate;
! 	cairo_color_t white_color, empty_color;
  
! 	_cairo_color_init (&white_color);
! 	white = _cairo_surface_create_similar_solid (gstate->surface, CAIRO_FORMAT_A8,
! 						     1, 1,
! 						     &white_color);
  	cairo_surface_set_repeat (white, 1);
  
! 	_cairo_color_init (&empty_color);
! 	_cairo_color_set_alpha (&empty_color, 0.);
! 	intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface,
! 							    CAIRO_FORMAT_A8,
! 							    gstate->clip.width,
! 							    gstate->clip.height,
! 							    &empty_color);
  
  	/* Ugh. The cairo_composite/(Render) interface doesn't allow
***************
*** 1316,1319 ****
--- 1317,1323 ----
      cairo_surface_t *alpha_one;
      cairo_traps_t traps;
+     cairo_color_t white_color;
+ 
+     _cairo_color_init (&white_color);
  
      if (gstate->clip.surface == NULL) {
***************
*** 1325,1338 ****
  	gstate->clip.width = ceil (x2 - gstate->clip.x);
  	gstate->clip.height = ceil (y2 - gstate->clip.y);
! 	gstate->clip.surface = cairo_surface_create_similar_solid (gstate->surface,
! 								   CAIRO_FORMAT_A8,
! 								   gstate->clip.width,
! 								   gstate->clip.height,
! 								   1.0, 1.0, 1.0, 1.0);
      }
  
!     alpha_one = cairo_surface_create_similar_solid (gstate->surface, CAIRO_FORMAT_A8,
! 						    1, 1,
! 						    0.0, 0.0, 0.0, 1.0);
      cairo_surface_set_repeat (alpha_one, 1);
  
--- 1329,1342 ----
  	gstate->clip.width = ceil (x2 - gstate->clip.x);
  	gstate->clip.height = ceil (y2 - gstate->clip.y);
! 	gstate->clip.surface = _cairo_surface_create_similar_solid (gstate->surface,
! 								    CAIRO_FORMAT_A8,
! 								    gstate->clip.width,
! 								    gstate->clip.height,
! 								    &white_color);
      }
  
!     alpha_one = _cairo_surface_create_similar_solid (gstate->surface, CAIRO_FORMAT_A8,
! 						     1, 1,
! 						     &white_color);
      cairo_surface_set_repeat (alpha_one, 1);
  
***************
*** 1368,1378 ****
      double device_x, device_y;
      double device_width, device_height;
  
      if (gstate->alpha != 1.0) {
! 	mask = cairo_surface_create_similar_solid (gstate->surface,
! 						   CAIRO_FORMAT_A8,
! 						   1, 1,
! 						   1.0, 1.0, 1.0,
! 						   gstate->alpha);
  	if (mask == NULL)
  	    return CAIRO_STATUS_NO_MEMORY;
--- 1372,1384 ----
      double device_x, device_y;
      double device_width, device_height;
+     cairo_color_t alpha_color;
  
      if (gstate->alpha != 1.0) {
! 	_cairo_color_init (&alpha_color);
! 	_cairo_color_set_alpha (&alpha_color, gstate->alpha);
! 	mask = _cairo_surface_create_similar_solid (gstate->surface,
! 						    CAIRO_FORMAT_A8,
! 						    1, 1,
! 						    &alpha_color);
  	if (mask == NULL)
  	    return CAIRO_STATUS_NO_MEMORY;

Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** cairo_surface.c	28 Oct 2003 20:13:35 -0000	1.16
--- cairo_surface.c	28 Oct 2003 20:15:03 -0000	1.17
***************
*** 140,163 ****
  			      int		height)
  {
!     return cairo_surface_create_similar_solid (other, format, width, height, 0, 0, 0, 0);
  }
  
  cairo_surface_t *
! cairo_surface_create_similar_solid (cairo_surface_t	*other,
! 				    cairo_format_t	format,
! 				    int			width,
! 				    int			height,
! 				    double		red,
! 				    double		green,
! 				    double		blue,
! 				    double		alpha)
  {
      cairo_surface_t *surface = NULL;
-     cairo_color_t color;
  
      if (other->backend->create_similar)
  	surface = other->backend->create_similar (other, format, width, height);
! 
!     if (!surface) {
  	char *data;
  	int stride;
--- 140,164 ----
  			      int		height)
  {
!     cairo_color_t empty;
! 
!     _cairo_color_init (&empty);
!     _cairo_color_set_rgb (&empty, 0., 0., 0.);
!     _cairo_color_set_alpha (&empty, 0.);
! 
!     return _cairo_surface_create_similar_solid (other, format, width, height, &empty);
  }
  
  cairo_surface_t *
! _cairo_surface_create_similar_solid (cairo_surface_t	*other,
! 				     cairo_format_t	format,
! 				     int		width,
! 				     int		height,
! 				     cairo_color_t	*color)
  {
      cairo_surface_t *surface = NULL;
  
      if (other->backend->create_similar)
  	surface = other->backend->create_similar (other, format, width, height);
!     if (surface == NULL) {
  	char *data;
  	int stride;
***************
*** 175,188 ****
      }
  
!     /* XXX: Initializing the color in this way assumes
!        non-pre-multiplied alpha. I'm not sure that that's what I want
!        to do or not. */
!     _cairo_color_init (&color);
!     _cairo_color_set_rgb (&color, red, green, blue);
!     _cairo_color_set_alpha (&color, alpha);
!     _cairo_surface_fill_rectangle (surface, CAIRO_OPERATOR_SRC, &color, 0, 0, width, height);
      return surface;
  }
- slim_hidden_def(cairo_surface_create_similar_solid);
  
  void
--- 176,182 ----
      }
  
!     _cairo_surface_fill_rectangle (surface, CAIRO_OPERATOR_SRC, color, 0, 0, width, height);
      return surface;
  }
  
  void

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** cairoint.h	28 Oct 2003 02:40:55 -0000	1.32
--- cairoint.h	28 Oct 2003 20:15:03 -0000	1.33
***************
*** 891,894 ****
--- 891,901 ----
  
  /* cairo_surface.c */
+ extern cairo_surface_t * __internal_linkage
+ _cairo_surface_create_similar_solid (cairo_surface_t	*other,
+ 				     cairo_format_t	format,
+ 				     int		width,
+ 				     int		height,
+ 				     cairo_color_t	*color);
+ 
  extern void __internal_linkage
  _cairo_surface_init (cairo_surface_t			*surface,
***************
*** 1091,1095 ****
  slim_hidden_proto(cairo_set_target_surface)
  slim_hidden_proto(cairo_surface_create_for_image)
- slim_hidden_proto(cairo_surface_create_similar_solid)
  slim_hidden_proto(cairo_surface_destroy)
  slim_hidden_proto(cairo_surface_get_matrix)
--- 1098,1101 ----





More information about the cairo-commit mailing list