summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2008-09-17 20:48:31 +0200
committerDennis Kasprzyk <onestone@compiz-fusion.org>2008-09-17 20:48:31 +0200
commit1153a9ee1459576b9a26ccdc0c3d923f7b24019a (patch)
tree7b7e12b3347315540e70cd691db6b840252e92f9
parente73a1df3bf2a5871a2c7fd1a97d3e1a961cfd96b (diff)
downloadmobileperf-1153a9ee1459576b9a26ccdc0c3d923f7b24019a.tar.gz
mobileperf-1153a9ee1459576b9a26ccdc0c3d923f7b24019a.tar.bz2
Optimize rect,point and size classes and move headers to core/*
-rw-r--r--include/compiz-core.h6
-rw-r--r--include/compoutput.h2
-rw-r--r--include/comprect.h33
-rw-r--r--include/core/point.h (renamed from include/comppoint.h)17
-rw-r--r--include/core/rect.h81
-rw-r--r--include/core/size.h (renamed from include/compsize.h)16
-rw-r--r--include/core/window.h4
-rw-r--r--src/point.cpp14
-rw-r--r--src/privatescreen.h4
-rw-r--r--src/privatewindow.h2
-rw-r--r--src/rect.cpp50
-rw-r--r--src/size.cpp14
12 files changed, 122 insertions, 121 deletions
diff --git a/include/compiz-core.h b/include/compiz-core.h
index 96f35e2..b5d96b0 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -76,10 +76,10 @@ typedef XBool Bool;
#include <compicon.h>
#include <compmatch.h>
#include <compoutput.h>
-#include <comppoint.h>
-#include <comprect.h>
+#include <core/point.h>
+#include <core/rect.h>
#include <compsession.h>
-#include <compsize.h>
+#include <core/size.h>
#endif
diff --git a/include/compoutput.h b/include/compoutput.h
index 02a618a..400e09c 100644
--- a/include/compoutput.h
+++ b/include/compoutput.h
@@ -2,7 +2,7 @@
#define _COMPOUTPUT_H
#include <compiz-core.h>
-#include <comprect.h>
+#include <core/rect.h>
class CompOutput : public CompRect {
diff --git a/include/comprect.h b/include/comprect.h
deleted file mode 100644
index bfeb74f..0000000
--- a/include/comprect.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _COMPRECT_H
-#define _COMPRECT_H
-
-class CompRect {
-
- public:
- CompRect ();
- CompRect (int, int, int, int);
- CompRect (const CompRect&);
-
- int x ();
- int y ();
-
- int x1 ();
- int y1 ();
- int x2 ();
- int y2 ();
- unsigned int width ();
- unsigned int height ();
-
- Region region ();
-
- void setGeometry (int, int, int, int);
-
- typedef std::vector<CompRect> vector;
- typedef std::vector<CompRect *> ptrVector;
- typedef std::list<CompRect *> ptrList;
-
- private:
- REGION mRegion;
-};
-
-#endif
diff --git a/include/comppoint.h b/include/core/point.h
index 6cf09d7..987ab97 100644
--- a/include/comppoint.h
+++ b/include/core/point.h
@@ -10,8 +10,8 @@ class CompPoint {
CompPoint ();
CompPoint (int, int);
- int x ();
- int y ();
+ int x () const;
+ int y () const;
void setX (int);
void setY (int);
@@ -25,4 +25,17 @@ class CompPoint {
int mX, mY;
};
+inline int
+CompPoint::x () const
+{
+ return mX;
+}
+
+inline int
+CompPoint::y () const
+{
+ return mY;
+}
+
+
#endif
diff --git a/include/core/rect.h b/include/core/rect.h
new file mode 100644
index 0000000..c31eb92
--- /dev/null
+++ b/include/core/rect.h
@@ -0,0 +1,81 @@
+#ifndef _COMPRECT_H
+#define _COMPRECT_H
+
+class CompRect {
+
+ public:
+ CompRect ();
+ CompRect (int, int, int, int);
+ CompRect (const CompRect&);
+
+ int x () const;
+ int y () const;
+
+ int x1 () const;
+ int y1 () const;
+ int x2 () const;
+ int y2 () const;
+ unsigned int width () const;
+ unsigned int height () const;
+
+ Region region ();
+
+ void setGeometry (int, int, int, int);
+
+ typedef std::vector<CompRect> vector;
+ typedef std::vector<CompRect *> ptrVector;
+ typedef std::list<CompRect *> ptrList;
+
+ private:
+ REGION mRegion;
+};
+
+inline int
+CompRect::x () const
+{
+ return mRegion.extents.x1;
+}
+
+inline int
+CompRect::y () const
+{
+ return mRegion.extents.y1;
+}
+
+inline int
+CompRect::x1 () const
+{
+ return mRegion.extents.x1;
+}
+
+inline int
+CompRect::y1 () const
+{
+ return mRegion.extents.y1;
+}
+
+inline int
+CompRect::x2 () const
+{
+ return mRegion.extents.x2;
+}
+
+inline int
+CompRect::y2 () const
+{
+ return mRegion.extents.y2;
+}
+
+inline unsigned int
+CompRect::width () const
+{
+ return mRegion.extents.x2 - mRegion.extents.x1;
+}
+
+inline unsigned int
+CompRect::height () const
+{
+ return mRegion.extents.y2 - mRegion.extents.y1;
+}
+
+#endif
diff --git a/include/compsize.h b/include/core/size.h
index 45a2509..391875a 100644
--- a/include/compsize.h
+++ b/include/core/size.h
@@ -10,8 +10,8 @@ class CompSize {
CompSize ();
CompSize (unsigned int, unsigned int);
- unsigned int width ();
- unsigned int height ();
+ unsigned int width () const;
+ unsigned int height () const;
void setWidth (unsigned int);
void setHeight (unsigned int);
@@ -25,4 +25,16 @@ class CompSize {
unsigned int mWidth, mHeight;
};
+inline unsigned int
+CompSize::width () const
+{
+ return mWidth;
+}
+
+inline unsigned int
+CompSize::height () const
+{
+ return mHeight;
+}
+
#endif
diff --git a/include/core/window.h b/include/core/window.h
index 24b8d73..d91642f 100644
--- a/include/core/window.h
+++ b/include/core/window.h
@@ -11,8 +11,8 @@
#include <compaction.h>
#include <core/privates.h>
-#include <compsize.h>
-#include <comppoint.h>
+#include <core/size.h>
+#include <core/point.h>
#include <compwrapsystem.h>
diff --git a/src/point.cpp b/src/point.cpp
index 5eda20b..0f52dfc 100644
--- a/src/point.cpp
+++ b/src/point.cpp
@@ -1,4 +1,4 @@
-#include <comppoint.h>
+#include <core/point.h>
CompPoint::CompPoint () :
mX (0),
@@ -12,18 +12,6 @@ CompPoint::CompPoint (int x, int y) :
{
}
-int
-CompPoint::x ()
-{
- return mX;
-}
-
-int
-CompPoint::y ()
-{
- return mY;
-}
-
void
CompPoint::setX (int x)
{
diff --git a/src/privatescreen.h b/src/privatescreen.h
index 970c67a..0e68698 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -3,8 +3,8 @@
#include <compiz-core.h>
#include <core/screen.h>
-#include <compsize.h>
-#include <comppoint.h>
+#include <core/size.h>
+#include <core/point.h>
#include <core/timer.h>
extern bool shutDown;
diff --git a/src/privatewindow.h b/src/privatewindow.h
index 7f89289..9151572 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -3,7 +3,7 @@
#include <compiz-core.h>
#include <core/window.h>
-#include <comppoint.h>
+#include <core/point.h>
#include <core/timer.h>
#include "privatescreen.h"
diff --git a/src/rect.cpp b/src/rect.cpp
index e8769ef..52d1608 100644
--- a/src/rect.cpp
+++ b/src/rect.cpp
@@ -1,5 +1,5 @@
#include <compiz-core.h>
-#include <comprect.h>
+#include <core/rect.h>
CompRect::CompRect ()
{
@@ -27,54 +27,6 @@ CompRect::CompRect (const CompRect& r)
mRegion.rects = &mRegion.extents;
}
-int
-CompRect::x ()
-{
- return mRegion.extents.x1;
-}
-
-int
-CompRect::y ()
-{
- return mRegion.extents.y1;
-}
-
-int
-CompRect::x1 ()
-{
- return mRegion.extents.x1;
-}
-
-int
-CompRect::y1 ()
-{
- return mRegion.extents.y1;
-}
-
-int
-CompRect::x2 ()
-{
- return mRegion.extents.x2;
-}
-
-int
-CompRect::y2 ()
-{
- return mRegion.extents.y2;
-}
-
-unsigned int
-CompRect::width ()
-{
- return mRegion.extents.x2 - mRegion.extents.x1;
-}
-
-unsigned int
-CompRect::height ()
-{
- return mRegion.extents.y2 - mRegion.extents.y1;
-}
-
Region
CompRect::region ()
{
diff --git a/src/size.cpp b/src/size.cpp
index 63cd83a..81d0a7c 100644
--- a/src/size.cpp
+++ b/src/size.cpp
@@ -1,4 +1,4 @@
-#include <compsize.h>
+#include <core/size.h>
CompSize::CompSize () :
mWidth (0),
@@ -12,18 +12,6 @@ CompSize::CompSize (unsigned int width, unsigned int height) :
{
}
-unsigned int
-CompSize::width ()
-{
- return mWidth;
-}
-
-unsigned int
-CompSize::height ()
-{
- return mHeight;
-}
-
void
CompSize::setWidth (unsigned int width)
{