From e2bb36fe08546e6461fcbd40f5f3f81e5efc7686 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 29 Jan 2008 08:41:21 -0800 Subject: wAdd proper error propagation to _cairo_matrix_compute_scale_factors Before there was just an assert statement here that the determinant of the matrix was not infinite. That was bogus since a user-provided can end up here. So instead, do the correct error propagation of any CAIRO_STATUS_INVALID_MATRIX error as necessary. This eliminates the current failure of the invalid-matrix test case. --- src/cairo-win32-font.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/cairo-win32-font.c') diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c index eb4d3b1e..34c27361 100644 --- a/src/cairo-win32-font.c +++ b/src/cairo-win32-font.c @@ -130,7 +130,7 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font #define NEARLY_ZERO(d) (fabs(d) < (1. / 65536.)) -static void +static cairo_status_t _compute_transform (cairo_win32_scaled_font_t *scaled_font, cairo_matrix_t *sc) { @@ -175,9 +175,11 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font, sc->xx, sc->yx, sc->xy, sc->yy, 0, 0); if (!scaled_font->preserve_axes) { - _cairo_matrix_compute_scale_factors (&scaled_font->logical_to_device, - &scaled_font->x_scale, &scaled_font->y_scale, - TRUE); /* XXX: Handle vertical text */ + status = _cairo_matrix_compute_scale_factors (&scaled_font->logical_to_device, + &scaled_font->x_scale, &scaled_font->y_scale, + TRUE); /* XXX: Handle vertical text */ + if (status) + return status; scaled_font->logical_size = _cairo_lround (WIN32_FONT_LOGICAL_SCALE * scaled_font->y_scale); @@ -192,6 +194,8 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font, status = cairo_matrix_invert (&scaled_font->device_to_logical); if (status) cairo_matrix_init_identity (&scaled_font->device_to_logical); + + return CAIRO_STATUS_SUCCESS; } static cairo_bool_t @@ -312,7 +316,9 @@ _win32_scaled_font_create (LOGFONTW *logfont, f->delete_scaled_hfont = !f->scaled_hfont; cairo_matrix_multiply (&scale, font_matrix, ctm); - _compute_transform (f, &scale); + status = _compute_transform (f, &scale); + if (status) + goto FAIL; status = _cairo_scaled_font_init (&f->base, font_face, font_matrix, ctm, options, @@ -872,9 +878,7 @@ _cairo_win32_scaled_font_set_metrics (cairo_win32_scaled_font_t *scaled_font) } } - _cairo_scaled_font_set_metrics (&scaled_font->base, &extents); - - return CAIRO_STATUS_SUCCESS; + return _cairo_scaled_font_set_metrics (&scaled_font->base, &extents); } static cairo_status_t -- cgit v1.2.3