summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2006-03-14 21:14:17 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2006-03-14 21:14:17 +0000
commite761d87f35c54bfa81014f17240b8cf27d846ee6 (patch)
tree02f1d7a578a756585522300e3833ba0796b6d17d /gtk
parent7ddb6b6f19f465a232535fdd1fa5c3b0473946f5 (diff)
downloadnetsurf-e761d87f35c54bfa81014f17240b8cf27d846ee6.tar.gz
netsurf-e761d87f35c54bfa81014f17240b8cf27d846ee6.tar.bz2
[project @ 2006-03-14 21:14:17 by dsilvers]
Add tiled bitmap support to GTK port to make backgrounds etc work svn path=/import/netsurf/; revision=2130
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtk_plotters.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c
index 1bb984de6..c6d157a51 100644
--- a/gtk/gtk_plotters.c
+++ b/gtk/gtk_plotters.c
@@ -40,7 +40,7 @@ static bool nsgtk_plot_group_start(const char *name);
static bool nsgtk_plot_group_end(void);
static void nsgtk_set_colour(colour c);
-
+static GdkRectangle cliprect;
struct plotter_table plot;
@@ -113,9 +113,11 @@ bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, colour c)
bool nsgtk_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1)
{
- GdkRectangle clip = { clip_x0, clip_y0,
- clip_x1 - clip_x0 + 1, clip_y1 - clip_y0 + 1 };
- gdk_gc_set_clip_rectangle(current_gc, &clip);
+ cliprect.x = clip_x0;
+ cliprect.y = clip_y0;
+ cliprect.width = clip_x1 - clip_x0 + 1;
+ cliprect.height = clip_y1 - clip_y0 + 1;
+ gdk_gc_set_clip_rectangle(current_gc, &cliprect);
return true;
}
@@ -136,6 +138,9 @@ bool nsgtk_plot_disc(int x, int y, int radius, colour colour)
bool nsgtk_plot_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg)
{
+ /* XXX: This currently ignores the background colour supplied.
+ * Does this matter?
+ */
GdkPixbuf *pixbuf = (GdkPixbuf *) bitmap;
if (width == 0 || height == 0)
@@ -176,6 +181,24 @@ bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y)
{
+ int doneheight = 0, donewidth = 0;
+
+ if (!(repeat_x || repeat_y)) {
+ /* Not repeating at all, so just pass it on */
+ return nsgtk_plot_bitmap(x,y,width,height,bitmap,bg);
+ }
+
+ doneheight = cliprect.y - (cliprect.y % height);
+
+ while (doneheight < (cliprect.y + cliprect.height)) {
+ donewidth = cliprect.x - (cliprect.x % width);
+ while (donewidth < (cliprect.x + cliprect.width)) {
+ nsgtk_plot_bitmap(donewidth, doneheight,
+ width, height, bitmap, bg);
+ donewidth += width;
+ }
+ doneheight += height;
+ }
return true;
}