diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2012-09-30 09:40:46 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2012-09-30 09:40:46 +0100 |
commit | 480b2353d815540dca310edc8496da1d3f1b3295 (patch) | |
tree | 1103a068d8674cca5c38047f172ba1167cafde74 /src/plot/32bpp-common.c | |
parent | 1fbc4a8b2dfc030f174aaf475f7ea6820864d1a3 (diff) | |
download | libnsfb-480b2353d815540dca310edc8496da1d3f1b3295.tar.gz |
Split 32bpp support into xrgba, xbgr, and common. Should allow for BGR surfaces as well as RGB.
Diffstat (limited to 'src/plot/32bpp-common.c')
-rw-r--r-- | src/plot/32bpp-common.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/plot/32bpp-common.c b/src/plot/32bpp-common.c new file mode 100644 index 0000000..9626acf --- /dev/null +++ b/src/plot/32bpp-common.c @@ -0,0 +1,63 @@ +/* + * Copyright 2009 Vincent Sanders <vince@simtec.co.uk> + * Copyright 2010 Michael Drake <tlsa@netsurf-browser.org> + * + * This file is part of libnsfb, http://www.netsurf-browser.org/ + * Licenced under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +#include "common.c" + +static bool fill(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c) +{ + int w; + uint32_t *pvid; + uint32_t ent; + uint32_t llen; + uint32_t width; + uint32_t height; + + if (!nsfb_plot_clip_ctx(nsfb, rect)) + return true; /* fill lies outside current clipping region */ + + ent = colour_to_pixel(nsfb, c); + width = rect->x1 - rect->x0; + height = rect->y1 - rect->y0; + llen = (nsfb->linelen >> 2) - width; + + pvid = get_xy_loc(nsfb, rect->x0, rect->y0); + + while (height-- > 0) { + w = width; + while (w >= 16) { + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + w-=16; + } + while (w >= 4) { + *pvid++ = ent; *pvid++ = ent; + *pvid++ = ent; *pvid++ = ent; + w-=4; + } + while (w > 0) { + *pvid++ = ent; + w--; + } + pvid += llen; + } + + return true; +} + +/* + * Local Variables: + * c-basic-offset:8 + * End: + */ |