r5397 vince - in /branches/vince/netsurf-fb/framebuffer: fb_16bpp_plotters.c fb_32bpp_plotters.c fb_8bpp_plotters.c fb_gui.c fb_plotters.c fb_plotters.h

netsurf at semichrome.net netsurf at semichrome.net
Mon Sep 22 13:46:22 BST 2008


Author: vince
Date: Mon Sep 22 07:46:22 2008
New Revision: 5397

URL: http://source.netsurf-browser.org?rev=5397&view=rev
Log:
Fix bitmap tileing

Modified:
    branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_gui.c
    branches/vince/netsurf-fb/framebuffer/fb_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_plotters.h

Modified: branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c?rev=5397&r1=5396&r2=5397&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c Mon Sep 22 07:46:22 2008
@@ -139,9 +139,6 @@
 static bool fb_16bpp_rectangle(int x0, int y0, int width, int height,
 			int line_width, colour c, bool dotted, bool dashed)
 {
-        /*LOG(("%d, %d, %d, %d, %d, 0x%lx, %d, %d",
-          x0,y0,width,height,line_width,c,dotted,dashed));*/
-
         fb_16bpp_line(x0, y0, x0 + width, y0, line_width, c, dotted, dashed);
         fb_16bpp_line(x0, y0 + height, x0 + width, y0 + height, line_width, c, dotted, dashed);
         fb_16bpp_line(x0, y0, x0, y0 + height, line_width, c, dotted, dashed);
@@ -151,7 +148,6 @@
 
 static bool fb_16bpp_polygon(int *p, unsigned int n, colour fill)
 {
-        /*LOG(("p %p, n %d, fill 0x%lx", p, n, fill));*/
         return fb_plotters_polygon(p, n, fill, fb_16bpp_line);
 }
 
@@ -162,8 +158,6 @@
         int y;
         uint16_t ent;
         uint16_t *pvideo;
-
-        /*LOG(("x0 %d, y0 %d, x1 %d, y1 %d, c 0x%lx", x0, y0, x1, y1, c));*/
 
         fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1);
 
@@ -379,39 +373,9 @@
 			bool repeat_x, bool repeat_y,
                              struct content *content)
 {
-	int xf,yf,wf,hf;
-
-        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"));
-		return fb_16bpp_bitmap(x, y, width, height, bitmap, bg,content);
-	}
-
-	for (xf = 0; xf < width; xf += bitmap->width) {
-		for (yf = 0; yf < height; yf += bitmap->height) {
-			if (width > (xf + bitmap->width)) {
-				wf = width - (xf + bitmap->width);
-                                LOG(("wf %d, width %d, xf %d, bitmap width %d",
-                                     wf, width, xf, bitmap->width));
-			} else {
-				wf = bitmap->width;
-                                LOG(("wf %d, bitmap width %d", 
-                                     wf, bitmap->width));
-			}
-
-			if (height > (yf + bitmap->height)) {
-				hf = height - (yf + bitmap->height);
-			} else {
-				hf=bitmap->height;
-			}
-
-                        fb_16bpp_bitmap(x+xf, y+yf, wf, hf, bitmap, bg, content);
-		}
-	}
-
-	return true;
+        return fb_plotters_bitmap_tile(x, y, width, height, 
+                                       bitmap, bg, repeat_x, repeat_y,
+                                       content, fb_16bpp_bitmap);
 }
 
 static bool fb_16bpp_flush(void)

Modified: branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c?rev=5397&r1=5396&r2=5397&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c Mon Sep 22 07:46:22 2008
@@ -354,33 +354,9 @@
 			bool repeat_x, bool repeat_y, 
                              struct content *content)
 {
-	int xf,yf,wf,hf;
-
-	if (!(repeat_x || repeat_y)) {
-		/* Not repeating at all, so just pass it on */
-		return fb_32bpp_bitmap(x,y,width,height,bitmap,bg,content);
-	}
-
-	for (xf = 0; xf < width; xf += bitmap->width) {
-		for (yf = 0;yf < height; yf += bitmap->height) {
-			if (width > xf + bitmap->width) {
-				wf = width-(xf+bitmap->width);
-			} else {
-				wf=bitmap->width;
-			}
-
-			if(height > yf+bitmap->height) {
-				hf = height-(yf+bitmap->height);
-			} else {
-				hf=bitmap->height;
-			}
-
-                        fb_32bpp_bitmap(x+xf, y+yf, wf, hf, bitmap, bg, content);
-
-		}
-	}
-
-	return true;
+        return fb_plotters_bitmap_tile(x, y, width, height, 
+                                       bitmap, bg, repeat_x, repeat_y,
+                                       content, fb_32bpp_bitmap);
 }
 
 static bool fb_32bpp_flush(void)

Modified: branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c?rev=5397&r1=5396&r2=5397&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c Mon Sep 22 07:46:22 2008
@@ -256,33 +256,9 @@
                          bool repeat_x, bool repeat_y, 
                          struct content *content)
 {
-	long xf,yf,wf,hf;
-
-	if (!(repeat_x || repeat_y)) {
-		/* Not repeating at all, so just pass it on */
-		return fb_8bpp_bitmap(x,y,width,height,bitmap,bg,content);
-	}
-
-	for (xf = 0; xf < width; xf += bitmap->width) {
-		for(yf = 0; yf < height; yf += bitmap->height) {
-			if(width > xf + bitmap->width) {
-				wf = width-(xf + bitmap->width);
-			} else {
-				wf=bitmap->width;
-			}
-
-			if(height > yf+bitmap->height) {
-				hf = height-(yf+bitmap->height);
-			} else {
-				hf = bitmap->height;
-			}
-
-                        fb_8bpp_bitmap(x+xf, y+yf, wf, hf, bitmap, bg, content);
-
-		}
-	}
-
-	return true;
+        return fb_plotters_bitmap_tile(x, y, width, height, 
+                                       bitmap, bg, repeat_x, repeat_y,
+                                       content, fb_8bpp_bitmap);
 }
 
 static bool fb_8bpp_flush(void)

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.c?rev=5397&r1=5396&r2=5397&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.c Mon Sep 22 07:46:22 2008
@@ -62,7 +62,7 @@
 	if (!c) return;
 	if (c->locked) return;
 
-	LOG(("panning %d, %d",g->panx, g->pany));
+	LOG(("panning %d, %d from %d, %d in content %d,%d",g->panx, g->pany,g->scrollx,g->scrolly,c->width, c->height));
 	/* dont pan off teh top or bottom */
 	if ((g->scrolly + g->pany) < 0)
 		g->pany = -g->scrolly;
@@ -80,7 +80,9 @@
 
 		LOG(("panning up %d", g->pany));
 
-		fb_plotters_move_block(g->x, g->y, g->width, g->height + g->pany, g->x, g->y - g->pany);
+		fb_plotters_move_block(g->x, g->y, 
+                                       g->width, g->height + g->pany, 
+                                       g->x, g->y - g->pany);
 		g->scrolly += g->pany;
 		fb_queue_redraw(g, g->x, g->y, 
 				g->x + g->width, g->y - g->pany);

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.c?rev=5397&r1=5396&r2=5397&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.c Mon Sep 22 07:46:22 2008
@@ -216,6 +216,45 @@
 	return true;
 }
 
+bool fb_plotters_bitmap_tile(int x, int y, 
+                             int width, int height,
+                             struct bitmap *bitmap, colour bg,
+                             bool repeat_x, bool repeat_y,
+                             struct content *content,
+                             bool (bitmapfn)(int x, int y, 
+                                             int width, int height,
+                                             struct bitmap *bitmap, 
+                                             colour bg,
+                                             struct content *content))
+{
+	int xf,yf;
+
+        /* x and y define top left hand corner of tile start, the width height
+         * are the mage scaling and the bounding box defines teh extent of the
+         * repeat 
+         */
+
+        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"));
+		return bitmapfn(x, y, width, height, bitmap, bg,content);
+	}
+
+	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;
+		}
+                if (!repeat_x)
+                        break;
+	}
+
+	return true;
+}
+
 bool fb_plotters_move_block(int srcx, int srcy, int width, int height, int dstx, int dsty)
 {
 	LOG(("from (%d,%d) w %d h %d to (%d,%d)",srcx,srcy,width,height,dstx,dsty));
@@ -228,6 +267,7 @@
 			   (dstx));
 
 	memmove(dstptr, srcptr, (width * height * framebuffer->bpp) / 8);
+        return true;
 }
 
 /*

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.h?rev=5397&r1=5396&r2=5397&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.h Mon Sep 22 07:46:22 2008
@@ -36,6 +36,17 @@
 
 bool fb_plotters_polygon(int *p, unsigned int n, colour fill, bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed));
 
+bool fb_plotters_bitmap_tile(int x, int y, 
+                             int width, int height,
+                             struct bitmap *bitmap, colour bg,
+                             bool repeat_x, bool repeat_y,
+                             struct content *content,
+                             bool (bitmapfn)(int x, int y, 
+                                             int width, int height,
+                                             struct bitmap *bitmap, 
+                                             colour bg,
+                                             struct content *content));
+
 colour fb_plotters_ablend(colour pixel, colour scrpixel);
 
 bool fb_plotters_move_block(int srcx, int srcy, int width, int height, int dstx, int dsty);




More information about the netsurf-commits mailing list