From a2454d74cda161b0439638a644e17ad93ef39ed1 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 21 Jan 2018 17:35:57 -0400 Subject: [PATCH] Fix some DPI scale calculations to work with depth-only rendering. --- src/modules/graphics/Graphics.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 3befca862..38543fb4a 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -334,11 +334,9 @@ int Graphics::getPixelHeight() const double Graphics::getCurrentDPIScale() const { - if (states.back().renderTargets.colors.size() > 0) - { - Canvas *c = states.back().renderTargets.getFirstTarget().canvas.get(); - return (double) c->getPixelHeight() / (double) c->getHeight(); - } + const auto &rt = states.back().renderTargets.getFirstTarget(); + if (rt.canvas.get()) + return rt.canvas->getDPIScale(); return getScreenDPIScale(); }