diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-08-05 14:54:31 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-08-05 14:54:31 +0200 |
commit | 23ceaf7d6657b07116d9e4b1512ecda55e188917 (patch) | |
tree | 1c82e78c1db5318cf293fe73c9a58ba84c95c954 /src | |
parent | 86e137664c7f045d73c1cff3adca63f3ef7690f7 (diff) | |
download | qtlocation-mapboxgl-23ceaf7d6657b07116d9e4b1512ecda55e188917.tar.gz |
code style fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/text/collision.cpp | 10 | ||||
-rw-r--r-- | src/text/placement.cpp | 11 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/text/collision.cpp b/src/text/collision.cpp index 0999b995d4..4621423569 100644 --- a/src/text/collision.cpp +++ b/src/text/collision.cpp @@ -136,8 +136,8 @@ float Collision::getPlacementScale(const GlyphBoxes &glyphs, float minPlacementS const Box searchBox = getBox(anchor, bbox, minScale, maxScale); std::vector<PlacementValue> blocking; - ((Tree *)cTree)->query(bgi::intersects(searchBox), std::back_inserter(blocking)); ((Tree *)hTree)->query(bgi::intersects(searchBox), std::back_inserter(blocking)); + ((Tree *)cTree)->query(bgi::intersects(searchBox), std::back_inserter(blocking)); if (blocking.size()) { const CollisionAnchor &na = anchor; // new anchor @@ -175,12 +175,14 @@ float Collision::getPlacementScale(const GlyphBoxes &glyphs, float minPlacementS s3 = s4 = 1; } - float collisionFreeScale = std::fmin(std::fmax(s1, s2), std::fmax(s3, s4)); + const float collisionFreeScale = std::fmin(std::fmax(s1, s2), std::fmax(s3, s4)); // Only update label's min scale if the glyph was // restricted by a collision - if (collisionFreeScale > minPlacementScale && collisionFreeScale > minScale && - collisionFreeScale < maxScale && collisionFreeScale < placement.maxScale) { + if (collisionFreeScale > minPlacementScale && + collisionFreeScale > minScale && + collisionFreeScale < maxScale && + collisionFreeScale < placement.maxScale) { minPlacementScale = collisionFreeScale; } diff --git a/src/text/placement.cpp b/src/text/placement.cpp index 7652327782..26cc9f70f7 100644 --- a/src/text/placement.cpp +++ b/src/text/placement.cpp @@ -210,9 +210,6 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const Placement placement; - PlacedGlyphs &glyphs = placement.shapes; - GlyphBoxes &boxes = placement.boxes; - const uint32_t buffer = 3; for (const PositionedGlyph &shape : shaping) { @@ -281,7 +278,7 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const const float glyphMinScale = std::max(instance.minScale, anchor.scale); // Remember the glyph for later insertion. - glyphs.emplace_back( + placement.shapes.emplace_back( tl, tr, bl, br, rect, float(std::fmod((anchor.angle + rotate + instance.offset + 2 * M_PI), (2 * M_PI))), instance.anchor, glyphMinScale, instance.maxScale); @@ -294,18 +291,18 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const boxScale * util::max(tl.x, tr.x, bl.x, br.x), boxScale * util::max(tl.y, tr.y, bl.y, br.y)}; } - boxes.emplace_back(box, instance.anchor, glyphMinScale, instance.maxScale, padding); + placement.boxes.emplace_back(box, instance.anchor, glyphMinScale, instance.maxScale, padding); } } } // TODO avoid creating the boxes in the first place? if (horizontal) - boxes = {getMergedBoxes(boxes, anchor)}; + placement.boxes = {getMergedBoxes(placement.boxes, anchor)}; const float minPlacementScale = anchor.scale; placement.minScale = std::numeric_limits<float>::infinity(); - for (const GlyphBox &box : boxes) { + for (const GlyphBox &box : placement.boxes) { placement.minScale = util::min(placement.minScale, box.minScale); } placement.minScale = util::max(minPlacementScale, Placement::globalMinScale); |