From adc6929a8d0b79f67cf16dab134033b4eb2fee85 Mon Sep 17 00:00:00 2001 From: vng Date: Sat, 26 Mar 2011 19:06:25 +0200 Subject: [PATCH] Correct ClampPoint (do not use double->uint32_t conversion). --- indexer/geometry_coding.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/indexer/geometry_coding.cpp b/indexer/geometry_coding.cpp index 502ff17d6c..5c41176501 100644 --- a/indexer/geometry_coding.cpp +++ b/indexer/geometry_coding.cpp @@ -11,12 +11,14 @@ namespace { - template - inline m2::PointU ClampPoint(m2::PointU const & maxPoint, m2::Point const & point) + inline m2::PointU ClampPoint(m2::PointU const & maxPoint, m2::Point const & point) { typedef m2::PointU::value_type uvalue_t; - return m2::PointU(my::clamp(static_cast(point.x), static_cast(0), maxPoint.x), - my::clamp(static_cast(point.y), static_cast(0), maxPoint.y)); + //return m2::PointU(my::clamp(static_cast(point.x), static_cast(0), maxPoint.x), + // my::clamp(static_cast(point.y), static_cast(0), maxPoint.y)); + + return m2::PointU(static_cast(my::clamp(point.x, 0.0, static_cast(maxPoint.x))), + static_cast(my::clamp(point.y, 0.0, static_cast(maxPoint.y)))); } }