diff options
author | Maxim Pimenov <m@maps.me> | 2018-04-28 19:32:00 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2018-05-08 15:21:30 +0300 |
commit | e400ad6c46526cac178ed7522523881fae436361 (patch) | |
tree | df0533f5e7ea2fe4829969a745cecaf3e9e78193 /drape_frontend/user_mark_shapes.cpp | |
parent | 6313aed770cd2e530891bb7fdf894091b19150d0 (diff) |
[geometry] Made the constructor of Point<T> from Point<U> explicit.
Sometimes we want a non-trivial transformation when converting
from one representation of a point to another. An example
is PointDToPointU which uses the fact that its argument is
usually a point from the Mercator plane. The wrong usage
is easier to catch when implicit conversion between different point
types is prohibited.
An example of wrong usage that is prevented by this commit:
// A function defined in another file.
m2::PointU GetPoint()
{
m2::PointD pt;
[...]
return PointDToPointU(p2, kDefaultBits);
}
// Here we have forgotten that the result of GetPoint() is already converted.
m2::PointU ptu = PointDToPointU(GetPoint(), kDefaultBits);
Diffstat (limited to 'drape_frontend/user_mark_shapes.cpp')
-rw-r--r-- | drape_frontend/user_mark_shapes.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp index 431be2a796..040b3306e8 100644 --- a/drape_frontend/user_mark_shapes.cpp +++ b/drape_frontend/user_mark_shapes.cpp @@ -360,16 +360,16 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture glsl::vec4 colorAndAnimate(color.GetRedF(), color.GetGreenF(), color.GetBlueF(), runAnim ? 1.0f : -1.0f); buffer.emplace_back(pos, left + down, - glsl::ToVec4(texRect.LeftTop(), bgTexRect.LeftTop()), + glsl::ToVec4(m2::PointD(texRect.LeftTop()), m2::PointD(bgTexRect.LeftTop())), colorAndAnimate); buffer.emplace_back(pos, left + up, - glsl::ToVec4(texRect.LeftBottom(), bgTexRect.LeftBottom()), + glsl::ToVec4(m2::PointD(texRect.LeftBottom()), m2::PointD(bgTexRect.LeftBottom())), colorAndAnimate); buffer.emplace_back(pos, right + down, - glsl::ToVec4(texRect.RightTop(), bgTexRect.RightTop()), + glsl::ToVec4(m2::PointD(texRect.RightTop()), m2::PointD(bgTexRect.RightTop())), colorAndAnimate); buffer.emplace_back(pos, right + up, - glsl::ToVec4(texRect.RightBottom(), bgTexRect.RightBottom()), + glsl::ToVec4(m2::PointD(texRect.RightBottom()), m2::PointD(bgTexRect.RightBottom())), colorAndAnimate); } |