summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-11-17 16:44:42 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-11-17 16:44:42 +0000
commitbb260da36e2408421c548f93cbfd28fc0052f50f (patch)
tree28d0e672f6c0d1732c561f1e833c5780d0489a16
parent64226af7488440725041e2ab1034cc735f16bb21 (diff)
downloadnetsurf-bb260da36e2408421c548f93cbfd28fc0052f50f.tar.gz
netsurf-bb260da36e2408421c548f93cbfd28fc0052f50f.tar.bz2
Turns out these were more correct the first time I wrote them.
-rw-r--r--desktop/frames.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/desktop/frames.c b/desktop/frames.c
index 6dd0d09b4..88d49f20c 100644
--- a/desktop/frames.c
+++ b/desktop/frames.c
@@ -66,8 +66,8 @@ void browser_window_scroll_callback(void *client_data,
struct rect rect_x;
struct rect rect_y;
struct rect copyrect;
- int dest_x = 0;
- int dest_y = 0;
+ int dest_x;
+ int dest_y;
int cur_x = scrollbar_get_offset(bw->scroll_x);
int cur_y = scrollbar_get_offset(bw->scroll_y);
@@ -77,41 +77,41 @@ void browser_window_scroll_callback(void *client_data,
rect_x.y1 = bw->height;
if(cur_y > bw->prev_scroll_y) {
- copyrect.y0 = cur_y - bw->prev_scroll_y;
- copyrect.y1 = bw->height;
- dest_y = 0;
+ copyrect.y0 = cur_y;
+ copyrect.y1 = copyrect.y0 + bw->height - (cur_y - bw->prev_scroll_y);
+ dest_y = bw->prev_scroll_y;
- rect_y.y0 = bw->height - copyrect.y0;
- rect_y.y1 = bw->height;
+ rect_y.y0 = copyrect.y0;
+ rect_y.y1 = copyrect.y0 + bw->height - (cur_y - bw->prev_scroll_y);
rect_x.y0 = 0;
rect_x.y1 = rect_y.y0;
} else {
- copyrect.y0 = 0;
- copyrect.y1 = bw->height - (cur_y - bw->prev_scroll_y);
- dest_y = cur_y - bw->prev_scroll_y;
+ copyrect.y0 = bw->prev_scroll_y;
+ copyrect.y1 = copyrect.y0 + bw->height - (bw->prev_scroll_y - cur_y);
+ dest_y = cur_y;
- rect_y.y0 = 0;
- rect_y.y1 = cur_y - bw->prev_scroll_y;
+ rect_y.y0 = cur_y;
+ rect_y.y1 = cur_y + bw->height - (bw->prev_scroll_y - cur_y);
rect_x.y0 = rect_y.y1;
rect_x.y1 = bw->height;
}
if(cur_x > bw->prev_scroll_x) {
- copyrect.x0 = cur_x - bw->prev_scroll_x;
- copyrect.x1 = bw->width;
- dest_x = 0;
+ copyrect.x0 = cur_x;
+ copyrect.x1 = copyrect.x0 + bw->width - (cur_x - bw->prev_scroll_x);
+ dest_x = bw->prev_scroll_x;
- rect_x.x0 = bw->height - copyrect.x0;
- rect_x.x1 = bw->height;
+ rect_x.x0 = copyrect.x0;
+ rect_x.x1 = copyrect.x0 + bw->width - (cur_x - bw->prev_scroll_x);
} else {
- copyrect.x0 = 0;
- copyrect.x1 = bw->width - (cur_x - bw->prev_scroll_x);
- dest_x = cur_x - bw->prev_scroll_x;
+ copyrect.x0 = bw->prev_scroll_x;
+ copyrect.x1 = copyrect.x0 + bw->width - (bw->prev_scroll_x - cur_x);
+ dest_x = cur_x;
- rect_x.x0 = 0;
- rect_x.x1 = cur_x - bw->prev_scroll_x;
+ rect_x.x0 = cur_x;
+ rect_x.x1 = cur_x + bw->width - (bw->prev_scroll_x - cur_x);
}
browser_window_copy_box(bw, &copyrect, dest_x, dest_y);