From 929571b4b56d56c669eb4cbb3e109e2bd4620fb0 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Thu, 21 Oct 2010 17:11:48 +0200 Subject: [PATCH] path: Cleanup _cairo_path_fixed_transform Clean up the code and make sure that _cairo_path_fixed_translate is used whenever the _cairo_fixed_to_double rounding would result in the matrix being approximated with a translation. --- src/cairo-path-fixed.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 76fc196f6..f6b6cb456 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -975,6 +975,11 @@ _cairo_path_fixed_offset_and_scale (cairo_path_fixed_t *path, cairo_path_buf_t *buf; unsigned int i; + if (scalex == CAIRO_FIXED_ONE && scaley == CAIRO_FIXED_ONE) { + _cairo_path_fixed_translate (path, offx, offy); + return; + } + /* Recompute an approximation of the flags. * It might be more strict than what is actually needed. */ @@ -1062,17 +1067,11 @@ _cairo_path_fixed_transform (cairo_path_fixed_t *path, if (matrix->yx == 0.0 && matrix->xy == 0.0) { /* Fast path for the common case of scale+transform */ - if (matrix->xx == 1. && matrix->yy == 1.) { - _cairo_path_fixed_translate (path, - _cairo_fixed_from_double (matrix->x0), - _cairo_fixed_from_double (matrix->y0)); - } else { - _cairo_path_fixed_offset_and_scale (path, - _cairo_fixed_from_double (matrix->x0), - _cairo_fixed_from_double (matrix->y0), - _cairo_fixed_from_double (matrix->xx), - _cairo_fixed_from_double (matrix->yy)); - } + _cairo_path_fixed_offset_and_scale (path, + _cairo_fixed_from_double (matrix->x0), + _cairo_fixed_from_double (matrix->y0), + _cairo_fixed_from_double (matrix->xx), + _cairo_fixed_from_double (matrix->yy)); return; }