summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/clip_lines.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/layout/clip_lines.cpp')
-rw-r--r--src/mbgl/layout/clip_lines.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mbgl/layout/clip_lines.cpp b/src/mbgl/layout/clip_lines.cpp
index 05af5ef7b1..022c296e19 100644
--- a/src/mbgl/layout/clip_lines.cpp
+++ b/src/mbgl/layout/clip_lines.cpp
@@ -24,19 +24,23 @@ GeometryCollection clipLines(const GeometryCollection &lines,
continue;
} else if (p0.x < x1) {
p0 = {x1,
- static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x1 - p0.x) / (p1.x - p0.x))))};
+ static_cast<int16_t>(
+ std::round(p0.y + (p1.y - p0.y) * (static_cast<float>(x1 - p0.x) / (p1.x - p0.x))))};
} else if (p1.x < x1) {
p1 = {x1,
- static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x1 - p0.x) / (p1.x - p0.x))))};
+ static_cast<int16_t>(
+ std::round(p0.y + (p1.y - p0.y) * (static_cast<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>(std::round(p0.x + (p1.x - p0.x) * ((float)(y1 - p0.y) / (p1.y - p0.y)))),
+ p0 = {static_cast<int16_t>(
+ std::round(p0.x + (p1.x - p0.x) * (static_cast<float>(y1 - p0.y) / (p1.y - p0.y)))),
y1};
} else if (p1.y < y1) {
- p1 = {static_cast<int16_t>(std::round(p0.x + (p1.x - p0.x) * ((float)(y1 - p0.y) / (p1.y - p0.y)))),
+ p1 = {static_cast<int16_t>(
+ std::round(p0.x + (p1.x - p0.x) * (static_cast<float>(y1 - p0.y) / (p1.y - p0.y)))),
y1};
}
@@ -44,19 +48,23 @@ GeometryCollection clipLines(const GeometryCollection &lines,
continue;
} else if (p0.x >= x2) {
p0 = {x2,
- static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x2 - p0.x) / (p1.x - p0.x))))};
+ static_cast<int16_t>(
+ std::round(p0.y + (p1.y - p0.y) * (static_cast<float>(x2 - p0.x) / (p1.x - p0.x))))};
} else if (p1.x >= x2) {
p1 = {x2,
- static_cast<int16_t>(std::round(p0.y + (p1.y - p0.y) * ((float)(x2 - p0.x) / (p1.x - p0.x))))};
+ static_cast<int16_t>(
+ std::round(p0.y + (p1.y - p0.y) * (static_cast<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>(std::round(p0.x + (p1.x - p0.x) * ((float)(y2 - p0.y) / (p1.y - p0.y)))),
+ p0 = {static_cast<int16_t>(
+ std::round(p0.x + (p1.x - p0.x) * (static_cast<float>(y2 - p0.y) / (p1.y - p0.y)))),
y2};
} else if (p1.y >= y2) {
- p1 = {static_cast<int16_t>(std::round(p0.x + (p1.x - p0.x) * ((float)(y2 - p0.y) / (p1.y - p0.y)))),
+ p1 = {static_cast<int16_t>(
+ std::round(p0.x + (p1.x - p0.x) * (static_cast<float>(y2 - p0.y) / (p1.y - p0.y)))),
y2};
}