[cairo-commit] 2 commits - src/cairo.c src/cairo-gstate.c src/cairo-gstate-private.h src/cairo-quartz-font.c
Andrea Canciani
ranma42 at kemper.freedesktop.org
Fri Mar 18 05:07:31 PDT 2011
src/cairo-gstate-private.h | 4 ----
src/cairo-gstate.c | 11 -----------
src/cairo-quartz-font.c | 12 ------------
src/cairo.c | 9 +++------
4 files changed, 3 insertions(+), 33 deletions(-)
New commits:
commit 8a4299bf7ee3173cf956ef481bf08e5f99808272
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Feb 4 22:48:30 2011 +0100
quartz-font: Remove unused variables
x_scale and y_scale are computed but never used.
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index 75dda02..f529fc9 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -407,7 +407,6 @@ _cairo_quartz_init_glyph_metrics (cairo_quartz_scaled_font_t *font,
int advance;
CGRect bbox;
double emscale = CGFontGetUnitsPerEmPtr (font_face->cgFont);
- double xscale, yscale;
double xmin, ymin, xmax, ymax;
if (glyph == INVALID_GLYPH)
@@ -427,11 +426,6 @@ _cairo_quartz_init_glyph_metrics (cairo_quartz_scaled_font_t *font,
bbox.size.width = bbox.size.height = 0;
}
- status = _cairo_matrix_compute_basis_scale_factors (&font->base.scale,
- &xscale, &yscale, 1);
- if (status)
- goto FAIL;
-
bbox = CGRectMake (bbox.origin.x / emscale,
bbox.origin.y / emscale,
bbox.size.width / emscale,
@@ -595,7 +589,6 @@ _cairo_quartz_init_glyph_surface (cairo_quartz_scaled_font_t *font,
int advance;
CGRect bbox;
double width, height;
- double xscale, yscale;
double emscale = CGFontGetUnitsPerEmPtr (font_face->cgFont);
CGContextRef cgContext = NULL;
@@ -627,11 +620,6 @@ _cairo_quartz_init_glyph_surface (cairo_quartz_scaled_font_t *font,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
- status = _cairo_matrix_compute_basis_scale_factors (&font->base.scale,
- &xscale, &yscale, 1);
- if (status)
- return status;
-
/* scale(1,-1) * font->base.scale * scale(1,-1) */
textMatrix = CGAffineTransformMake (font->base.scale.xx,
-font->base.scale.yx,
commit fd1fca8010cc91e12a852f224e672de2d60e16b7
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Sat Feb 5 10:43:04 2011 +0100
Make cairo_set_font_size() a wrapper of cairo_set_font_matrix()
cairo_set_font_size() should be equivalent to setting the font matrix
to an appropriate scale matrix.
Implementing it this way saves some code and makes sure that the same
code path is used whenever the font matrix is changed.
diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h
index cd417ec..293953b 100644
--- a/src/cairo-gstate-private.h
+++ b/src/cairo-gstate-private.h
@@ -302,10 +302,6 @@ _cairo_gstate_select_font_face (cairo_gstate_t *gstate,
cairo_font_slant_t slant,
cairo_font_weight_t weight);
-cairo_private cairo_status_t
-_cairo_gstate_set_font_size (cairo_gstate_t *gstate,
- double size);
-
cairo_private void
_cairo_gstate_get_font_matrix (cairo_gstate_t *gstate,
cairo_matrix_t *matrix);
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index c604482..eaf7a56 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1605,17 +1605,6 @@ _cairo_gstate_select_font_face (cairo_gstate_t *gstate,
}
cairo_status_t
-_cairo_gstate_set_font_size (cairo_gstate_t *gstate,
- double size)
-{
- _cairo_gstate_unset_scaled_font (gstate);
-
- cairo_matrix_init_scale (&gstate->font_matrix, size, size);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
_cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
const cairo_matrix_t *matrix)
{
diff --git a/src/cairo.c b/src/cairo.c
index 2ea36bc..9e12c6e 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -3061,14 +3061,11 @@ cairo_get_font_face (cairo_t *cr)
void
cairo_set_font_size (cairo_t *cr, double size)
{
- cairo_status_t status;
+ cairo_matrix_t scale;
- if (unlikely (cr->status))
- return;
+ cairo_matrix_init_scale (&scale, size, size);
- status = _cairo_gstate_set_font_size (cr->gstate, size);
- if (unlikely (status))
- _cairo_set_error (cr, status);
+ cairo_set_font_matrix (cr, &scale);
}
slim_hidden_def (cairo_set_font_size);
More information about the cairo-commit
mailing list