From 859074b3cc76130b00edc9e0d36157c75f65ed29 Mon Sep 17 00:00:00 2001
From: Laurent Gomila <laurent.gom@gmail.com>
Date: Tue, 27 Mar 2012 17:17:59 +0200
Subject: [PATCH] RenderTarget::convertCoords now takes a Vector2i argument

---
 include/SFML/Graphics/RenderTarget.hpp | 12 +++++-------
 src/SFML/Graphics/RenderTarget.cpp     | 10 +++++-----
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp
index 9e618051..0db2ce29 100644
--- a/include/SFML/Graphics/RenderTarget.hpp
+++ b/include/SFML/Graphics/RenderTarget.hpp
@@ -144,13 +144,12 @@ public :
     /// This version uses the current view of the render target.
     /// See the other overload to specify a custom view.
     ///
-    /// \param x X coordinate of the point to convert, relative to the render target
-    /// \param y Y coordinate of the point to convert, relative to the render target
+    /// \param point Point to convert, relative to the render target
     ///
     /// \return The converted point, in "world" units
     ///
     ////////////////////////////////////////////////////////////
-    Vector2f convertCoords(unsigned int x, unsigned int y) const;
+    Vector2f convertCoords(const Vector2i& point) const;
 
     ////////////////////////////////////////////////////////////
     /// \brief Convert a point from target coordinates to view coordinates
@@ -169,14 +168,13 @@ public :
     /// overload of the function to use the current view of the render
     /// target.
     ///
-    /// \param x    X coordinate of the point to convert, relative to the render target
-    /// \param y    Y coordinate of the point to convert, relative to the render target
-    /// \param view The view to use for converting the point
+    /// \param point Point to convert, relative to the render target
+    /// \param view  The view to use for converting the point
     ///
     /// \return The converted point, in "world" units
     ///
     ////////////////////////////////////////////////////////////
-    Vector2f convertCoords(unsigned int x, unsigned int y, const View& view) const;
+    Vector2f convertCoords(const Vector2i& point, const View& view) const;
 
     ////////////////////////////////////////////////////////////
     /// \brief Draw a drawable object to the render-target
diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp
index c7d0104a..75fe9bc7 100644
--- a/src/SFML/Graphics/RenderTarget.cpp
+++ b/src/SFML/Graphics/RenderTarget.cpp
@@ -100,20 +100,20 @@ IntRect RenderTarget::getViewport(const View& view) const
 
 
 ////////////////////////////////////////////////////////////
-Vector2f RenderTarget::convertCoords(unsigned int x, unsigned int y) const
+Vector2f RenderTarget::convertCoords(const Vector2i& point) const
 {
-    return convertCoords(x, y, getView());
+    return convertCoords(point, getView());
 }
 
 
 ////////////////////////////////////////////////////////////
-Vector2f RenderTarget::convertCoords(unsigned int x, unsigned int y, const View& view) const
+Vector2f RenderTarget::convertCoords(const Vector2i& point, const View& view) const
 {
     // First, convert from viewport coordinates to homogeneous coordinates
     Vector2f coords;
     IntRect viewport = getViewport(view);
-    coords.x = -1.f + 2.f * (static_cast<int>(x) - viewport.left) / viewport.width;
-    coords.y = 1.f  - 2.f * (static_cast<int>(y) - viewport.top)  / viewport.height;
+    coords.x = -1.f + 2.f * (point.x - viewport.left) / viewport.width;
+    coords.y = 1.f  - 2.f * (point.y - viewport.top)  / viewport.height;
 
     // Then transform by the inverse of the view matrix
     return view.getInverseTransform().transformPoint(coords);