From 2f4d8fd0717fc7158d49f7a14335bc13dd09d55a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 2 Jun 2008 22:46:21 -0400 Subject: [PATCH] [cairo-gstate] Return immediately if clip bounds is empty --- src/cairo-gstate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index c73866954..54792312e 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -1557,6 +1557,9 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, _cairo_gstate_transform_glyphs_to_backend (gstate, glyphs, num_glyphs, transformed_glyphs, &num_glyphs); + if (!num_glyphs) + goto CLEANUP_GLYPHS; + status = _cairo_gstate_copy_transformed_source (gstate, &source_pattern.base); if (status) goto CLEANUP_GLYPHS; @@ -1700,6 +1703,11 @@ _cairo_gstate_transform_glyphs_to_backend (cairo_gstate_t *gstate, if (_cairo_gstate_int_clip_extents (gstate, &surface_extents)) drop = FALSE; /* unbounded surface */ else { + if (surface_extents.width == 0 || surface_extents.height == 0) { + /* No visible area. Don't draw anything */ + *num_transformed_glyphs = 0; + return; + } /* XXX We currently drop any glyphs that has its position outside * of the surface boundaries by a safety margin depending on the * font scale. This however can fail in extreme cases where the