From 9a6a2d58d667b5ea4c45f8b2e47919aa7a5c5d3a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 23 Feb 2009 09:19:22 +0000 Subject: Neater fix for framebuffer tiled bitmap plot extents. svn path=/trunk/netsurf/; revision=6607 --- framebuffer/fb_plotters.c | 60 ++++++++++++++++++----------------------------- 1 file 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; } -- cgit v1.2.3