From 11b3bb228adeec80612da1d60df4ab9c11cb7037 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 17 Jul 2011 14:48:19 +0000 Subject: Correct aspect ratio correctly and support widescreen displays svn path=/trunk/netsurf/; revision=12607 --- amiga/dist/NetSurf.guide | 1 + amiga/font.c | 19 ++++++++++++++----- amiga/options.h | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide index 7215f2378..f387588b8 100755 --- a/amiga/dist/NetSurf.guide +++ b/amiga/dist/NetSurf.guide @@ -43,6 +43,7 @@ There are a couple of Amiga-specific options which can only be changed directly @{b}printer_unit@{ub} Specifies which printer.device unit to print to @{b}drag_save_icons@{ub} Enables displaying Workbench-style transparent icons under the pointer when performing drag saves (ctrl-drag of objects available if NetSurf is running on the Workbench screen) and text selection drags. If set to 0 the pointer style will change instead. OS 4.0 users may want to set this to 0 as icons will appear opaque and obscure the drop position. @{b}cairo_renderer@{ub} Set rendering engine (SObjs version only). 0 = graphics.library, 1 = Cairo/graphics.library mixed (recommended), 2 = Full Cairo. +@{b}widescreen@{ub} Correct aspect ratio for widescreen displays. @{b}url_file@{ub} Path to URL database file @{b}hotlist_file@{ub} Path to Hotlist file diff --git a/amiga/font.c b/amiga/font.c index ab4af75fb..c4ea0e514 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -657,7 +657,6 @@ void ami_font_setdevicedpi(int id) { DisplayInfoHandle dih; struct DisplayInfo dinfo; - Point dinfo_res; ULONG ydpi = option_amiga_ydpi; ULONG xdpi = option_amiga_ydpi; @@ -670,11 +669,21 @@ void ami_font_setdevicedpi(int id) if(GetDisplayInfoData(dih, &dinfo, sizeof(struct DisplayInfo), DTAG_DISP, 0)) { - dinfo_res = dinfo.Resolution; - xdpi = (dinfo_res.x / dinfo_res.y) * ydpi; + int xres = dinfo.Resolution.x; + int yres = dinfo.Resolution.y; - LOG(("XDPI = %ld, YDPI = %ld (DisplayInfo resolution %ld x %ld)", - xdpi, ydpi, dinfo_res.x , dinfo_res.y)); + if(option_widescreen) + { + /* AmigaOS sees 4:3 modes as square in the DisplayInfo database, + * so we correct 16:10 modes to square for widescreen displays. */ + xres = (xres * 16) / 4; + yres = (yres * 10) / 3; + } + + xdpi = (yres * ydpi) / xres; + + LOG(("XDPI = %ld, YDPI = %ld (DisplayInfo resolution %ld x %ld, corrected %ld x %ld)", + xdpi, ydpi, dinfo.Resolution.x, dinfo.Resolution.y, xres, yres)); } } } diff --git a/amiga/options.h b/amiga/options.h index ec650ff86..97c69f76e 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -66,6 +66,7 @@ extern int option_cookies_window_ysize; extern int option_cairo_renderer; extern bool option_direct_render; extern int option_amiga_ydpi; +extern bool option_widescreen; #define EXTRA_OPTION_DEFINE \ char *option_url_file = 0; \ @@ -114,6 +115,7 @@ int option_cookies_window_ysize = 0; \ int option_cairo_renderer = 1; \ bool option_direct_render = false; \ int option_amiga_ydpi = 72; \ +bool option_widescreen = false; \ #define EXTRA_OPTION_TABLE \ { "url_file", OPTION_STRING, &option_url_file }, \ @@ -161,5 +163,6 @@ int option_amiga_ydpi = 72; \ { "cookies_window_ysize", OPTION_INTEGER, &option_cookies_window_ysize}, \ { "cairo_renderer", OPTION_INTEGER, &option_cairo_renderer}, \ { "direct_render", OPTION_BOOL, &option_direct_render}, \ -{ "amiga_ydpi", OPTION_INTEGER, &option_amiga_ydpi}, +{ "amiga_ydpi", OPTION_INTEGER, &option_amiga_ydpi}, \ +{ "widescreen", OPTION_BOOL, &option_widescreen}, #endif -- cgit v1.2.3