Author: adrianl
Date: Thu Feb 26 19:14:04 2009
New Revision: 6652
URL:
http://source.netsurf-browser.org?rev=6652&view=rev
Log:
Sketch of possible optimisations; disabled pending testing and fixing
Modified:
trunk/netsurf/framebuffer/fb_32bpp_plotters.c
trunk/netsurf/framebuffer/fb_plotters.h
Modified: trunk/netsurf/framebuffer/fb_32bpp_plotters.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_32bpp_plot...
==============================================================================
--- trunk/netsurf/framebuffer/fb_32bpp_plotters.c (original)
+++ trunk/netsurf/framebuffer/fb_32bpp_plotters.c Thu Feb 26 19:14:04 2009
@@ -41,15 +41,13 @@
#if __BYTE_ORDER == __BIG_ENDIAN
static inline colour fb_32bpp_to_colour(uint32_t pixel)
{
- return ((pixel & 0xFF00) >> 8) |
- ((pixel & 0xFF0000) >> 8) |
- ((pixel & 0xFF000000) >> 8);
+ return (pixel >> 8) & ~0xFF000000U;
}
/* convert a colour value to a 32bpp pixel value ready for screen output */
static inline uint32_t fb_colour_to_pixel(colour c)
{
- return ((c & 0xff0000) << 8) | (c & 0xff00) << 8 | ((c &
0xff) << 8);
+ return (c << 8);
}
#else
static inline colour fb_32bpp_to_colour(uint32_t pixel)
@@ -191,7 +189,31 @@
pvid = fb_32bpp_get_xy_loc(x0, y0);
while (height-- > 0) {
- for (w = width; w > 0; w--) *pvid++ = ent;
+#if 1
+ for (w = width; w > 0; w--) *pvid++ = ent;
+#else
+ uint32_t *evid = pvid + width;
+ while ((pvid += 16) <= evid) {
+ pvid[0] = ent;
+ pvid[1] = ent;
+ pvid[2] = ent;
+ pvid[3] = ent;
+ pvid[4] = ent;
+ pvid[5] = ent;
+ pvid[6] = ent;
+ pvid[7] = ent;
+ pvid[8] = ent;
+ pvid[9] = ent;
+ pvid[10] = ent;
+ pvid[11] = ent;
+ pvid[12] = ent;
+ pvid[13] = ent;
+ pvid[14] = ent;
+ pvid[15] = ent;
+ }
+ pvid -= 16;
+ while (pvid < evid) *pvid++ = ent;
+#endif
pvid += llen;
}
@@ -483,7 +505,7 @@
{
uint32_t *pvideo;
colour *pixel = (colour *)bitmap->pixdata;
- colour abpixel; /* alphablended pixel */
+ colour abpixel = 0; /* alphablended pixel */
int xloop, yloop;
int x0,y0,x1,y1;
int xoff, yoff; /* x and y offset into image */
@@ -525,6 +547,7 @@
pvideo = fb_32bpp_get_xy_loc(x0, y0);
for (yloop = yoff; yloop < height; yloop += bitmap->width) {
+#if 1
for (xloop = 0; xloop < width; xloop++) {
abpixel = pixel[yloop + xloop + xoff];
if ((abpixel & 0xFF000000) != 0) {
@@ -536,6 +559,25 @@
*(pvideo + xloop) = fb_colour_to_pixel(abpixel);
}
}
+#else
+ uint32_t *pvid = pvideo;
+ colour *pix = &pixel[yloop + xoff];
+ colour *epix = pix + width;
+ do {
+ colour *spix = pix;
+ while (pix < epix && !((abpixel = *pix) &
0xFF000000U)) pix++;
+ if (pix < epix) {
+ pvid += pix++ - spix;
+ do {
+ if ((abpixel & 0xFF000000) != 0xFF000000) {
+ abpixel = fb_plotters_ablend(abpixel,
+ fb_32bpp_to_colour(*pvid));
+ }
+ *pvid++ = fb_colour_to_pixel(abpixel);
+ } while (pix < epix && ((abpixel = *pix++)
& 0xFF000000U));
+ }
+ } while (pix < epix);
+#endif
pvideo += (framebuffer->linelen >> 2);
}
Modified: trunk/netsurf/framebuffer/fb_plotters.h
URL:
http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_plotters.h...
==============================================================================
--- trunk/netsurf/framebuffer/fb_plotters.h (original)
+++ trunk/netsurf/framebuffer/fb_plotters.h Thu Feb 26 19:14:04 2009
@@ -50,6 +50,7 @@
/* alpha blend two pixels together */
static inline colour fb_plotters_ablend(colour pixel, colour scrpixel)
{
+#if 1
int opacity = (pixel >> 24) & 0xFF;
int r,g,b;
@@ -63,6 +64,18 @@
((((scrpixel & 0xFF0000) >> 16) * (0xFF - opacity)) >> 8);
return r | (g << 8) | (b << 16);
+#else
+ int opacity = pixel >> 24;
+ int transp = 0x100 - opacity;
+ uint32_t rb, g;
+
+ rb = ((pixel & 0xFF00FF) * opacity +
+ (scrpixel & 0xFF00FF) * transp) >> 8;
+ g = ((pixel & 0x00FF00) * opacity +
+ (scrpixel & 0x00FF00) * transp) >> 8;
+
+ return rb | g;
+#endif
}