From c409b8bebaeb72f8c95514ed3c01fd173fb0d98b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 13 Nov 2018 18:45:02 +0100 Subject: gl: Calculate accurate initial window size when scaling to fit screen. --- platform/gl/gl-main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index 1910f1b3..7a2ac0a4 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -1587,9 +1587,17 @@ int main(int argc, char **argv) sx = sy; if (sx < 1) { + fz_irect area; + currentzoom *= sx; - page_tex.w *= sx; - page_tex.h *= sx; + + /* compute bounds here for initial window size */ + page_bounds = fz_bound_page(ctx, fzpage); + transform_page(); + + area = fz_irect_from_rect(draw_page_bounds); + page_tex.w = area.x1 - area.x0; + page_tex.h = area.y1 - area.y0; } ui_init(page_tex.w, page_tex.h, "MuPDF: Loading..."); -- cgit v1.2.3