From 7af238ab7fee2fc44d03a846c09e992f2f3c62e1 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 26 Feb 2009 22:59:28 +0000 Subject: If its safe to do so do fills with words at a time svn path=/trunk/netsurf/; revision=6646 --- framebuffer/fb_16bpp_plotters.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'framebuffer') diff --git a/framebuffer/fb_16bpp_plotters.c b/framebuffer/fb_16bpp_plotters.c index e74f309b4..bb1c29f78 100644 --- a/framebuffer/fb_16bpp_plotters.c +++ b/framebuffer/fb_16bpp_plotters.c @@ -166,8 +166,10 @@ static bool fb_16bpp_polygon(const int *p, unsigned int n, colour fill) static bool fb_16bpp_fill(int x0, int y0, int x1, int y1, colour c) { int w; - uint16_t *pvid; - uint16_t ent; + uint16_t *pvid16; + uint16_t ent16; + uint32_t *pvid32; + uint32_t ent32; uint32_t llen; uint32_t width; uint32_t height; @@ -175,18 +177,33 @@ static bool fb_16bpp_fill(int x0, int y0, int x1, int y1, colour c) if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) return true; /* fill lies outside current clipping region */ - ent = fb_colour_to_pixel(c); + ent16 = fb_colour_to_pixel(c); width = x1 - x0; height = y1 - y0; - llen = (framebuffer->linelen >> 1) - width; - pvid = fb_16bpp_get_xy_loc(x0, y0); + pvid16 = fb_16bpp_get_xy_loc(x0, y0); - while (height-- > 0) { - for (w = width; w > 0; w--) *pvid++ = ent; - pvid += llen; - } + if (((x0 & 1) == 0) && ((width & 1) == 0)) { + /* aligned to 32bit value and width is even */ + width = width >> 1; + llen = (framebuffer->linelen >> 2) - width; + ent32 = ent16 | (ent16 << 16); + pvid32 = (uint32_t *)pvid16; + + while (height-- > 0) { + for (w = width; w > 0; w--) *pvid32++ = ent32; + pvid32 += llen; + } + } else { + llen = (framebuffer->linelen >> 1) - width; + + + while (height-- > 0) { + for (w = width; w > 0; w--) *pvid16++ = ent16; + pvid16 += llen; + } + } return true; } -- cgit v1.2.3