Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix render tests #351

Merged
merged 6 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mbgl/text/collision_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ IntersectStatus CollisionIndex::intersectsTileEdges(const CollisionBox& box,
const float tileY2 = tileEdges[3];

// Check left border
float minSectionLength = std::min(tileX1 - x1, x2 - tileX1);
int minSectionLength = std::min(tileX1 - x1, x2 - tileX1);
ntadej marked this conversation as resolved.
Show resolved Hide resolved
if (minSectionLength <= 0) { // Check right border
minSectionLength = std::min(tileX2 - x1, x2 - tileX2);
}
Expand Down Expand Up @@ -415,8 +415,8 @@ std::pair<Point<float>,float> CollisionIndex::projectAndGetPerspectiveRatio(cons
auto size = transformState.getSize();
return std::make_pair(
Point<float>(
static_cast<float>(((p[0] / p[3] + 1) / 2) * size.width) + viewportPadding,
static_cast<float>(((-p[1] / p[3] + 1) / 2) * size.height) + viewportPadding
(((p[0] / p[3] + 1) / 2) * size.width) + viewportPadding,
(((-p[1] / p[3] + 1) / 2) * size.height) + viewportPadding
wipfli marked this conversation as resolved.
Show resolved Hide resolved
),
// See perspective ratio comment in symbol_sdf.vertex
// We're doing collision detection in viewport space so we need
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/util/grid_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ void GridIndex<T>::query(const BCircle& queryBCircle, std::function<bool (const

template <class T>
std::size_t GridIndex<T>::convertToXCellCoord(const float x) const {
return util::max(size_t(0), util::min(xCellCount - 1, static_cast<size_t>(std::floor(x * xScale))));
ntadej marked this conversation as resolved.
Show resolved Hide resolved
return util::max(0.0, util::min(xCellCount - 1.0, std::floor(x * xScale)));
wipfli marked this conversation as resolved.
Show resolved Hide resolved
}

template <class T>
std::size_t GridIndex<T>::convertToYCellCoord(const float y) const {
return util::max(size_t(0), util::min(yCellCount - 1, static_cast<size_t>(std::floor(y * yScale))));
return util::max(0.0, util::min(yCellCount - 1.0, std::floor(y * yScale)));
wipfli marked this conversation as resolved.
Show resolved Hide resolved
}

template <class T>
Expand Down