summaryrefslogtreecommitdiff
path: root/framebuffer/gui.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-03-16 20:37:44 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-03-16 20:37:44 +0000
commitf6501e2d38087ac5f320e4609ee6cca547a3b4eb (patch)
treeaceea8d9ce526939aced9360598f41a1fefd81cf /framebuffer/gui.c
parent5e9bdb16c6b937bc7ea1268765581128aa96fe1a (diff)
downloadnetsurf-f6501e2d38087ac5f320e4609ee6cca547a3b4eb.tar.gz
netsurf-f6501e2d38087ac5f320e4609ee6cca547a3b4eb.tar.bz2
Beginnings of scale support.
- No front end to set scale, only global option. - No input (mouse pos) scaling. - Scaled of pos for update_box (e.g. animation) is wrong. - Off-by-1 in scaled scroll panning. Perhaps we should look at moving all the scale logic into the core. svn path=/trunk/netsurf/; revision=12080
Diffstat (limited to 'framebuffer/gui.c')
-rw-r--r--framebuffer/gui.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 7838ab3ba..75750eb9d 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -117,6 +117,7 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser);
int content_height;
int height;
+ float scale = gw->bw->scale;
LOG(("window scroll"));
if (abs) {
@@ -126,7 +127,7 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
}
bwidget->pan_required = true;
- content_height = content_get_height(gw->bw->current_content);
+ content_height = content_get_height(gw->bw->current_content) * scale;
height = fbtk_get_height(gw->browser);
@@ -150,6 +151,7 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser);
int content_width;
int width;
+ float scale = gw->bw->scale;
if (abs) {
bwidget->panx = x - bwidget->scrollx;
@@ -158,7 +160,7 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
}
bwidget->pan_required = true;
- content_width = content_get_width(gw->bw->current_content);
+ content_width = content_get_width(gw->bw->current_content) * scale;
width = fbtk_get_width(gw->browser);
@@ -332,8 +334,9 @@ fb_redraw(fbtk_widget_t *widget,
clip.y1 = bwidget->redraw_box.y1;
browser_window_redraw(bw,
- x - bwidget->scrollx, y - bwidget->scrolly,
- &clip);
+ (x - bwidget->scrollx) / bw->scale,
+ (y - bwidget->scrolly) / bw->scale,
+ &clip);
current_redraw_browser = NULL;
@@ -1326,8 +1329,8 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
struct browser_widget_s *bwidget = fbtk_get_userpw(g->browser);
- *sx = bwidget->scrollx;
- *sy = bwidget->scrolly;
+ *sx = bwidget->scrollx / g->bw->scale;
+ *sy = bwidget->scrolly / g->bw->scale;
return true;
}
@@ -1339,8 +1342,8 @@ gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
assert(bwidget);
- widget_scroll_x(gw, sx, true);
- widget_scroll_y(gw, sy, true);
+ widget_scroll_x(gw, sx * gw->bw->scale, true);
+ widget_scroll_y(gw, sy * gw->bw->scale, true);
}
void
@@ -1386,15 +1389,25 @@ gui_window_get_dimensions(struct gui_window *g,
{
*width = fbtk_get_width(g->browser);
*height = fbtk_get_height(g->browser);
+
+ if (scaled) {
+ *width /= g->bw->scale;
+ *height /= g->bw->scale;
+ }
}
void
gui_window_update_extent(struct gui_window *gw)
{
- fbtk_set_scroll_parameters(gw->hscroll, 0, content_get_width(gw->bw->current_content), fbtk_get_width(gw->browser), 100);
+ float scale = gw->bw->scale;
- fbtk_set_scroll_parameters(gw->vscroll, 0, content_get_height(gw->bw->current_content), fbtk_get_height(gw->browser), 100);
+ fbtk_set_scroll_parameters(gw->hscroll, 0,
+ content_get_width(gw->bw->current_content) * scale,
+ fbtk_get_width(gw->browser), 100);
+ fbtk_set_scroll_parameters(gw->vscroll, 0,
+ content_get_height(gw->bw->current_content) * scale,
+ fbtk_get_height(gw->browser), 100);
}
void