r5380 vince - in /branches/vince/netsurf-fb/framebuffer: fb_16bpp_plotters.c fb_gui.c fb_gui.h fb_plotters.c fb_schedule.c

netsurf at semichrome.net netsurf at semichrome.net
Sat Sep 20 17:08:43 BST 2008


Author: vince
Date: Sat Sep 20 11:08:43 2008
New Revision: 5380

URL: http://source.netsurf-browser.org?rev=5380&view=rev
Log:
Alter panning to use its own flag so it doesnt cause invalid redraw 
operations 

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

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=5380&r1=5379&r2=5380&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c Sat Sep 20 11:08:43 2008
@@ -52,8 +52,8 @@
         int dx, dy, sdy;
         int dxabs, dyabs;
 
-        LOG(("%d, %d, %d, %d, %d, 0x%lx, %d, %d",
-             x0,y0,x1,y1,width,c,dotted,dashed));
+        /*LOG(("%d, %d, %d, %d, %d, 0x%lx, %d, %d",
+	  x0,y0,x1,y1,width,c,dotted,dashed));*/
 
         if (y1 > fb_plot_ctx.y1)
                 return true;
@@ -68,8 +68,8 @@
                 /* horizontal line special cased */
                 fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1);
 
-                LOG(("horiz: %d, %d, %d, %d, %d, 0x%lx, %d, %d",
-                     x0,y0,x1,y1,width,c,dotted,dashed));
+                /*LOG(("horiz: %d, %d, %d, %d, %d, 0x%lx, %d, %d",
+		  x0,y0,x1,y1,width,c,dotted,dashed));*/
 
                 pvideo = fb_16bpp_get_xy_loc(x0, y0, current_window);
 
@@ -83,7 +83,7 @@
                 if (!fb_plotters_clip_line_ctx(&x0, &y0, &x1, &y1))
                         return true; /* line outside clipping */
 
-                LOG(("%d, %d, %d, %d", x0,y0,x1,y1));
+                //LOG(("%d, %d, %d, %d", x0,y0,x1,y1));
 
                 /* the horizontal distance of the line */
                 dx = x1 - x0;

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.c?rev=5380&r1=5379&r2=5380&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.c Sat Sep 20 11:08:43 2008
@@ -50,29 +50,57 @@
 
 static void fb_queue_redraw(struct gui_window *g, int x0, int y0, int x1, int y1);
 
-static void window_scroll(struct gui_window *g) 
-{
-	if ((g->panx == 0) && (g->pany == 0))
-		return;
-
+static void fb_pan(struct gui_window *g) 
+{
+	struct content *c;
+
+        if (!g)
+                return;
+
+	c = g->bw->current_content;
+
+	if (!c) return;
+	if (c->locked) return;
+
+	LOG(("panning %d, %d",g->panx, g->pany));
+	/* dont pan off teh top or bottom */
 	if ((g->scrolly + g->pany) < 0)
 		g->pany = -g->scrolly;
 
-	if ((g->scrolly + g->pany) > g->bw->current_content->height)
-		g->pany = g->bw->current_content->height - g->scrolly;
-
+	if ((g->scrolly + g->pany) > c->height)
+		g->pany = c->height - g->scrolly;
+
+	LOG(("panning %d, %d",g->panx, g->pany));
+
+	/* pump up the volume. dance, dance! lets do it */
 	if (g->pany < 0) {
+		/* we cannot pan more than a window height at a time */
+		if (g->pany < -g->height)
+			g->pany = -g->height;
+
+		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);
 		g->scrolly += g->pany;
 		fb_queue_redraw(g, g->x, g->y, 
 				g->x + g->width, g->y - g->pany);
 	}
 	if (g->pany > 0) {
+		/* we cannot pan more than a window height at a time */
+		if (g->pany > g->height)
+			g->pany = g->height;
+
+		LOG(("panning down %d", g->pany));
+
 		fb_plotters_move_block(g->x, g->y + g->pany, g->width, g->height - g->pany, g->x, g->y);
 		g->scrolly += g->pany;
 		fb_queue_redraw(g, g->x, g->y + g->height - g->pany, 
 				g->x + g->width, g->y + g->height);
 	}
+
+	g->pan_required = false;
+	g->panx = 0;
+	g->pany = 0;
 }
 
 static void fb_redraw(struct gui_window *g)
@@ -86,8 +114,6 @@
 
 	if (!c) return;
 	if (c->locked) return;
-
-	window_scroll(g);
 
         content_redraw(c, 0, -g->scrolly, g->width, g->height,
                        g->redraw_box.x0, g->redraw_box.y0, g->redraw_box.x1, g->redraw_box.y1,
@@ -175,6 +201,9 @@
             redraws_pending = false;
 
             for (g = window_list; g != NULL; g = g->next) {
+                    if (g->pan_required == true) {
+                            fb_pan(g);
+                    }
                     if (g->redraw_required == true) {
                             fb_redraw(g);
                     }
@@ -276,7 +305,7 @@
         g->pany +=y;
 
         redraws_pending = true;
-	g->redraw_required = true;
+	g->pan_required = true;
 }
 
 void fb_window_scroll(struct gui_window *g, int x, int y) 

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.h?rev=5380&r1=5379&r2=5380&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.h Sat Sep 20 11:08:43 2008
@@ -51,6 +51,9 @@
 			       * needs to redraw the window.
 			       */
 	bbox_t redraw_box; /**< Area requiring redraw. */
+	bool pan_required; /**< flag indicating the foreground loop
+			       * needs to pan the window.
+			       */
 	int panx, pany; /**< Panning required. */
 };
 

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.c?rev=5380&r1=5379&r2=5380&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.c Sat Sep 20 11:08:43 2008
@@ -41,13 +41,21 @@
                                       ( (x) > (cx2) ? 2 : 0) |  \
                                       ( (x) < (cx1) ? 1 : 0) )
 
+#define SWAP(a, b) do { int t; t=(a); (a)=(b); (b)=t;  } while(0) 
+
+/* clip a rectangle to another rectangle */
 bool fb_plotters_clip_rect(const bbox_t *clip, 
                            int *x0, int *y0, int *x1, int *y1)
 {
-        char region1 = REGION(*x0, *y0,
-                               clip->x0, clip->x1, clip->y0, clip->y1);
-        char region2 = REGION(*x1, *y1,
-                               clip->x0, clip->x1, clip->y0, clip->y1);
+        char region1; 
+        char region2; 
+
+	if (*x1 < *x0) SWAP(*x0, *x1);
+
+	if (*y1 < *y0) SWAP(*y0, *y1);
+
+	region1 = REGION(*x0, *y0, clip->x0, clip->x1, clip->y0, clip->y1);
+	region2 = REGION(*x1, *y1, clip->x0, clip->x1, clip->y0, clip->y1);
 
         /* area lies entirely outside the clipping rectangle */
         if ((region1 | region2) && (region1 & region2))
@@ -163,7 +171,11 @@
 /* generic setting of clipping rectangle */
 bool fb_clip(int x0, int y0, int x1, int y1)
 {
-        LOG(("x0 %d, y0 %d, x1 %d, y1 %d", x0, y0, x1, y1));
+        //LOG(("x0 %d, y0 %d, x1 %d, y1 %d", x0, y0, x1, y1));
+
+	if (x1 < x0) SWAP(x0, x1);
+	if (y1 < y0) SWAP(y0, y1);
+
         fb_plot_ctx.x0 = x0;
         fb_plot_ctx.y0 = y0;
         fb_plot_ctx.x1 = x1;

Modified: branches/vince/netsurf-fb/framebuffer/fb_schedule.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_schedule.c?rev=5380&r1=5379&r2=5380&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_schedule.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_schedule.c Sat Sep 20 11:08:43 2008
@@ -141,8 +141,6 @@
 
 	gettimeofday(&tv, NULL);
 
-        LOG(("Banana"));
-
         while (cur_nscb != NULL) {
                 if (timercmp(&tv, &cur_nscb->tv, >)) {
                         /* scheduled time */




More information about the netsurf-commits mailing list