From ea291554639000d1bd3336ad4e607f32b638f5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 12 Feb 2024 22:38:42 +0100 Subject: [PATCH] Code cleanup --- src/map/IMG/rastertile.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index 142aba69..ee4e67b1 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -17,6 +17,11 @@ using namespace IMG; #define AREA(rect) \ (rect.size().width() * rect.size().height()) +#define HIDPI_IMG(dir, basename, ratio) \ + (((ratio) > 1.0) \ + ? QImage(dir "/" basename "@2x.png") \ + : QImage(dir "/" basename ".png")) + #define ROAD 0 #define WATER 1 @@ -446,10 +451,8 @@ void RasterTile::render() QList textItems; QImage arrows[2]; - arrows[ROAD] = (_ratio > 1.0) - ? QImage(":/map/arrow@2x.png") : QImage(":/map/arrow.png"); - arrows[WATER] = (_ratio > 1.0) - ? QImage(":/map/water-arrow@2x.png") : QImage(":/map/water-arrow.png"); + arrows[ROAD] = HIDPI_IMG(":/map", "arrow", _ratio); + arrows[WATER] = HIDPI_IMG(":/map", "water-arrow", _ratio); fetchData(polygons, lines, points); ll2xy(polygons);