[vlc-commits] skins2: cosmetic
Erwan Tulou
git at videolan.org
Thu Apr 4 17:39:52 CEST 2013
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Apr 4 11:39:53 2013 +0200| [58cfde6851f56bfbe16622199b88a220f5eb92cd] | committer: Erwan Tulou
skins2: cosmetic
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=58cfde6851f56bfbe16622199b88a220f5eb92cd
---
modules/gui/skins2/controls/ctrl_slider.cpp | 1 -
modules/gui/skins2/controls/ctrl_slider.hpp | 1 +
modules/gui/skins2/utils/pointer.hpp | 105 ---------------------------
modules/gui/skins2/utils/position.hpp | 103 ++++++++++++++++++++++++++
4 files changed, 104 insertions(+), 106 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_slider.cpp b/modules/gui/skins2/controls/ctrl_slider.cpp
index caa97f9..89010ca 100644
--- a/modules/gui/skins2/controls/ctrl_slider.cpp
+++ b/modules/gui/skins2/controls/ctrl_slider.cpp
@@ -31,7 +31,6 @@
#include "../src/top_window.hpp"
#include "../src/os_factory.hpp"
#include "../src/os_graphics.hpp"
-#include "../utils/position.hpp"
#include "../utils/var_percent.hpp"
diff --git a/modules/gui/skins2/controls/ctrl_slider.hpp b/modules/gui/skins2/controls/ctrl_slider.hpp
index bae216f..a828b8a 100644
--- a/modules/gui/skins2/controls/ctrl_slider.hpp
+++ b/modules/gui/skins2/controls/ctrl_slider.hpp
@@ -29,6 +29,7 @@
#include "../utils/bezier.hpp"
#include "../utils/fsm.hpp"
#include "../utils/observer.hpp"
+#include "../utils/position.hpp"
class GenericBitmap;
diff --git a/modules/gui/skins2/utils/pointer.hpp b/modules/gui/skins2/utils/pointer.hpp
index 2d93d76..5c7fb92 100644
--- a/modules/gui/skins2/utils/pointer.hpp
+++ b/modules/gui/skins2/utils/pointer.hpp
@@ -92,109 +92,4 @@ private:
}
};
-
-class rect
-{
-public:
- rect( int v_x = 0, int v_y = 0, int v_width = 0, int v_height = 0 )
- : x( v_x ), y( v_y ), width( v_width ), height( v_height ) { }
- ~rect() { }
- int x;
- int y;
- int width;
- int height;
-
- // rect2 fully included in rect1
- static bool isIncluded( const rect& rect2, const rect& rect1 )
- {
- int x1 = rect1.x;
- int y1 = rect1.y;
- int w1 = rect1.width;
- int h1 = rect1.height;
-
- int x2 = rect2.x;
- int y2 = rect2.y;
- int w2 = rect2.width;
- int h2 = rect2.height;
-
- return x2 >= x1 && x2 + w2 <= x1 + w1
- && y2 >= y1 && y2 + h2 <= y1 + h1;
- }
-
- static bool areDisjunct( const rect& rect2, const rect& rect1 )
- {
- int x1 = rect1.x;
- int y1 = rect1.y;
- int w1 = rect1.width;
- int h1 = rect1.height;
-
- int x2 = rect2.x;
- int y2 = rect2.y;
- int w2 = rect2.width;
- int h2 = rect2.height;
-
- return y2 + h2 -1 < y1 // rect2 above rect1
- || y2 > y1 + h1 - 1 // rect2 under rect1
- || x2 > x1 + w1 -1 // rect2 right of rect1
- || x2 + w2 - 1 < x1; // rect2 left of rect1
- }
-
- static bool intersect( const rect& rect1, const rect& rect2, rect* pRect )
- {
- int x1 = rect1.x;
- int y1 = rect1.y;
- int w1 = rect1.width;
- int h1 = rect1.height;
-
- int x2 = rect2.x;
- int y2 = rect2.y;
- int w2 = rect2.width;
- int h2 = rect2.height;
-
- if( areDisjunct( rect1, rect2 ) )
- return false;
- else
- {
- int left = max( x1, x2 );
- int right = min( x1 + w1 - 1, x2 + w2 - 1 );
- int top = max( y1, y2 );
- int bottom = min( y1 + h1 - 1, y2 + h2 -1 );
- pRect->x = left;
- pRect->y = top;
- pRect->width = right - left + 1;
- pRect->height = bottom - top + 1;
-
- return pRect->width > 0 && pRect->height > 0;
- }
- }
-
- static bool join( const rect& rect1, const rect& rect2, rect* pRect )
- {
- int x1 = rect1.x;
- int y1 = rect1.y;
- int w1 = rect1.width;
- int h1 = rect1.height;
-
- int x2 = rect2.x;
- int y2 = rect2.y;
- int w2 = rect2.width;
- int h2 = rect2.height;
-
- int left = min( x1, x2 );
- int right = max( x1 + w1 - 1, x2 + w2 - 1 );
- int top = min( y1, y2 );
- int bottom = max( y1 + h1 - 1, y2 + h2 -1 );
- pRect->x = left;
- pRect->y = top;
- pRect->width = right - left + 1;
- pRect->height = bottom - top + 1;
-
- return pRect->width > 0 && pRect->height > 0;
- }
- static int min( int x, int y ) { return x < y ? x : y; }
- static int max( int x, int y ) { return x < y ? y : x; }
-
-};
-
-
#endif
diff --git a/modules/gui/skins2/utils/position.hpp b/modules/gui/skins2/utils/position.hpp
index 66601bd..ec5b761 100644
--- a/modules/gui/skins2/utils/position.hpp
+++ b/modules/gui/skins2/utils/position.hpp
@@ -162,4 +162,107 @@ private:
};
+class rect
+{
+public:
+ rect( int v_x = 0, int v_y = 0, int v_width = 0, int v_height = 0 )
+ : x( v_x ), y( v_y ), width( v_width ), height( v_height ) { }
+ ~rect() { }
+ int x;
+ int y;
+ int width;
+ int height;
+
+ // rect2 fully included in rect1
+ static bool isIncluded( const rect& rect2, const rect& rect1 )
+ {
+ int x1 = rect1.x;
+ int y1 = rect1.y;
+ int w1 = rect1.width;
+ int h1 = rect1.height;
+
+ int x2 = rect2.x;
+ int y2 = rect2.y;
+ int w2 = rect2.width;
+ int h2 = rect2.height;
+
+ return x2 >= x1 && x2 + w2 <= x1 + w1
+ && y2 >= y1 && y2 + h2 <= y1 + h1;
+ }
+
+ static bool areDisjunct( const rect& rect2, const rect& rect1 )
+ {
+ int x1 = rect1.x;
+ int y1 = rect1.y;
+ int w1 = rect1.width;
+ int h1 = rect1.height;
+
+ int x2 = rect2.x;
+ int y2 = rect2.y;
+ int w2 = rect2.width;
+ int h2 = rect2.height;
+
+ return y2 + h2 -1 < y1 // rect2 above rect1
+ || y2 > y1 + h1 - 1 // rect2 under rect1
+ || x2 > x1 + w1 -1 // rect2 right of rect1
+ || x2 + w2 - 1 < x1; // rect2 left of rect1
+ }
+
+ static bool intersect( const rect& rect1, const rect& rect2, rect* pRect )
+ {
+ int x1 = rect1.x;
+ int y1 = rect1.y;
+ int w1 = rect1.width;
+ int h1 = rect1.height;
+
+ int x2 = rect2.x;
+ int y2 = rect2.y;
+ int w2 = rect2.width;
+ int h2 = rect2.height;
+
+ if( areDisjunct( rect1, rect2 ) )
+ return false;
+ else
+ {
+ int left = max( x1, x2 );
+ int right = min( x1 + w1 - 1, x2 + w2 - 1 );
+ int top = max( y1, y2 );
+ int bottom = min( y1 + h1 - 1, y2 + h2 -1 );
+ pRect->x = left;
+ pRect->y = top;
+ pRect->width = right - left + 1;
+ pRect->height = bottom - top + 1;
+
+ return pRect->width > 0 && pRect->height > 0;
+ }
+ }
+
+ static bool join( const rect& rect1, const rect& rect2, rect* pRect )
+ {
+ int x1 = rect1.x;
+ int y1 = rect1.y;
+ int w1 = rect1.width;
+ int h1 = rect1.height;
+
+ int x2 = rect2.x;
+ int y2 = rect2.y;
+ int w2 = rect2.width;
+ int h2 = rect2.height;
+
+ int left = min( x1, x2 );
+ int right = max( x1 + w1 - 1, x2 + w2 - 1 );
+ int top = min( y1, y2 );
+ int bottom = max( y1 + h1 - 1, y2 + h2 -1 );
+ pRect->x = left;
+ pRect->y = top;
+ pRect->width = right - left + 1;
+ pRect->height = bottom - top + 1;
+
+ return pRect->width > 0 && pRect->height > 0;
+ }
+ static int min( int x, int y ) { return x < y ? x : y; }
+ static int max( int x, int y ) { return x < y ? y : x; }
+
+};
+
#endif
More information about the vlc-commits
mailing list