Skip to content

Commit

Permalink
Add static casts
Browse files Browse the repository at this point in the history
  • Loading branch information
wipfli committed Jul 5, 2022
1 parent 28be059 commit 130df7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mbgl/text/collision_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,22 @@ IntersectStatus CollisionIndex::intersectsTileEdges(const CollisionBox& box,
const float tileY2 = tileEdges[3];

// Check left border
int minSectionLength = std::min(tileX1 - x1, x2 - tileX1);
int minSectionLength = static_cast<int>(std::min(tileX1 - x1, x2 - tileX1));
if (minSectionLength <= 0) { // Check right border
minSectionLength = std::min(tileX2 - x1, x2 - tileX2);
minSectionLength = static_cast<int>(std::min(tileX2 - x1, x2 - tileX2));
}
if (minSectionLength > 0) {
result.flags |= IntersectStatus::VerticalBorders;
result.minSectionLength = static_cast<int>(minSectionLength);
result.minSectionLength = minSectionLength;
}
// Check top border
minSectionLength = std::min(tileY1 - y1, y2 - tileY1);
minSectionLength = static_cast<int>(std::min(tileY1 - y1, y2 - tileY1));
if (minSectionLength <= 0) { // Check bottom border
minSectionLength = std::min(tileY2 - y1, y2 - tileY2);
minSectionLength = static_cast<int>(std::min(tileY2 - y1, y2 - tileY2));
}
if (minSectionLength > 0) {
result.flags |= IntersectStatus::HorizontalBorders;
result.minSectionLength = std::min(result.minSectionLength, static_cast<int>(minSectionLength));
result.minSectionLength = static_cast<int>(std::min(result.minSectionLength, minSectionLength));

This comment has been minimized.

Copy link
@ntadej

ntadej Jul 5, 2022

Collaborator

This one is not needed. The rest seems OK.

}
return result;
}
Expand Down

0 comments on commit 130df7c

Please sign in to comment.