summaryrefslogtreecommitdiff
path: root/gtk/gtk_plotters.c
diff options
context:
space:
mode:
authorRob Kendrick <rjek@netsurf-browser.org>2009-01-02 15:10:33 +0000
committerRob Kendrick <rjek@netsurf-browser.org>2009-01-02 15:10:33 +0000
commit3d260f6e75da2ee2b1dd0b933e9f2552cf66f2d5 (patch)
tree7cde4e0961bf1eeea67b2476114bb535784bc2b4 /gtk/gtk_plotters.c
parentcc4ff674389c22f8ec24df5b4930a359af46cf30 (diff)
downloadnetsurf-3d260f6e75da2ee2b1dd0b933e9f2552cf66f2d5.tar.gz
netsurf-3d260f6e75da2ee2b1dd0b933e9f2552cf66f2d5.tar.bz2
Fix warnings and formatting
svn path=/trunk/netsurf/; revision=5956
Diffstat (limited to 'gtk/gtk_plotters.c')
-rw-r--r--gtk/gtk_plotters.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c
index 016d487b2..2f03cc1bb 100644
--- a/gtk/gtk_plotters.c
+++ b/gtk/gtk_plotters.c
@@ -27,6 +27,7 @@
*/
#include <math.h>
+#include <assert.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include "desktop/plotters.h"
@@ -293,26 +294,29 @@ bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height,
bool repeat_x, bool repeat_y, struct content *content)
{
int doneheight = 0, donewidth = 0;
- GdkPixbuf *primary;
- GdkPixbuf *pretiled;
+ GdkPixbuf *primary;
+ GdkPixbuf *pretiled = NULL;
if (!(repeat_x || repeat_y)) {
/* Not repeating at all, so just pass it on */
return nsgtk_plot_bitmap(x,y,width,height,bitmap,bg,content);
}
- if (repeat_x && !repeat_y)
- pretiled = gtk_bitmap_get_pretile_x(bitmap);
- if (repeat_x && repeat_y)
- pretiled = gtk_bitmap_get_pretile_xy(bitmap);
- if (!repeat_x && repeat_y)
- pretiled = gtk_bitmap_get_pretile_y(bitmap);
- primary = gtk_bitmap_get_primary(bitmap);
- /* use the primary and pretiled widths to scale the w/h provided */
- width *= gdk_pixbuf_get_width(pretiled);
- width /= gdk_pixbuf_get_width(primary);
- height *= gdk_pixbuf_get_height(pretiled);
- height /= gdk_pixbuf_get_height(primary);
+ if (repeat_x && !repeat_y)
+ pretiled = gtk_bitmap_get_pretile_x(bitmap);
+ if (repeat_x && repeat_y)
+ pretiled = gtk_bitmap_get_pretile_xy(bitmap);
+ if (!repeat_x && repeat_y)
+ pretiled = gtk_bitmap_get_pretile_y(bitmap);
+
+ assert(pretiled != NULL);
+
+ primary = gtk_bitmap_get_primary(bitmap);
+ /* use the primary and pretiled widths to scale the w/h provided */
+ width *= gdk_pixbuf_get_width(pretiled);
+ width /= gdk_pixbuf_get_width(primary);
+ height *= gdk_pixbuf_get_height(pretiled);
+ height /= gdk_pixbuf_get_height(primary);
if (y > cliprect.y)
doneheight = (cliprect.y - height) + ((y - cliprect.y) % height);
@@ -334,7 +338,6 @@ bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height,
if (!repeat_y) break;
}
-
return true;
}