From 8f65a9bf5c01dd2eafb10c291e10ac10fea3d00c Mon Sep 17 00:00:00 2001 From: "mats.palmgren@bredband.net" Date: Sun, 20 Jan 2008 17:06:38 -0800 Subject: [PATCH] Make _cairo_scaled_font_glyph_device_extents() take an cairo_rectangle_int_t out param instead of cairo_rectangle_int16_t fixing an UMR in the process. b=413169 r+sr=vladimir a=mtschrep --- gfx/cairo/cairo/src/cairo-analysis-surface.c | 3 +++ gfx/cairo/cairo/src/cairo-scaled-font.c | 24 ++++++++++---------- gfx/cairo/cairo/src/cairo-surface-fallback.c | 9 ++------ gfx/cairo/cairo/src/cairo-xcb-surface.c | 2 +- gfx/cairo/cairo/src/cairo-xlib-surface.c | 2 +- gfx/cairo/cairo/src/cairoint.h | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-analysis-surface.c b/gfx/cairo/cairo/src/cairo-analysis-surface.c index 357e79a5071..41d0abb7be9 100644 --- a/gfx/cairo/cairo/src/cairo-analysis-surface.c +++ b/gfx/cairo/cairo/src/cairo-analysis-surface.c @@ -586,6 +586,9 @@ static const cairo_surface_backend_t cairo_analysis_surface_backend = { _cairo_analysis_surface_fill, _cairo_analysis_surface_show_glyphs, NULL, /* snapshot */ + NULL, /* is_similar */ + NULL, /* reset */ + NULL, /* fill_stroke */ }; cairo_surface_t * diff --git a/gfx/cairo/cairo/src/cairo-scaled-font.c b/gfx/cairo/cairo/src/cairo-scaled-font.c index f8b124bd325..2cad1c0b4ed 100644 --- a/gfx/cairo/cairo/src/cairo-scaled-font.c +++ b/gfx/cairo/cairo/src/cairo-scaled-font.c @@ -1108,12 +1108,12 @@ cairo_status_t _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font, const cairo_glyph_t *glyphs, int num_glyphs, - cairo_rectangle_int16_t *extents) + cairo_rectangle_int_t *extents) { cairo_status_t status = CAIRO_STATUS_SUCCESS; int i; - short min_x = INT16_MAX, max_x = INT16_MIN; - short min_y = INT16_MAX, max_y = INT16_MIN; + cairo_point_int_t min = { CAIRO_RECT_INT_MIN, CAIRO_RECT_INT_MIN }; + cairo_point_int_t max = { CAIRO_RECT_INT_MAX, CAIRO_RECT_INT_MAX }; if (scaled_font->status) return scaled_font->status; @@ -1140,16 +1140,16 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font, right = x + _cairo_fixed_integer_ceil(scaled_glyph->bbox.p2.x); bottom = y + _cairo_fixed_integer_ceil (scaled_glyph->bbox.p2.y); - if (left < min_x) min_x = left; - if (right > max_x) max_x = right; - if (top < min_y) min_y = top; - if (bottom > max_y) max_y = bottom; + if (left < min.x) min.x = left; + if (right > max.x) max.x = right; + if (top < min.y) min.y = top; + if (bottom > max.y) max.y = bottom; } - if (min_x < max_x && min_y < max_y) { - extents->x = min_x; - extents->width = max_x - min_x; - extents->y = min_y; - extents->height = max_y - min_y; + if (min.x < max.x && min.y < max.y) { + extents->x = min.x; + extents->width = max.x - min.x; + extents->y = min.y; + extents->height = max.y - min.y; } else { extents->x = extents->y = 0; extents->width = extents->height = 0; diff --git a/gfx/cairo/cairo/src/cairo-surface-fallback.c b/gfx/cairo/cairo/src/cairo-surface-fallback.c index ef28d9d8ef5..e3438d19009 100644 --- a/gfx/cairo/cairo/src/cairo-surface-fallback.c +++ b/gfx/cairo/cairo/src/cairo-surface-fallback.c @@ -997,8 +997,7 @@ _cairo_surface_fallback_show_glyphs (cairo_surface_t *surface, return status; if (_cairo_operator_bounded_by_mask (op)) { - cairo_rectangle_int16_t glyph_extents; - cairo_rectangle_int_t glyph_extents_full; + cairo_rectangle_int_t glyph_extents; status = _cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, num_glyphs, @@ -1006,11 +1005,7 @@ _cairo_surface_fallback_show_glyphs (cairo_surface_t *surface, if (status) return status; - glyph_extents_full.x = glyph_extents.x; - glyph_extents_full.y = glyph_extents.y; - glyph_extents_full.width = glyph_extents.width; - glyph_extents_full.height = glyph_extents.height; - _cairo_rectangle_intersect (&extents, &glyph_extents_full); + _cairo_rectangle_intersect (&extents, &glyph_extents); } status = _cairo_clip_intersect_to_rectangle (surface->clip, &extents); diff --git a/gfx/cairo/cairo/src/cairo-xcb-surface.c b/gfx/cairo/cairo/src/cairo-xcb-surface.c index 451cc8f4306..85facf29269 100644 --- a/gfx/cairo/cairo/src/cairo-xcb-surface.c +++ b/gfx/cairo/cairo/src/cairo-xcb-surface.c @@ -2411,7 +2411,7 @@ _cairo_xcb_surface_show_glyphs (void *abstract_dst, (cairo_surface_t **) &src, &attributes); } else { - cairo_rectangle_int16_t glyph_extents; + cairo_rectangle_int_t glyph_extents; status = _cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c index bd1a3e8e25e..8b575d86d96 100644 --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c @@ -3215,7 +3215,7 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst, if (status) goto BAIL0; } else { - cairo_rectangle_int16_t glyph_extents; + cairo_rectangle_int_t glyph_extents; status = _cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h index ffc5fcf05b7..ecb36a18dd0 100644 --- a/gfx/cairo/cairo/src/cairoint.h +++ b/gfx/cairo/cairo/src/cairoint.h @@ -1423,7 +1423,7 @@ cairo_private cairo_status_t _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font, const cairo_glyph_t *glyphs, int num_glyphs, - cairo_rectangle_int16_t *extents); + cairo_rectangle_int_t *extents); cairo_private cairo_status_t _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,