summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <[email protected]>2016-07-13 03:41:05 +0200
committerFriedrich W. H. Kossebau <[email protected]>2016-07-13 03:41:05 +0200
commit40d1320916d0ec0ffaafaf060b8b1215321dfcc6 (patch)
tree3a0ff86a9100996be034afaffc550ff74026cd00
parentce2a39baca9842145a0df8a41560dc048139836c (diff)
Move fixed calculation out of loop
-rw-r--r--src/lib/marble/PlacemarkLayout.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/marble/PlacemarkLayout.cpp b/src/lib/marble/PlacemarkLayout.cpp
index c3b5caa..a6a5230 100644
--- a/src/lib/marble/PlacemarkLayout.cpp
+++ b/src/lib/marble/PlacemarkLayout.cpp
@@ -668,14 +668,15 @@ QRectF PlacemarkLayout::roomForLabel( const GeoDataStyle::ConstPtr &style,
}
else if (style->labelStyle().alignment() == GeoDataLabelStyle::Right)
{
+ const int symbolWidth = style->iconStyle().icon().width();
+ const qreal startY = y - textHeight/2;
+ const qreal xPos = x + symbolWidth / 2 + 1;
+
// Check up to seven vertical positions (center, +3, -3 from center)
for(int i=0; i<7; ++i)
{
- const int symbolWidth = style->iconStyle().icon().width();
- const qreal startY = y - textHeight/2;
const qreal increase = (i/2) * (textHeight + 1); //intentional integer arithmetics
const qreal direction = (i%2 == 0 ? 1 : -1);
- const qreal xPos = x + symbolWidth / 2 + 1;
const qreal yPos = startY + increase*direction;
const QRectF labelRect = QRectF(xPos, yPos, textWidth, textHeight);