summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-10 19:01:52 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-10 19:06:58 (GMT)
commit207765fd428ec313bd2a5a87eaca57f5adaf9cc9 (patch)
treef3ef31613a3ebeb768e7d6314f3255c0daaee5ee
parent4f89f8ea3c72354e3814a36a1076d62f3ef982f5 (diff)
DPI aware switch between fake 3D modes
The less accurate, but faster mode is activated earlier now on mobile devices.
-rw-r--r--src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
index 7a23303..e40a8ae 100644
--- a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
@@ -20,6 +20,9 @@
#include "OsmPlacemarkData.h"
#include "GeoPainter.h"
+#include <QScreen>
+#include <QApplication>
+
namespace Marble
{
@@ -62,9 +65,13 @@ void BuildingGeoPolygonGraphicsItem::initializeBuildingPainting(const GeoPainter
drawAccurate3D = false;
isCameraAboveBuilding = false;
+ auto const screen = QApplication::screens().first();
+ double const physicalSize = 1.0; // mm
+ int const pixelSize = qRound(physicalSize * screen->physicalDotsPerInch() / (IN2M * M2MM));
+
QPointF offsetAtCorner = buildingOffset(QPointF(0, 0), viewport, &isCameraAboveBuilding);
qreal maxOffset = qMax( qAbs( offsetAtCorner.x() ), qAbs( offsetAtCorner.y() ) );
- drawAccurate3D = painter->mapQuality() == HighQuality ? maxOffset > 5.0 : maxOffset > 8.0;
+ drawAccurate3D = painter->mapQuality() == HighQuality ? maxOffset > pixelSize : maxOffset > 1.5 * pixelSize;
}
void BuildingGeoPolygonGraphicsItem::updatePolygons( const ViewportParams *viewport,