diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2008-07-19 00:50:41 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2008-07-19 00:50:41 +0000 |
commit | 302e16de79f986bb331f24343b8ba9f0859f56c4 (patch) | |
tree | 1a7d5e87fb373152e74443bb4b2c8b867e2e68b3 /render | |
parent | fb0937285c3f712bb173828c44f066e408ef34a4 (diff) | |
download | netsurf-302e16de79f986bb331f24343b8ba9f0859f56c4.tar.gz netsurf-302e16de79f986bb331f24343b8ba9f0859f56c4.tar.bz2 |
Fix repeating background image redraw bug.
svn path=/trunk/netsurf/; revision=4700
Diffstat (limited to 'render')
-rw-r--r-- | render/html_redraw.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c index 8c66a1035..6eea21bb6 100644 --- a/render/html_redraw.c +++ b/render/html_redraw.c @@ -1325,15 +1325,37 @@ bool html_redraw_background(int x, int y, struct box *box, float scale, } /* and plot the image */ if (plot_content) { - if (!plot.clip(clip_x0, clip_y0, clip_x1, clip_y1)) + if (!repeat_x) { + if (clip_x0 < x) + clip_x0 = x; + if (clip_x1 > x + background->background->width) + clip_x1 = x + background->background-> + width; + } else if (!repeat_y) { + if (clip_y0 < y) + clip_y0 = y; + if (clip_y1 > y + background->background-> + height) + clip_y1 = y + background->background-> + height; + } + /* valid clipping rectangles only */ + if ((clip_x0 < clip_x1) && (clip_y0 < clip_y1)) { + if (!plot.clip(clip_x0, clip_y0, + clip_x1, clip_y1)) return false; - if (!content_redraw_tiled(background->background, x, y, - ceilf(background->background->width * scale), - ceilf(background->background->height * scale), - clip_x0, clip_y0, clip_x1, clip_y1, scale, - *background_colour, - repeat_x, repeat_y)) - return false; + if (!content_redraw_tiled(background-> + background, x, y, + ceilf(background->background-> + width * scale), + ceilf(background->background-> + height * scale), + clip_x0, clip_y0, + clip_x1, clip_y1, + scale, *background_colour, + repeat_x, repeat_y)) + return false; + } } /* only <tr> rows being clipped to child boxes loop */ @@ -1481,7 +1503,7 @@ bool html_redraw_scrollbars(struct box *box, float scale, colour vcolour = box->style->border[RIGHT].color; colour hcolour = box->style->border[BOTTOM].color; - /** \todo We probably want to clamp to either end of the spectrum, + /** \todo We probably want to clamp to either end of the spectrum, * rather than simply taking the inverse colour. */ if (vcolour == TRANSPARENT || vcolour == background_colour) vcolour = background_colour ^ 0xffffff; |