r5378 vince - in /branches/vince/netsurf-fb/framebuffer: fb_frontend_linuxfb.c fb_gui.c fb_gui.h

netsurf at semichrome.net netsurf at semichrome.net
Sat Sep 20 14:46:46 BST 2008


Author: vince
Date: Sat Sep 20 08:46:46 2008
New Revision: 5378

URL: http://source.netsurf-browser.org?rev=5378&view=rev
Log:
fix redraw issues with scrolling

Modified:
    branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c
    branches/vince/netsurf-fb/framebuffer/fb_gui.c
    branches/vince/netsurf-fb/framebuffer/fb_gui.h

Modified: branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c?rev=5378&r1=5377&r2=5378&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c Sat Sep 20 08:46:46 2008
@@ -582,11 +582,11 @@
 
                         switch (event.code) {
                         case KEY_J:
-				fb_window_scroll(g, 100);
+				fb_window_scroll(g, 0, 100);
                                 break;
 
                         case KEY_K:
-				fb_window_scroll(g, -100);
+				fb_window_scroll(g, 0, -100);
                                 break;
 
                         case KEY_Q:
@@ -652,7 +652,7 @@
 					break;
 
 				case 8:
-					fb_window_scroll(g, event.value * -100);
+					fb_window_scroll(g, 0, event.value * -100);
 					break;
                                 }
                                 break;

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.c?rev=5378&r1=5377&r2=5378&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.c Sat Sep 20 08:46:46 2008
@@ -48,6 +48,33 @@
 
 framebuffer_t *framebuffer;
 
+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;
+
+	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->pany < 0) {
+		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) {
+		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);
+	}
+}
+
 static void fb_redraw(struct gui_window *g)
 {
 	struct content *c;
@@ -59,6 +86,8 @@
 
 	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,
@@ -67,6 +96,8 @@
 	g->redraw_required = false;
         g->redraw_box.y0 = g->redraw_box.x0 = INT_MAX;
         g->redraw_box.y1 = g->redraw_box.x1 = -(INT_MAX);
+	g->panx = 0;
+	g->pany = 0;
         redraws_pending = false;
 }
 
@@ -239,7 +270,7 @@
 {
 	if (!g) return;
 
-        LOG(("%p, %d, %d, %d, %d", g, x0 , y0, x1, y1));
+        LOG(("%p, x %d, y %d", g, x , y));
 
         g->panx +=x;
         g->pany +=y;
@@ -248,26 +279,9 @@
 	g->redraw_required = true;
 }
 
-void fb_window_scroll(struct gui_window *g, int scrollby) 
-{
-	if ((g->scrolly + scrollby) < 0)
-		scrollby = -g->scrolly;
-
-	if ((g->scrolly + scrollby) > g->bw->current_content->height)
-		scrollby = g->bw->current_content->height - g->scrolly;
-
-	if (scrollby < 0) {
-		fb_plotters_move_block(g->x, g->y, g->width, g->height + scrollby, g->x, g->y - scrollby);
-		g->scrolly += scrollby;
-		fb_queue_redraw(g, g->x, g->y, 
-				g->x + g->width, g->y - scrollby);
-	}
-	if (scrollby > 0) {
-		fb_plotters_move_block(g->x, g->y + scrollby, g->width, g->height - scrollby, g->x, g->y);
-		g->scrolly += scrollby;
-		fb_queue_redraw(g, g->x, g->y + g->height - scrollby, 
-				g->x + g->width, g->y + g->height);
-	}
+void fb_window_scroll(struct gui_window *g, int x, int y) 
+{
+	fb_queue_pan(g, x, y);
 }
 
 void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.h?rev=5378&r1=5377&r2=5378&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.h Sat Sep 20 08:46:46 2008
@@ -27,31 +27,41 @@
 } bbox_t;
 
 typedef struct framebuffer_s {
-    int width;
-    int height;
-    uint8_t *ptr; /**< Base of video memory. */
-    int linelen; /**< length of a video line. */
-    int bpp;
-    colour palette[256]; /* palette for index modes */
-    fb_cursor_t *cursor;
+	int width;
+	int height;
+	uint8_t *ptr; /**< Base of video memory. */
+	int linelen; /**< length of a video line. */
+	int bpp;
+	colour palette[256]; /* palette for index modes */
+	fb_cursor_t *cursor;
 } framebuffer_t;
 
 struct gui_window {
-    int x;
-    int y;
-    int width; /**< Window width */
-    int height; /**< window height */
+	struct gui_window *next, *prev; /**< List of windows */
+	struct browser_window *bw; /**< The browser window connected to this gui window */
 
-    bbox_t redraw_box;
-    int scrolly; /**< y scroll offset */
-    bool redraw_required; /**< flag indicating the foreground loop needs to redraw the window */
-    struct browser_window *bw; /* The browser window connected to this gui window */
+	int x;
+	int y;
+	int width; /**< Window width */
+	int height; /**< window height */
+	int scrollx, scrolly; /**< scroll offsets. */
 
-    struct gui_window *next, *prev;
+	/* Pending window redraw state. */
+	bool redraw_required; /**< flag indicating the foreground loop
+			       * needs to redraw the window.
+			       */
+	bbox_t redraw_box; /**< Area requiring redraw. */
+	int panx, pany; /**< Panning required. */
 };
 
 extern framebuffer_t *framebuffer;
 extern struct gui_window *current_window;
 
 /* scroll a window */
-void fb_window_scroll(struct gui_window *g, int scrollby);
+void fb_window_scroll(struct gui_window *g, int x, int y);
+
+/*
+ * Local Variables:
+ * c-basic-offset:8
+ * End:
+ */




More information about the netsurf-commits mailing list