r13504 chris_y - /trunk/netsurf/amiga/gui.c

netsurf at semichrome.net netsurf at semichrome.net
Sat Mar 3 15:41:14 GMT 2012


Author: chris_y
Date: Sat Mar  3 09:41:14 2012
New Revision: 13504

URL: http://source.netsurf-browser.org?rev=13504&view=rev
Log:
Fix offsets when page scaled and scrolled

Modified:
    trunk/netsurf/amiga/gui.c

Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=13504&r1=13503&r2=13504&view=diff
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Sat Mar  3 09:41:14 2012
@@ -3220,6 +3220,8 @@
 {
 	int x, y;
 	struct rect clip;
+	int tile_x_scale = (int)(option_redraw_tile_size_x / gwin->bw->scale);
+	int tile_y_scale = (int)(option_redraw_tile_size_y / gwin->bw->scale);
 
 	if(top < 0) {
 		height += top;
@@ -3251,21 +3253,23 @@
 
 //printf("%ld %ld %ld %ld\n",left, top, width, height);
 
-	for(y = top; y < (top + height); y += option_redraw_tile_size_y) {
+	for(y = top; y < (top + height); y += tile_y_scale) {
 		clip.y0 = 0;
 		clip.y1 = option_redraw_tile_size_y;
-		if(((top + height) - y) < option_redraw_tile_size_y) clip.y1 = (top + height) - y;
-
-		for(x = left; x < (left + width); x += option_redraw_tile_size_x) {
+		if((((y - sy) * gwin->bw->scale) + clip.y1) > bbox->Height)
+			clip.y1 = bbox->Height - ((y - sy) * gwin->bw->scale);
+
+		for(x = left; x < (left + width); x += tile_x_scale) {
 			clip.x0 = 0;
 			clip.x1 = option_redraw_tile_size_x;
-			if(((left + width) - x) < option_redraw_tile_size_x) clip.x1 = (left + width) - x;
-
-//printf("%ld %ld -> %ld %ld\n",clip.x0 - (int)(x / gwin->bw->scale), clip.y0 - (int)(y / gwin->bw->scale), clip.x1, clip.y1);
+			if((((x - sx) * gwin->bw->scale) + clip.x1) > bbox->Width)
+				clip.x1 = bbox->Width - ((x - sx) * gwin->bw->scale);
+
+//printf("%ld %ld -> %ld %ld\n",clip.x0 - (int)(x), clip.y0 - (int)(y), clip.x1, clip.y1);
 
 			if(browser_window_redraw(gwin->bw,
-				clip.x0 - (int)(x / gwin->bw->scale),
-				clip.y0 - (int)(y / gwin->bw->scale),
+				clip.x0 - (int)x,
+				clip.y0 - (int)y,
 				&clip, ctx))
 			{
 				ami_clearclipreg(&browserglob);
@@ -3276,10 +3280,10 @@
 					BLITA_SrcY, 0,
 					BLITA_DestType, BLITT_RASTPORT, 
 					BLITA_Dest, gwin->win->RPort,
-					BLITA_DestX, bbox->Left + x - sx,
-					BLITA_DestY, bbox->Top + y - sy,
-					BLITA_Width, clip.x1,
-					BLITA_Height, clip.y1,
+					BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->bw->scale),
+					BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->bw->scale),
+					BLITA_Width, (int)(clip.x1),
+					BLITA_Height, (int)(clip.y1),
 					TAG_DONE);
 			}
 		}
@@ -3329,11 +3333,6 @@
 
 	GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
 
-	x0 *= g->shared->bw->scale;
-	x1 *= g->shared->bw->scale;
-	y0 *= g->shared->bw->scale;
-	y1 *= g->shared->bw->scale;
-
 	ami_do_redraw_tiled(g->shared, x0, y0, x1 - x0, y1 - y0, sx, sy, bbox, &ctx);
 	return;
 }
@@ -3401,7 +3400,7 @@
 
  		if(g->new_content) g->redraw_scroll = false;
 
-		//if(g->bw->scale != 1.0) g->redraw_scroll = false;
+		if(g->bw->scale != 1.0) g->redraw_scroll = false;
 	}
 
 	if(g->redraw_scroll)




More information about the netsurf-commits mailing list