[cairo-commit] cairo/src cairo_gstate.c,1.23,1.24 cairo_surface.c,1.17,1.18 cairo_xlib_surface.c,1.6,1.7 cairoint.h,1.33,1.34

Carl Worth commit at pdx.freedesktop.org
Tue Oct 28 12:18:31 PST 2003


Committed by: cworth

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

Modified Files:
	cairo_gstate.c cairo_surface.c cairo_xlib_surface.c cairoint.h 
Log Message:
Rename gstate->ppm to gstate->pixels_per_inch.
Add new pixels_per_inch to the surface backend.

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** cairo_gstate.c	28 Oct 2003 20:15:03 -0000	1.23
--- cairo_gstate.c	28 Oct 2003 20:18:29 -0000	1.24
***************
*** 90,95 ****
      _cairo_color_init (&gstate->color);
  
!     /* 3780 PPM (~96DPI) is a good enough assumption until we get a surface */
!     gstate->ppm = 3780;
      _cairo_gstate_default_matrix (gstate);
  
--- 90,94 ----
      _cairo_color_init (&gstate->color);
  
!     gstate->pixels_per_inch = CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT;
      _cairo_gstate_default_matrix (gstate);
  
***************
*** 323,329 ****
      cairo_surface_reference (gstate->surface);
  
!     scale = surface->ppm / gstate->ppm;
      _cairo_gstate_scale (gstate, scale, scale);
!     gstate->ppm = surface->ppm;
  
      return CAIRO_STATUS_SUCCESS;
--- 322,328 ----
      cairo_surface_reference (gstate->surface);
  
!     scale = _cairo_surface_pixels_per_inch (surface) / gstate->pixels_per_inch;
      _cairo_gstate_scale (gstate, scale, scale);
!     gstate->pixels_per_inch = _cairo_surface_pixels_per_inch (surface);
  
      return CAIRO_STATUS_SUCCESS;
***************
*** 610,616 ****
  _cairo_gstate_default_matrix (cairo_gstate_t *gstate)
  {
! #define CAIRO_GSTATE_DEFAULT_PPM 3780.0
! 
!     int scale = gstate->ppm / CAIRO_GSTATE_DEFAULT_PPM + 0.5;
      if (scale == 0)
  	scale = 1;
--- 609,613 ----
  _cairo_gstate_default_matrix (cairo_gstate_t *gstate)
  {
!     int scale = gstate->pixels_per_inch / CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT + 0.5;
      if (scale == 0)
  	scale = 1;

Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** cairo_surface.c	28 Oct 2003 20:15:03 -0000	1.17
--- cairo_surface.c	28 Oct 2003 20:18:29 -0000	1.18
***************
*** 71,77 ****
      surface->image_data = NULL;
  
-     /* XXX: We should really get this value from somewhere like Xft.dpy */
-     /* Assume a default until the user lets us know otherwise */
-     surface->ppm = 3780;
      surface->ref_count = 1;
      surface->repeat = 0;
--- 71,74 ----
***************
*** 216,219 ****
--- 213,225 ----
  slim_hidden_def(cairo_surface_destroy);
  
+ #define CAIRO_SURFACE_PIXELS_PER_INCH_DEFAULT 96.0
+ double
+ _cairo_surface_pixels_per_inch (cairo_surface_t *surface)
+ {
+     if (surface->backend->pixels_per_inch)
+ 	return surface->backend->pixels_per_inch (surface);
+ 
+     return CAIRO_SURFACE_PIXELS_PER_INCH_DEFAULT;
+ }
  void
  _cairo_surface_pull_image (cairo_surface_t *surface)

Index: cairo_xlib_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xlib_surface.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** cairo_xlib_surface.c	28 Oct 2003 02:40:55 -0000	1.6
--- cairo_xlib_surface.c	28 Oct 2003 20:18:29 -0000	1.7
***************
*** 153,156 ****
--- 153,163 ----
  }
  
+ static double
+ _cairo_xlib_surface_pixels_per_inch (void *abstract_surface)
+ {
+     /* XXX: We should really get this value from somewhere like Xft.dpy */
+     return 96.0;
+ }
+ 
  static void
  _cairo_xlib_surface_pull_image (void *abstract_surface)
***************
*** 469,472 ****
--- 476,480 ----
      _cairo_xlib_surface_create_similar,
      _cairo_xlib_surface_destroy,
+     _cairo_xlib_surface_pixels_per_inch,
      _cairo_xlib_surface_pull_image,
      _cairo_xlib_surface_push_image,

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** cairoint.h	28 Oct 2003 20:15:03 -0000	1.33
--- cairoint.h	28 Oct 2003 20:18:29 -0000	1.34
***************
*** 293,296 ****
--- 293,299 ----
      (*destroy)			(void			*surface);
  
+     double
+     (*pixels_per_inch)		(void			*surface);
+ 
      void
      (*pull_image)		(void			*surface);
***************
*** 349,353 ****
      char *image_data;
  
-     double ppm;
      unsigned int ref_count;
      int repeat;
--- 352,355 ----
***************
*** 412,415 ****
--- 414,418 ----
  #define CAIRO_GSTATE_LINE_JOIN_DEFAULT	CAIRO_LINE_JOIN_MITER
  #define CAIRO_GSTATE_MITER_LIMIT_DEFAULT	10.0
+ #define CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT	96.0
  
  /* Need a name distinct from the cairo_clip function */
***************
*** 452,456 ****
      cairo_color_t color;
  
!     double ppm;
      cairo_matrix_t ctm;
      cairo_matrix_t ctm_inverse;
--- 455,459 ----
      cairo_color_t color;
  
!     double pixels_per_inch;
      cairo_matrix_t ctm;
      cairo_matrix_t ctm_inverse;
***************
*** 944,947 ****
--- 947,953 ----
  				     int		ntraps);
  
+ extern double __internal_linkage
+ _cairo_surface_pixels_per_inch (cairo_surface_t *surface);
+ 
  extern void __internal_linkage
  _cairo_surface_pull_image (cairo_surface_t *surface);





More information about the cairo-commit mailing list