summaryrefslogtreecommitdiff
path: root/src/mbgl/layout
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-20 12:38:09 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-23 12:09:09 +0200
commit37802eec36aae3cb84c7f73a48652d9959489243 (patch)
tree6e5b869babc4e1d23171a9f470b9c822b1c77cae /src/mbgl/layout
parent991cfee7df24acf50893c669d3a135e474945e97 (diff)
downloadqtlocation-mapboxgl-37802eec36aae3cb84c7f73a48652d9959489243.tar.gz
[core] Fix performance-type-promotion-in-math-fn errors
As reported by clang-tidy-8.
Diffstat (limited to 'src/mbgl/layout')
-rw-r--r--src/mbgl/layout/clip_lines.cpp24
-rw-r--r--src/mbgl/layout/symbol_layout.cpp2
2 files changed, 17 insertions, 9 deletions
diff --git a/src/mbgl/layout/clip_lines.cpp b/src/mbgl/layout/clip_lines.cpp
index 05b9103f69..05af5ef7b1 100644
--- a/src/mbgl/layout/clip_lines.cpp
+++ b/src/mbgl/layout/clip_lines.cpp
@@ -23,33 +23,41 @@ GeometryCollection clipLines(const GeometryCollection &lines,
if (p0.x < x1 && p1.x < x1) {
continue;
} else if (p0.x < x1) {
- p0 = { x1, static_cast<int16_t>(::round(p0.y + (p1.y - p0.y) * ((float)(x1 - p0.x) / (p1.x - p0.x)))) };
+ p0 = {x1,
+ static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x1 - p0.x) / (p1.x - p0.x))))};
} else if (p1.x < x1) {
- p1 = { x1, static_cast<int16_t>(::round(p0.y + (p1.y - p0.y) * ((float)(x1 - p0.x) / (p1.x - p0.x)))) };
+ p1 = {x1,
+ static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x1 - p0.x) / (p1.x - p0.x))))};
}
if (p0.y < y1 && p1.y < y1) {
continue;
} else if (p0.y < y1) {
- p0 = { static_cast<int16_t>(::round(p0.x + (p1.x - p0.x) * ((float)(y1 - p0.y) / (p1.y - p0.y)))), y1 };
+ p0 = {static_cast<int16_t>(std::round(p0.x + (p1.x - p0.x) * ((float)(y1 - p0.y) / (p1.y - p0.y)))),
+ y1};
} else if (p1.y < y1) {
- p1 = { static_cast<int16_t>(::round(p0.x + (p1.x - p0.x) * ((float)(y1 - p0.y) / (p1.y - p0.y)))), y1 };
+ p1 = {static_cast<int16_t>(std::round(p0.x + (p1.x - p0.x) * ((float)(y1 - p0.y) / (p1.y - p0.y)))),
+ y1};
}
if (p0.x >= x2 && p1.x >= x2) {
continue;
} else if (p0.x >= x2) {
- p0 = { x2, static_cast<int16_t>(::round(p0.y + (p1.y - p0.y) * ((float)(x2 - p0.x) / (p1.x - p0.x)))) };
+ p0 = {x2,
+ static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x2 - p0.x) / (p1.x - p0.x))))};
} else if (p1.x >= x2) {
- p1 = { x2, static_cast<int16_t>(::round(p0.y + (p1.y - p0.y) * ((float)(x2 - p0.x) / (p1.x - p0.x)))) };
+ p1 = {x2,
+ static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x2 - p0.x) / (p1.x - p0.x))))};
}
if (p0.y >= y2 && p1.y >= y2) {
continue;
} else if (p0.y >= y2) {
- p0 = { static_cast<int16_t>(::round(p0.x + (p1.x - p0.x) * ((float)(y2 - p0.y) / (p1.y - p0.y)))), y2 };
+ p0 = {static_cast<int16_t>(std::round(p0.x + (p1.x - p0.x) * ((float)(y2 - p0.y) / (p1.y - p0.y)))),
+ y2};
} else if (p1.y >= y2) {
- p1 = { static_cast<int16_t>(::round(p0.x + (p1.x - p0.x) * ((float)(y2 - p0.y) / (p1.y - p0.y)))), y2 };
+ p1 = {static_cast<int16_t>(std::round(p0.x + (p1.x - p0.x) * ((float)(y2 - p0.y) / (p1.y - p0.y)))),
+ y2};
}
if (clippedLines.empty() || (!clippedLines.back().empty() && !(p0 == clippedLines.back().back()))) {
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 842f7d40c1..374ab3b659 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -961,7 +961,7 @@ size_t SymbolLayout::addSymbol(SymbolBucket::Buffer& buffer,
if (buffer.segments.empty() ||
buffer.segments.back().vertexLength + vertexLength > std::numeric_limits<uint16_t>::max() ||
- fabs(buffer.segments.back().sortKey - sortKey) > std::numeric_limits<float>::epsilon()) {
+ std::fabs(buffer.segments.back().sortKey - sortKey) > std::numeric_limits<float>::epsilon()) {
buffer.segments.emplace_back(buffer.vertices.elements(), buffer.triangles.elements(), 0ul, 0ul, sortKey);
}