Browse Source

Fix some DPI scale calculations to work with depth-only rendering.

Alex Szpakowski 7 years ago
parent
commit
a2454d74cd
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/modules/graphics/Graphics.cpp

+ 3 - 5
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();
 }