From 4357f5e9d72b0f4efe939e02a7012fc60d43095d Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 22 Aug 2012 22:26:00 +0100 Subject: Test for zero width/height at the start. --- gtk/plotters.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gtk') diff --git a/gtk/plotters.c b/gtk/plotters.c index 2f2b111db..fbf3d58ac 100644 --- a/gtk/plotters.c +++ b/gtk/plotters.c @@ -404,6 +404,11 @@ static bool nsgtk_plot_bitmap(int x, int y, int width, int height, bool repeat_x = (flags & BITMAPF_REPEAT_X); bool repeat_y = (flags & BITMAPF_REPEAT_Y); + /* Bail early if we can */ + if (width == 0 || height == 0) + /* Nothing to plot */ + return true; + if (!(repeat_x || repeat_y)) { /* Not repeating at all, so just pass it on */ return nsgtk_plot_pixbuf(x, y, width, height, bitmap, bg); @@ -412,11 +417,6 @@ static bool nsgtk_plot_bitmap(int x, int y, int width, int height, width = bitmap_get_width(bitmap); height = bitmap_get_height(bitmap); - /* Bail early if we can */ - if (width == 0 || height == 0) - /* Nothing to plot */ - return true; - if (y > cliprect.y) { doneheight = (cliprect.y - height) + ((y - cliprect.y) % height); } else { -- cgit v1.2.3