diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2009-02-23 09:19:22 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2009-02-23 09:19:22 +0000 |
commit | 9a6a2d58d667b5ea4c45f8b2e47919aa7a5c5d3a (patch) | |
tree | 18146662ba920dc6ad42fca8fe8a94539bc16516 /framebuffer | |
parent | c2a773b049cd039a3cdc342b9b414b9c43bc8821 (diff) | |
download | netsurf-9a6a2d58d667b5ea4c45f8b2e47919aa7a5c5d3a.tar.gz netsurf-9a6a2d58d667b5ea4c45f8b2e47919aa7a5c5d3a.tar.bz2 |
Neater fix for framebuffer tiled bitmap plot extents.
svn path=/trunk/netsurf/; revision=6607
Diffstat (limited to 'framebuffer')
-rw-r--r-- | framebuffer/fb_plotters.c | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/framebuffer/fb_plotters.c b/framebuffer/fb_plotters.c index 967267679..2b6e06d23 100644 --- a/framebuffer/fb_plotters.c +++ b/framebuffer/fb_plotters.c @@ -430,54 +430,40 @@ bool fb_plotters_bitmap_tile(int x, int y, { int xf,yf; - /* x and y define coordinate of top left of of the initial explicitly - * placed tile. The width and height are the image scaling and the - * bounding box defines the extent of the repeat (which may go in all - * four directions from the initial tile). - */ + /* x and y define coordinate of top left of of the initial explicitly + * placed tile. The width and height are the image scaling and the + * bounding box defines the extent of the repeat (which may go in all + * four directions from the initial tile). + */ - LOG(("x %d, y %d, width %d, height %d, bitmap %p, repx %d repy %d content %p", x,y,width,height,bitmap,repeat_x, repeat_y, content)); + LOG(("x %d, y %d, width %d, height %d, bitmap %p, repx %d repy %d content %p", x,y,width,height,bitmap,repeat_x, repeat_y, content)); if (!(repeat_x || repeat_y)) { /* Not repeating at all, so just pass it on */ - LOG(("Not repeating")); + LOG(("Not repeating")); return bitmapfn(x, y, width, height, bitmap, bg,content); } - /* Initial tile and repeat left, right and down */ - for (xf = x; xf < fb_plot_ctx.x1; xf += width) { - for (yf = y; yf < fb_plot_ctx.y1; yf += height) { - bitmapfn(xf, yf, width, height, bitmap, bg, content); - if (!repeat_y) - break; - } - for (yf = y - height; yf + height > fb_plot_ctx.y0; - yf -= height) { - if (!repeat_y) - break; - bitmapfn(xf, yf, width, height, bitmap, bg, content); - } - if (!repeat_x) - break; - } + /* get left most tile position */ + if (repeat_x) + for (; x > fb_plot_ctx.x0; x -= width) + ; - /* repeat left and right above */ - for (xf = x - width; xf + height > fb_plot_ctx.x0; xf -= width) { - if (!repeat_x) - break; + /* get top most tile position */ + if (repeat_y) + for (; y > fb_plot_ctx.y0; y -= height) + ; + + /* tile down and across to extents */ + for (xf = x; xf < fb_plot_ctx.x1; xf += width) { for (yf = y; yf < fb_plot_ctx.y1; yf += height) { - bitmapfn(xf, yf, width, height, bitmap, bg, content); - if (!repeat_y) - break; - } - for (yf = y - height; yf + height > fb_plot_ctx.y0; - yf -= height) { - if (!repeat_y) - break; - bitmapfn(xf, yf, width, height, bitmap, bg, content); + bitmapfn(xf, yf, width, height, bitmap, bg, content); + if (!repeat_y) + break; } + if (!repeat_x) + break; } - return true; } |