[vlc-commits] commit: Fixed a bug in rect::isIncluded(), and added constness. ( Olivier Teulière )

git at videolan.org git at videolan.org
Mon Aug 2 20:29:42 CEST 2010


vlc | branch: master | Olivier Teulière <ipkiss at ulukai.(none)> | Mon Aug  2 20:17:53 2010 +0200| [dae4a34faea492b1b0db0706569fdb2cf3536812] | committer: Olivier Teulière 

Fixed a bug in rect::isIncluded(), and added constness.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dae4a34faea492b1b0db0706569fdb2cf3536812
---

 modules/gui/skins2/utils/pointer.hpp |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/gui/skins2/utils/pointer.hpp b/modules/gui/skins2/utils/pointer.hpp
index 2a7e815..2d93d76 100644
--- a/modules/gui/skins2/utils/pointer.hpp
+++ b/modules/gui/skins2/utils/pointer.hpp
@@ -105,7 +105,7 @@ public:
     int height;
 
     // rect2 fully included in rect1
-    static bool isIncluded( rect& rect2, rect& rect1 )
+    static bool isIncluded( const rect& rect2, const rect& rect1 )
     {
         int x1 = rect1.x;
         int y1 = rect1.y;
@@ -117,13 +117,11 @@ public:
         int w2 = rect2.width;
         int h2 = rect2.height;
 
-        return     x2 >= x1 && x2 < x1 + w1
-               &&  y2 >= y1 && y2 < y1 + h1
-               &&  w2 <= w1
-               &&  h2 <= h1;
+        return     x2 >= x1 && x2 + w2 <= x1 + w1
+               &&  y2 >= y1 && y2 + h2 <= y1 + h1;
     }
 
-    static bool areDisjunct( rect& rect2, rect& rect1 )
+    static bool areDisjunct( const rect& rect2, const rect& rect1 )
     {
         int x1 = rect1.x;
         int y1 = rect1.y;
@@ -141,7 +139,7 @@ public:
                || x2 + w2 - 1 < x1; // rect2 left of rect1
     }
 
-    static bool intersect( rect& rect1, rect& rect2, rect* pRect )
+    static bool intersect( const rect& rect1, const rect& rect2, rect* pRect )
     {
         int x1 = rect1.x;
         int y1 = rect1.y;
@@ -170,7 +168,7 @@ public:
         }
     }
 
-    static bool join( rect& rect1, rect& rect2, rect* pRect )
+    static bool join( const rect& rect1, const rect& rect2, rect* pRect )
     {
         int x1 = rect1.x;
         int y1 = rect1.y;



More information about the vlc-commits mailing list