diff options
author | Carl Worth <cworth@cworth.org> | 2005-04-04 06:49:19 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-04-04 06:49:19 +0000 |
commit | 027057bf62fe0df78261af338f6d2f190433792b (patch) | |
tree | 42ee2293855e34bc4388d2b5173eaae73b6c45c7 /src | |
parent | 5778c77382f3a81b77aca1d224d0ad7626bcd5d2 (diff) |
Drop cairo_default_matrix since it is now always identical to cairo_identity_matrix.
Remove gstate->pixels_per inch. Change default matrix to always be the identity matrix.
Drop pixels_per_inch function from surface backend interface as it is no longer needed.
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-glitz-surface.c | 7 | ||||
-rw-r--r-- | src/cairo-gstate-private.h | 2 | ||||
-rw-r--r-- | src/cairo-gstate.c | 28 | ||||
-rw-r--r-- | src/cairo-image-surface.c | 8 | ||||
-rw-r--r-- | src/cairo-pdf-surface.c | 10 | ||||
-rw-r--r-- | src/cairo-ps-surface.c | 10 | ||||
-rw-r--r-- | src/cairo-quartz-surface.c | 9 | ||||
-rw-r--r-- | src/cairo-surface.c | 6 | ||||
-rw-r--r-- | src/cairo-win32-surface.c | 8 | ||||
-rw-r--r-- | src/cairo-xcb-surface.c | 8 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 8 | ||||
-rw-r--r-- | src/cairo.c | 30 | ||||
-rw-r--r-- | src/cairo.h | 7 | ||||
-rw-r--r-- | src/cairoint.h | 10 |
14 files changed, 22 insertions, 129 deletions
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 95b7313b..ce2a8edc 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -97,12 +97,6 @@ _cairo_glitz_surface_create_similar (void *abstract_src, return crsurface; } -static double -_cairo_glitz_surface_pixels_per_inch (void *abstract_surface) -{ - return 96.0; -} - static cairo_status_t _cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface, cairo_rectangle_t *interest, @@ -1260,7 +1254,6 @@ _cairo_glitz_surface_set_clip_region (void *abstract_surface, static const cairo_surface_backend_t cairo_glitz_surface_backend = { _cairo_glitz_surface_create_similar, _cairo_glitz_surface_finish, - _cairo_glitz_surface_pixels_per_inch, _cairo_glitz_surface_acquire_source_image, _cairo_glitz_surface_release_source_image, _cairo_glitz_surface_acquire_dest_image, diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h index 4faf1de6..56c9b119 100644 --- a/src/cairo-gstate-private.h +++ b/src/cairo-gstate-private.h @@ -68,8 +68,6 @@ struct _cairo_gstate { cairo_clip_rec_t clip; - double pixels_per_inch; - cairo_matrix_t font_matrix; cairo_matrix_t ctm; diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index e794fb4a..2c0b6a46 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -109,8 +109,7 @@ _cairo_gstate_init (cairo_gstate_t *gstate) gstate->alpha = 1.0; - gstate->pixels_per_inch = CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT; - _cairo_gstate_default_matrix (gstate); + _cairo_gstate_identity_matrix (gstate); _cairo_path_fixed_init (&gstate->path); @@ -360,8 +359,6 @@ _cairo_gstate_end_group (cairo_gstate_t *gstate) cairo_status_t _cairo_gstate_set_target_surface (cairo_gstate_t *gstate, cairo_surface_t *surface) { - double scale; - _cairo_gstate_unset_font (gstate); if (gstate->surface) @@ -377,9 +374,7 @@ _cairo_gstate_set_target_surface (cairo_gstate_t *gstate, cairo_surface_t *surfa 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); + _cairo_gstate_identity_matrix (gstate); return CAIRO_STATUS_SUCCESS; } @@ -671,25 +666,6 @@ _cairo_gstate_set_matrix (cairo_gstate_t *gstate, } cairo_status_t -_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; - - _cairo_gstate_unset_font (gstate); - - cairo_matrix_set_identity (&gstate->font_matrix); - - cairo_matrix_set_identity (&gstate->ctm); - cairo_matrix_scale (&gstate->ctm, scale, scale); - cairo_matrix_copy (&gstate->ctm_inverse, &gstate->ctm); - cairo_matrix_invert (&gstate->ctm_inverse); - - return CAIRO_STATUS_SUCCESS; -} - -cairo_status_t _cairo_gstate_identity_matrix (cairo_gstate_t *gstate) { _cairo_gstate_unset_font (gstate); diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 24122eec..c0bfc3e2 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -257,13 +257,6 @@ _cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface) surface->owns_data = 1; } -static double -_cairo_image_surface_pixels_per_inch (void *abstract_surface) -{ - /* XXX: We'll want a way to let the user set this. */ - return 96.0; -} - static cairo_status_t _cairo_image_surface_acquire_source_image (void *abstract_surface, cairo_image_surface_t **image_out, @@ -660,7 +653,6 @@ _cairo_surface_is_image (cairo_surface_t *surface) static const cairo_surface_backend_t cairo_image_surface_backend = { _cairo_image_surface_create_similar, _cairo_image_abstract_surface_finish, - _cairo_image_surface_pixels_per_inch, _cairo_image_surface_acquire_source_image, _cairo_image_surface_release_source_image, _cairo_image_surface_acquire_dest_image, diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 39e14d30..9d1995ca 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -1114,15 +1114,6 @@ _cairo_pdf_surface_finish (void *abstract_surface) return status; } -/* XXX: We should re-work this interface to return both X/Y ppi values. */ -static double -_cairo_pdf_surface_pixels_per_inch (void *abstract_surface) -{ - cairo_pdf_surface_t *surface = abstract_surface; - - return surface->document->y_ppi; -} - static void _cairo_pdf_surface_ensure_stream (cairo_pdf_surface_t *surface) { @@ -1856,7 +1847,6 @@ _cairo_pdf_surface_show_glyphs (cairo_font_t *font, static const cairo_surface_backend_t cairo_pdf_surface_backend = { _cairo_pdf_surface_create_similar, _cairo_pdf_surface_finish, - _cairo_pdf_surface_pixels_per_inch, _cairo_pdf_surface_acquire_source_image, _cairo_pdf_surface_release_source_image, _cairo_pdf_surface_acquire_dest_image, diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index ea23ad16..3e718499 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -159,15 +159,6 @@ _cairo_ps_surface_erase (cairo_ps_surface_t *surface) surface->image->height); } -/* XXX: We should re-work this interface to return both X/Y ppi values. */ -static double -_cairo_ps_surface_pixels_per_inch (void *abstract_surface) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return surface->y_ppi; -} - static cairo_status_t _cairo_ps_surface_acquire_source_image (void *abstract_surface, cairo_image_surface_t **image_out, @@ -387,7 +378,6 @@ _cairo_ps_surface_set_clip_region (void *abstract_surface, static const cairo_surface_backend_t cairo_ps_surface_backend = { _cairo_ps_surface_create_similar, _cairo_ps_surface_finish, - _cairo_ps_surface_pixels_per_inch, _cairo_ps_surface_acquire_source_image, _cairo_ps_surface_release_source_image, _cairo_ps_surface_acquire_dest_image, diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index 50e860b8..614c60f5 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -106,14 +106,6 @@ static void _cairo_quartz_surface_finish(void *abstract_surface) CGImageRelease(surface->cgImage); } - -static double _cairo_quartz_surface_pixels_per_inch(void *abstract_surface) -{ - // TODO - get this from CGDirectDisplay somehow? - return 96.0; -} - - static cairo_status_t _cairo_quartz_surface_acquire_source_image(void *abstract_surface, cairo_image_surface_t **image_out, @@ -326,7 +318,6 @@ _cairo_quartz_surface_show_glyphs(cairo_font_t * font, static const struct _cairo_surface_backend cairo_quartz_surface_backend = { _cairo_quartz_surface_create_similar, _cairo_quartz_surface_finish, - _cairo_quartz_surface_pixels_per_inch, _cairo_quartz_surface_acquire_source_image, _cairo_quartz_surface_release_source_image, _cairo_quartz_surface_acquire_dest_image, diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 213852d1..6939c279 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -309,12 +309,6 @@ cairo_surface_set_device_offset (cairo_surface_t *surface, surface->device_y_offset = y_offset; } -double -_cairo_surface_pixels_per_inch (cairo_surface_t *surface) -{ - return surface->backend->pixels_per_inch (surface); -} - /** * _cairo_surface_acquire_source_image: * @surface: a #cairo_surface_t diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index ca5c0205..08c130d7 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -345,13 +345,6 @@ _cairo_win32_surface_finish (void *abstract_surface) return CAIRO_STATUS_SUCCESS; } -static double -_cairo_win32_surface_pixels_per_inch (void *abstract_surface) -{ - /* XXX: We should really get this value from somewhere */ - return 96.0; -} - static cairo_status_t _cairo_win32_surface_get_subimage (cairo_win32_surface_t *surface, int x, @@ -894,7 +887,6 @@ _cairo_surface_is_win32 (cairo_surface_t *surface) static const cairo_surface_backend_t cairo_win32_surface_backend = { _cairo_win32_surface_create_similar, _cairo_win32_surface_finish, - _cairo_win32_surface_pixels_per_inch, _cairo_win32_surface_acquire_source_image, _cairo_win32_surface_release_source_image, _cairo_win32_surface_acquire_dest_image, diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index a8ed28b4..06d86c4d 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -263,13 +263,6 @@ _cairo_xcb_surface_finish (void *abstract_surface) surface->dpy = 0; } -static double -_cairo_xcb_surface_pixels_per_inch (void *abstract_surface) -{ - /* XXX: We should really get this value from somewhere like Xft.dpy */ - return 96.0; -} - static int bits_per_pixel(XCBConnection *c, int depth) { @@ -870,7 +863,6 @@ _cairo_xcb_surface_set_clip_region (void *abstract_surface, static const cairo_surface_backend_t cairo_xcb_surface_backend = { _cairo_xcb_surface_create_similar, _cairo_xcb_surface_finish, - _cairo_xcb_surface_pixels_per_inch, _cairo_xcb_surface_acquire_source_image, _cairo_xcb_surface_release_source_image, _cairo_xcb_surface_acquire_dest_image, diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index ea810818..e1508002 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -159,13 +159,6 @@ _cairo_xlib_surface_finish (void *abstract_surface) return CAIRO_STATUS_SUCCESS; } -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 cairo_status_t _get_image_surface (cairo_xlib_surface_t *surface, cairo_rectangle_t *interest_rect, @@ -871,7 +864,6 @@ _cairo_xlib_surface_show_glyphs (cairo_font_t *font, static const cairo_surface_backend_t cairo_xlib_surface_backend = { _cairo_xlib_surface_create_similar, _cairo_xlib_surface_finish, - _cairo_xlib_surface_pixels_per_inch, _cairo_xlib_surface_acquire_source_image, _cairo_xlib_surface_release_source_image, _cairo_xlib_surface_acquire_dest_image, diff --git a/src/cairo.c b/src/cairo.c index 142e6b27..1f41e8cc 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -992,6 +992,14 @@ cairo_transform (cairo_t *cr, cairo_matrix_t *matrix) } DEPRECATE(cairo_concat_matrix, cairo_transform); +/** + * cairo_set_matrix: + * @cr: a cairo context + * @matrix: a transformation matrix from user space to device space + * + * Modifies the current transformation matrix (CTM) by setting it + * equal to @matrix. + **/ void cairo_set_matrix (cairo_t *cr, cairo_matrix_t *matrix) @@ -1004,17 +1012,15 @@ cairo_set_matrix (cairo_t *cr, CAIRO_CHECK_SANITY (cr); } -void -cairo_default_matrix (cairo_t *cr) -{ - CAIRO_CHECK_SANITY (cr); - if (cr->status) - return; - - cr->status = _cairo_gstate_default_matrix (cr->gstate); - CAIRO_CHECK_SANITY (cr); -} - +/** + * cairo_identity_matrix: + * @cr: a cairo context + * + * Resets the current transformation matrix (CTM) by setting it equal + * to the identity matrix. That is, the user-space and device-space + * axes will be aligned and one user-space unit will transform to one + * device-space unit. + **/ void cairo_identity_matrix (cairo_t *cr) { @@ -1025,7 +1031,7 @@ cairo_identity_matrix (cairo_t *cr) cr->status = _cairo_gstate_identity_matrix (cr->gstate); CAIRO_CHECK_SANITY (cr); } - +DEPRECATE(cairo_default_matrix, cairo_identity_matrix); /** * cairo_user_to_device: diff --git a/src/cairo.h b/src/cairo.h index 876699c6..7cd4de77 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -327,11 +327,6 @@ cairo_set_matrix (cairo_t *cr, cairo_matrix_t *matrix); void -cairo_default_matrix (cairo_t *cr); - -/* XXX: There's been a proposal to add cairo_default_matrix_exact */ - -void cairo_identity_matrix (cairo_t *cr); void @@ -1072,6 +1067,7 @@ typedef cairo_status_t (*cairo_write_func_t) (void *closure, #define cairo_inverse_transform_distance cairo_inverse_transform_distance_DEPRECATED_BY_cairo_device_to_user_distance #define cairo_init_clip cairo_init_clip_DEPRECATED_BY_cairo_reset_clip #define cairo_surface_create_for_image cairo_surface_create_for_image_DEPRECATED_BY_cairo_image_surface_create_for_data +#define cairo_default_matrix cairo_default_matrix_DEPRECATED_BY_cairo_identity_matrix #else /* CAIRO_API_SHAKEUP_FLAG_DAY */ @@ -1100,6 +1096,7 @@ typedef cairo_status_t (*cairo_write_func_t) (void *closure, #define cairo_inverse_transform_distance cairo_device_to_user_distance #define cairo_init_clip cairo_reset_clip #define cairo_surface_create_for_image cairo_image_surface_create_for_data +#define cairo_default_matrix cairo_identity_matrix #endif /* CAIRO_API_SHAKEUP_FLAG_DAY */ diff --git a/src/cairoint.h b/src/cairoint.h index 515fca38..9e024244 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -536,9 +536,6 @@ typedef struct _cairo_surface_backend { cairo_status_t (*finish) (void *surface); - double - (*pixels_per_inch) (void *surface); - cairo_status_t (* acquire_source_image) (void *abstract_surface, cairo_image_surface_t **image_out, @@ -812,7 +809,6 @@ typedef struct _cairo_traps { #define CAIRO_GSTATE_LINE_CAP_DEFAULT CAIRO_LINE_CAP_BUTT #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 */ typedef struct _cairo_clip_rec { @@ -981,9 +977,6 @@ _cairo_gstate_set_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix); cairo_private cairo_status_t -_cairo_gstate_default_matrix (cairo_gstate_t *gstate); - -cairo_private cairo_status_t _cairo_gstate_identity_matrix (cairo_gstate_t *gstate); cairo_private cairo_status_t @@ -1420,9 +1413,6 @@ _cairo_surface_copy_page (cairo_surface_t *surface); cairo_private cairo_status_t _cairo_surface_show_page (cairo_surface_t *surface); -cairo_private double -_cairo_surface_pixels_per_inch (cairo_surface_t *surface); - cairo_private cairo_status_t _cairo_surface_acquire_source_image (cairo_surface_t *surface, cairo_image_surface_t **image_out, |