Suppress baseDPI and baseHiDPI hardcoded values

Should fix the issue reported here :
https://discuss.pixls.us/t/test-rawtherapee-5-6-rc1/12073/13
This commit is contained in:
Hombre57 2019-04-11 22:23:07 +02:00
parent bb58e65ffc
commit d01d99481d
5 changed files with 15 additions and 15 deletions

View File

@ -56,7 +56,7 @@ void CursorManager::init (Glib::RefPtr<Gdk::Window> mainWindow)
Glib::RefPtr<Gdk::Pixbuf> rotate = RTImage::createPixbufFromFile("rotate-aroundnode-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> wait = RTImage::createPixbufFromFile("gears.png"); // Currently unused, create *-hicontrast once used.
double s = RTScalable::getTweakedDPI() / 96.; // RTScalable::getDPI() might be preferable, however it imply a lot of work to support this option
double s = RTScalable::getTweakedDPI() / RTScalable::baseDPI; // RTScalable::getDPI() might be preferable, however it imply a lot of work to support this option
cAdd = add ? Gdk::Cursor::create(display, add, (int)(8.*s), (int)(8.*s)) : Gdk::Cursor::create(display, Gdk::PLUS);
cAddPicker = colPickAdd ? Gdk::Cursor::create(display, colPickAdd, (int)(4.*s), (int)(21.*s)) : Gdk::Cursor::create(display, Gdk::PLUS);

View File

@ -51,7 +51,7 @@ EditWindow* EditWindow::getInstance(RTWindow* p, bool restore)
return &instance_.editWnd;
}
EditWindow::EditWindow (RTWindow* p) : resolution(96.), parent(p) , isFullscreen(false), isClosed(true)
EditWindow::EditWindow (RTWindow* p) : resolution(RTScalable::baseDPI), parent(p) , isFullscreen(false), isClosed(true)
{
updateResolution();
@ -128,7 +128,7 @@ bool EditWindow::updateResolution()
double res = get_screen()->get_resolution();
if (scale == 2) {
// from Windows' behavior : if scale==2, resolution = 192. (Gtk shows 96 dpi !?), there's no higher value
res = 192.;
res = RTScalable::baseHiDPI;
}
bool retVal = res != resolution;
resolution = res;
@ -141,11 +141,11 @@ void EditWindow::setAppIcon()
bool downsize = false;
// findIconAbsolutePath won't be able to select the image based on resolution with the
// storage of the images, we're doing the selection here
if (resolution == 96.) {
if (resolution == RTScalable::baseDPI) {
fName = "rawtherapee-logo-24.png";
} else {
fName = "rawtherapee-logo-48.png";
if (resolution < 192.) {
if (resolution < RTScalable::baseHiDPI) {
downsize = true;
}
}
@ -155,7 +155,7 @@ void EditWindow::setAppIcon()
return;
}
if (downsize) {
int size = int((48. * resolution) / 192.);
int size = int((48. * resolution) / RTScalable::baseHiDPI);
pixbuf->scale_simple(size, size, Gdk::InterpType::INTERP_BILINEAR);
}

View File

@ -225,7 +225,7 @@ Cairo::RefPtr<Cairo::ImageSurface> RTScalable::loadImage(const Glib::ustring &fn
RsvgDimensionData dim;
rsvg_handle_get_dimensions(handle, &dim);
double r = dpi / 96.;
double r = dpi / baseDPI;
Cairo::RefPtr<Cairo::ImageSurface> surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, (int)(dim.width * r + 0.499), (int)(dim.height * r + 0.499));
Cairo::RefPtr<Cairo::Context> c = Cairo::Context::create(surf);
c->set_source_rgba (0., 0., 0., 0.);

View File

@ -40,11 +40,11 @@ protected:
public:
#ifdef __APPLE__
static constexpr double baseDPI = 72;
static constexpr double baseHiDPI = 144;
static constexpr double baseDPI = 72.;
static constexpr double baseHiDPI = 144.;
#else
static constexpr double baseDPI = 96;
static constexpr double baseHiDPI = 192;
static constexpr double baseDPI = 96.;
static constexpr double baseHiDPI = 192.;
#endif
static void init(Gtk::Window *window);

View File

@ -109,7 +109,7 @@ RTWindow::RTWindow ()
#if defined(__APPLE__)
// This will force screen resolution regarding font, but I don't think it's compliant with Gtk guidelines...
// Do not confuse with screen scaling, where everything is scaled up !
screen->set_resolution (96.);
screen->set_resolution (RTScalable::baseDPI);
#endif
Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create (THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS);
@ -184,7 +184,7 @@ RTWindow::RTWindow ()
int resolution = (int)style->get_screen()->get_resolution();
if (isPix) {
// HOMBRE: guessing here...
// if resolution is lower than 192ppi, we're supposing that it's already expressed in a scale==1 scenario
// if resolution is lower than baseHiDPI, we're supposing that it's already expressed in a scale==1 scenario
if (resolution >= int(RTScalable::baseHiDPI)) {
// converting the resolution to a scale==1 scenario
resolution /= 2;
@ -192,7 +192,7 @@ RTWindow::RTWindow ()
// 1pt = 1/72in @ 96 ppi
// HOMBRE: If the font unit is px, is it already scaled up to match the resolution ?
// px >inch >pt >"scaled pt"
pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (RTScalable::baseHiDPI / resolution) + 0.49);
pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (RTScalable::baseDPI / resolution) + 0.49);
} else {
pt = fontSize / Pango::SCALE;
}