summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-05-27 17:01:58 -0700
committerMathias Agopian <mathias@google.com>2009-05-27 17:01:58 -0700
commitbed9dd128dfbdc7d9dbca005078536dadc0b9359 (patch)
treeeabfee52c02276a81d270595d4d436e35a5da7fa
parent4b8160fdfd3281d1d66c0cae9bb9c647b4333491 (diff)
downloadframeworks_native-bed9dd128dfbdc7d9dbca005078536dadc0b9359.zip
frameworks_native-bed9dd128dfbdc7d9dbca005078536dadc0b9359.tar.gz
frameworks_native-bed9dd128dfbdc7d9dbca005078536dadc0b9359.tar.bz2
make sure the Region code disallows constructs like "(a+b)=c;", which is somewhat meaningless.
-rw-r--r--include/ui/Region.h42
-rw-r--r--libs/ui/Region.cpp26
2 files changed, 34 insertions, 34 deletions
diff --git a/include/ui/Region.h b/include/ui/Region.h
index e36dcb4..4299ea5 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -65,14 +65,14 @@ public:
Region& subtractSelf(const Region& rhs);
// boolean operators
- Region merge(const Rect& rhs) const;
- Region intersect(const Rect& rhs) const;
- Region subtract(const Rect& rhs) const;
+ const Region merge(const Rect& rhs) const;
+ const Region intersect(const Rect& rhs) const;
+ const Region subtract(const Rect& rhs) const;
// boolean operators
- Region merge(const Region& rhs) const;
- Region intersect(const Region& rhs) const;
- Region subtract(const Region& rhs) const;
+ const Region merge(const Region& rhs) const;
+ const Region intersect(const Region& rhs) const;
+ const Region subtract(const Region& rhs) const;
// these translate rhs first
Region& translateSelf(int dx, int dy);
@@ -81,16 +81,16 @@ public:
Region& subtractSelf(const Region& rhs, int dx, int dy);
// these translate rhs first
- Region translate(int dx, int dy) const;
- Region merge(const Region& rhs, int dx, int dy) const;
- Region intersect(const Region& rhs, int dx, int dy) const;
- Region subtract(const Region& rhs, int dx, int dy) const;
+ const Region translate(int dx, int dy) const;
+ const Region merge(const Region& rhs, int dx, int dy) const;
+ const Region intersect(const Region& rhs, int dx, int dy) const;
+ const Region subtract(const Region& rhs, int dx, int dy) const;
// convenience operators overloads
- inline Region operator | (const Region& rhs) const;
- inline Region operator & (const Region& rhs) const;
- inline Region operator - (const Region& rhs) const;
- inline Region operator + (const Point& pt) const;
+ inline const Region operator | (const Region& rhs) const;
+ inline const Region operator & (const Region& rhs) const;
+ inline const Region operator - (const Region& rhs) const;
+ inline const Region operator + (const Point& pt) const;
inline Region& operator |= (const Region& rhs);
inline Region& operator &= (const Region& rhs);
@@ -136,9 +136,9 @@ private:
Region& operationSelf(const Rect& r, int op);
Region& operationSelf(const Region& r, int op);
Region& operationSelf(const Region& r, int dx, int dy, int op);
- Region operation(const Rect& rhs, int op) const;
- Region operation(const Region& rhs, int op) const;
- Region operation(const Region& rhs, int dx, int dy, int op) const;
+ const Region operation(const Rect& rhs, int op) const;
+ const Region operation(const Region& rhs, int op) const;
+ const Region operation(const Region& rhs, int dx, int dy, int op) const;
static void boolean_operation(int op, Region& dst,
const Region& lhs, const Region& rhs, int dx, int dy);
@@ -160,16 +160,16 @@ private:
};
-Region Region::operator | (const Region& rhs) const {
+const Region Region::operator | (const Region& rhs) const {
return merge(rhs);
}
-Region Region::operator & (const Region& rhs) const {
+const Region Region::operator & (const Region& rhs) const {
return intersect(rhs);
}
-Region Region::operator - (const Region& rhs) const {
+const Region Region::operator - (const Region& rhs) const {
return subtract(rhs);
}
-Region Region::operator + (const Point& pt) const {
+const Region Region::operator + (const Point& pt) const {
return translate(pt.x, pt.y);
}
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 065ed54..2e6b241 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -156,16 +156,16 @@ Region& Region::translateSelf(int x, int y) {
// ----------------------------------------------------------------------------
-Region Region::merge(const Rect& rhs) const {
+const Region Region::merge(const Rect& rhs) const {
return operation(rhs, op_or);
}
-Region Region::intersect(const Rect& rhs) const {
+const Region Region::intersect(const Rect& rhs) const {
return operation(rhs, op_and);
}
-Region Region::subtract(const Rect& rhs) const {
+const Region Region::subtract(const Rect& rhs) const {
return operation(rhs, op_nand);
}
-Region Region::operation(const Rect& rhs, int op) const {
+const Region Region::operation(const Rect& rhs, int op) const {
Region result;
boolean_operation(op, result, *this, rhs);
return result;
@@ -173,22 +173,22 @@ Region Region::operation(const Rect& rhs, int op) const {
// ----------------------------------------------------------------------------
-Region Region::merge(const Region& rhs) const {
+const Region Region::merge(const Region& rhs) const {
return operation(rhs, op_or);
}
-Region Region::intersect(const Region& rhs) const {
+const Region Region::intersect(const Region& rhs) const {
return operation(rhs, op_and);
}
-Region Region::subtract(const Region& rhs) const {
+const Region Region::subtract(const Region& rhs) const {
return operation(rhs, op_nand);
}
-Region Region::operation(const Region& rhs, int op) const {
+const Region Region::operation(const Region& rhs, int op) const {
Region result;
boolean_operation(op, result, *this, rhs);
return result;
}
-Region Region::translate(int x, int y) const {
+const Region Region::translate(int x, int y) const {
Region result;
translate(result, *this, x, y);
return result;
@@ -213,16 +213,16 @@ Region& Region::operationSelf(const Region& rhs, int dx, int dy, int op) {
// ----------------------------------------------------------------------------
-Region Region::merge(const Region& rhs, int dx, int dy) const {
+const Region Region::merge(const Region& rhs, int dx, int dy) const {
return operation(rhs, dx, dy, op_or);
}
-Region Region::intersect(const Region& rhs, int dx, int dy) const {
+const Region Region::intersect(const Region& rhs, int dx, int dy) const {
return operation(rhs, dx, dy, op_and);
}
-Region Region::subtract(const Region& rhs, int dx, int dy) const {
+const Region Region::subtract(const Region& rhs, int dx, int dy) const {
return operation(rhs, dx, dy, op_nand);
}
-Region Region::operation(const Region& rhs, int dx, int dy, int op) const {
+const Region Region::operation(const Region& rhs, int dx, int dy, int op) const {
Region result;
boolean_operation(op, result, *this, rhs, dx, dy);
return result;