summaryrefslogtreecommitdiff
path: root/src/mbgl/text
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-27 18:30:35 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-30 23:37:44 +0300
commit94d1c10727ceb2c0e245aeb3c255102da185440c (patch)
tree2f93534ca3dac24b3d3f566faa0b11fbf72177b9 /src/mbgl/text
parent2ca3fc24a1eedda8fb6fed1fa56033717376e0d7 (diff)
downloadqtlocation-mapboxgl-94d1c10727ceb2c0e245aeb3c255102da185440c.tar.gz
[core] Fix readability-* errors
As reported by clang-tidy-8.
Diffstat (limited to 'src/mbgl/text')
-rw-r--r--src/mbgl/text/collision_feature.hpp2
-rw-r--r--src/mbgl/text/collision_index.cpp3
-rw-r--r--src/mbgl/text/collision_index.hpp4
-rw-r--r--src/mbgl/text/get_anchors.cpp12
-rw-r--r--src/mbgl/text/glyph_pbf.cpp8
-rw-r--r--src/mbgl/text/placement.hpp6
-rw-r--r--src/mbgl/text/shaping.cpp32
-rw-r--r--src/mbgl/text/shaping.hpp30
8 files changed, 51 insertions, 46 deletions
diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp
index af9931a031..40f0f5faba 100644
--- a/src/mbgl/text/collision_feature.hpp
+++ b/src/mbgl/text/collision_feature.hpp
@@ -143,7 +143,7 @@ private:
GeometryCoordinate& anchorPoint,
std::size_t segment,
const float length,
- const float height,
+ const float boxSize,
const float overscaling);
};
diff --git a/src/mbgl/text/collision_index.cpp b/src/mbgl/text/collision_index.cpp
index 20cb6514b6..cd854db3b6 100644
--- a/src/mbgl/text/collision_index.cpp
+++ b/src/mbgl/text/collision_index.cpp
@@ -191,7 +191,8 @@ std::pair<bool, bool> CollisionIndex::placeLineFeature(
// equivalent to pixel_to_tile_units
const auto pixelsToTileUnits = 1 / (textPixelRatio * scale);
- float firstTileDistance = 0, lastTileDistance = 0;
+ float firstTileDistance = 0.f;
+ float lastTileDistance = 0.f;
if (firstAndLastGlyph) {
firstTileDistance = approximateTileDistance(*(firstAndLastGlyph->first.tileDistance), firstAndLastGlyph->first.angle, pixelsToTileUnits, projectedAnchor.second, pitchWithMap);
lastTileDistance = approximateTileDistance(*(firstAndLastGlyph->second.tileDistance), firstAndLastGlyph->second.angle, pixelsToTileUnits, projectedAnchor.second, pitchWithMap);
diff --git a/src/mbgl/text/collision_index.hpp b/src/mbgl/text/collision_index.hpp
index dd1da03bdb..b88a8623e8 100644
--- a/src/mbgl/text/collision_index.hpp
+++ b/src/mbgl/text/collision_index.hpp
@@ -53,8 +53,8 @@ public:
private:
bool isOffscreen(const CollisionBoundaries&) const;
bool isInsideGrid(const CollisionBoundaries&) const;
- bool isInsideTile(const CollisionBoundaries& box, const CollisionBoundaries& tileBoundaries) const;
- bool overlapsTile(const CollisionBoundaries& box, const CollisionBoundaries& tileBoundaries) const;
+ bool isInsideTile(const CollisionBoundaries& boundaries, const CollisionBoundaries& tileBoundaries) const;
+ bool overlapsTile(const CollisionBoundaries& boundaries, const CollisionBoundaries& tileBoundaries) const;
std::pair<bool, bool> placeLineFeature(
const CollisionFeature& feature,
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp
index c8f5f470b4..222e744d2f 100644
--- a/src/mbgl/text/get_anchors.cpp
+++ b/src/mbgl/text/get_anchors.cpp
@@ -51,9 +51,9 @@ static Anchors resample(const GeometryCoordinates& line,
while (markedDistance + spacing < distance + segmentDist) {
markedDistance += spacing;
- float t = (markedDistance - distance) / segmentDist,
- x = util::interpolate(float(a.x), float(b.x), t),
- y = util::interpolate(float(a.y), float(b.y), t);
+ float t = (markedDistance - distance) / segmentDist;
+ float x = util::interpolate(float(a.x), float(b.x), t);
+ float y = util::interpolate(float(a.y), float(b.y), t);
// Check that the point is within the tile boundaries and that
// the label would fit before the beginning and end of the line
@@ -157,9 +157,9 @@ optional<Anchor> getCenterAnchor(const GeometryCoordinates& line,
if (prevDistance + segmentDistance > centerDistance) {
// The center is on this segment
- float t = (centerDistance - prevDistance) / segmentDistance,
- x = util::interpolate(float(a.x), float(b.x), t),
- y = util::interpolate(float(a.y), float(b.y), t);
+ float t = (centerDistance - prevDistance) / segmentDistance;
+ float x = util::interpolate(float(a.x), float(b.x), t);
+ float y = util::interpolate(float(a.y), float(b.y), t);
Anchor anchor(std::round(x), std::round(y), util::angle_to(b, a), i);
diff --git a/src/mbgl/text/glyph_pbf.cpp b/src/mbgl/text/glyph_pbf.cpp
index cfaf803f75..c1cd329292 100644
--- a/src/mbgl/text/glyph_pbf.cpp
+++ b/src/mbgl/text/glyph_pbf.cpp
@@ -18,8 +18,12 @@ std::vector<Glyph> parseGlyphPBF(const GlyphRange& glyphRange, const std::string
Glyph glyph;
protozero::data_view glyphData;
- bool hasID = false, hasWidth = false, hasHeight = false, hasLeft = false,
- hasTop = false, hasAdvance = false;
+ bool hasID = false;
+ bool hasWidth = false;
+ bool hasHeight = false;
+ bool hasLeft = false;
+ bool hasTop = false;
+ bool hasAdvance = false;
while (glyph_pbf.next()) {
switch (glyph_pbf.tag()) {
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index e86135130a..add0aa004a 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -19,7 +19,7 @@ enum class PlacedSymbolOrientation : bool;
class OpacityState {
public:
OpacityState(bool placed, bool skipFade);
- OpacityState(const OpacityState& prevOpacityState, float increment, bool placed);
+ OpacityState(const OpacityState& prevState, float increment, bool placed);
bool isHidden() const;
float opacity;
bool placed;
@@ -27,8 +27,8 @@ public:
class JointOpacityState {
public:
- JointOpacityState(bool placedIcon, bool placedText, bool skipFade);
- JointOpacityState(const JointOpacityState& prevOpacityState, float increment, bool placedIcon, bool placedText);
+ JointOpacityState(bool placedText, bool placedIcon, bool skipFade);
+ JointOpacityState(const JointOpacityState& prevOpacityState, float increment, bool placedText, bool placedIcon);
bool isHidden() const;
OpacityState icon;
OpacityState text;
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp
index b18033a40e..f84df78800 100644
--- a/src/mbgl/text/shaping.cpp
+++ b/src/mbgl/text/shaping.cpp
@@ -496,7 +496,7 @@ void shapeLines(Shaping& shaping,
}
// Only justify if we placed at least one glyph
- if (positionedGlyphs.size() != 0) {
+ if (!positionedGlyphs.empty()) {
float lineLength = x - spacing; // Don't count trailing spacing
maxLineLength = util::max(lineLength, maxLineLength);
justifyLine(positionedGlyphs, justify, lineOffset);
@@ -528,21 +528,21 @@ void shapeLines(Shaping& shaping,
shaping.right = shaping.left + maxLineLength;
}
-const Shaping getShaping(const TaggedString& formattedString,
- const float maxWidth,
- const float lineHeight,
- const style::SymbolAnchorType textAnchor,
- const style::TextJustifyType textJustify,
- const float spacing,
- const std::array<float, 2>& translate,
- const WritingModeType writingMode,
- BiDi& bidi,
- const GlyphMap& glyphMap,
- const GlyphPositions& glyphPositions,
- const ImagePositions& imagePositions,
- float layoutTextSize,
- float layoutTextSizeAtBucketZoomLevel,
- bool allowVerticalPlacement) {
+Shaping getShaping(const TaggedString& formattedString,
+ const float maxWidth,
+ const float lineHeight,
+ const style::SymbolAnchorType textAnchor,
+ const style::TextJustifyType textJustify,
+ const float spacing,
+ const std::array<float, 2>& translate,
+ const WritingModeType writingMode,
+ BiDi& bidi,
+ const GlyphMap& glyphMap,
+ const GlyphPositions& glyphPositions,
+ const ImagePositions& imagePositions,
+ float layoutTextSize,
+ float layoutTextSizeAtBucketZoomLevel,
+ bool allowVerticalPlacement) {
assert(layoutTextSize);
std::vector<TaggedString> reorderedLines;
if (formattedString.sectionCount() == 1) {
diff --git a/src/mbgl/text/shaping.hpp b/src/mbgl/text/shaping.hpp
index 5343d4c3b2..5a65a1bf3a 100644
--- a/src/mbgl/text/shaping.hpp
+++ b/src/mbgl/text/shaping.hpp
@@ -79,20 +79,20 @@ public:
const Padding& collisionPadding() const { return _collisionPadding; }
};
-const Shaping getShaping(const TaggedString& string,
- float maxWidth,
- float lineHeight,
- style::SymbolAnchorType textAnchor,
- style::TextJustifyType textJustify,
- float spacing,
- const std::array<float, 2>& translate,
- const WritingModeType,
- BiDi& bidi,
- const GlyphMap& glyphMap,
- const GlyphPositions& glyphPositions,
- const ImagePositions& imagePositions,
- float layoutTextSize,
- float layoutTextSizeAtBucketZoomLevel,
- bool allowVerticalPlacement);
+Shaping getShaping(const TaggedString& string,
+ float maxWidth,
+ float lineHeight,
+ style::SymbolAnchorType textAnchor,
+ style::TextJustifyType textJustify,
+ float spacing,
+ const std::array<float, 2>& translate,
+ const WritingModeType,
+ BiDi& bidi,
+ const GlyphMap& glyphMap,
+ const GlyphPositions& glyphPositions,
+ const ImagePositions& imagePositions,
+ float layoutTextSize,
+ float layoutTextSizeAtBucketZoomLevel,
+ bool allowVerticalPlacement);
} // namespace mbgl