From 762b69875572766d335a736a37d1940d9e2557b0 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 26 Feb 2009 14:35:14 +0000 Subject: rewrite the fb_32bpp_fill routine to be more efficient svn path=/trunk/netsurf/; revision=6632 --- framebuffer/fb_32bpp_plotters.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'framebuffer') diff --git a/framebuffer/fb_32bpp_plotters.c b/framebuffer/fb_32bpp_plotters.c index 1237f01a0..89be218fc 100644 --- a/framebuffer/fb_32bpp_plotters.c +++ b/framebuffer/fb_32bpp_plotters.c @@ -153,23 +153,29 @@ static bool fb_32bpp_polygon(const int *p, unsigned int n, colour fill) static bool fb_32bpp_fill(int x0, int y0, int x1, int y1, colour c) { int w; - int y; + uint32_t *pvid_line; uint32_t *pvid; uint32_t ent; + uint32_t llen; + uint32_t width; + uint32_t height; if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) return true; /* fill lies outside current clipping region */ + llen = (framebuffer->linelen >> 2); ent = ((c & 0xff0000) >> 16) | (c & 0xff00) | ((c & 0xff) << 16); + width = x1 - x0; + height = y1 - y0; - pvid = fb_32bpp_get_xy_loc(x0, y0); + pvid_line = fb_32bpp_get_xy_loc(x0, y0); - for (y = y0; y < y1; y++) { - w = x1 - x0; - while (w-- > 0) { - *(pvid + w) = ent; - } - pvid += (framebuffer->linelen >> 2); + while (height > 0) { + height--; + pvid = pvid_line; + pvid_line += llen; + w = width; + while (w-- > 0) *pvid++ = ent; } return true; @@ -193,7 +199,7 @@ fb_32bpp_draw_ft_monobitmap(FT_Bitmap *bp, int x, int y, colour c) { int height = bp->rows; int width = bp->width; - uint32_t row; + uint32_t row = 0; int xloop, yloop; uint32_t *pvideo; -- cgit v1.2.3