diff options
author | 2012-02-07 17:04:34 -0800 | |
---|---|---|
committer | 2012-02-07 17:04:34 -0800 | |
commit | 967e2bf3ac8943a8e8a374bf86021915445cda67 (patch) | |
tree | 1534a056ce117ebd6c0b8e39bd6a2ed2a6eb46c8 /libs/ui/Region.cpp | |
parent | 0afa7e2d95a1ae047ceddf2ca67f05c67ac30770 (diff) |
Preliminary support for clipRect(Rect, Op)
This adds basic support for clip regions. It is currently disabled at compile
time. Enabling clip regions will require setting up a stencil buffer.
Change-Id: I638616a972276e38737f8ac0633692c3845eaa74
Diffstat (limited to 'libs/ui/Region.cpp')
-rw-r--r-- | libs/ui/Region.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp index 8cd047afb8db..6e2e731e3d5a 100644 --- a/libs/ui/Region.cpp +++ b/libs/ui/Region.cpp @@ -126,6 +126,9 @@ void Region::addRectUnchecked(int l, int t, int r, int b) Region& Region::orSelf(const Rect& r) { return operationSelf(r, op_or); } +Region& Region::xorSelf(const Rect& r) { + return operationSelf(r, op_xor); +} Region& Region::andSelf(const Rect& r) { return operationSelf(r, op_and); } @@ -143,6 +146,9 @@ Region& Region::operationSelf(const Rect& r, int op) { Region& Region::orSelf(const Region& rhs) { return operationSelf(rhs, op_or); } +Region& Region::xorSelf(const Region& rhs) { + return operationSelf(rhs, op_xor); +} Region& Region::andSelf(const Region& rhs) { return operationSelf(rhs, op_and); } @@ -165,6 +171,9 @@ Region& Region::translateSelf(int x, int y) { const Region Region::merge(const Rect& rhs) const { return operation(rhs, op_or); } +const Region Region::mergeExclusive(const Rect& rhs) const { + return operation(rhs, op_xor); +} const Region Region::intersect(const Rect& rhs) const { return operation(rhs, op_and); } @@ -182,6 +191,9 @@ const Region Region::operation(const Rect& rhs, int op) const { const Region Region::merge(const Region& rhs) const { return operation(rhs, op_or); } +const Region Region::mergeExclusive(const Region& rhs) const { + return operation(rhs, op_xor); +} const Region Region::intersect(const Region& rhs) const { return operation(rhs, op_and); } @@ -205,6 +217,9 @@ const Region Region::translate(int x, int y) const { Region& Region::orSelf(const Region& rhs, int dx, int dy) { return operationSelf(rhs, dx, dy, op_or); } +Region& Region::xorSelf(const Region& rhs, int dx, int dy) { + return operationSelf(rhs, dx, dy, op_xor); +} Region& Region::andSelf(const Region& rhs, int dx, int dy) { return operationSelf(rhs, dx, dy, op_and); } @@ -222,6 +237,9 @@ Region& Region::operationSelf(const Region& rhs, int dx, int dy, int op) { const Region Region::merge(const Region& rhs, int dx, int dy) const { return operation(rhs, dx, dy, op_or); } +const Region Region::mergeExclusive(const Region& rhs, int dx, int dy) const { + return operation(rhs, dx, dy, op_xor); +} const Region Region::intersect(const Region& rhs, int dx, int dy) const { return operation(rhs, dx, dy, op_and); } @@ -421,6 +439,7 @@ void Region::boolean_operation(int op, Region& dst, SkRegion::Op sk_op; switch (op) { case op_or: sk_op = SkRegion::kUnion_Op; name="OR"; break; + case op_xor: sk_op = SkRegion::kUnion_XOR; name="XOR"; break; case op_and: sk_op = SkRegion::kIntersect_Op; name="AND"; break; case op_nand: sk_op = SkRegion::kDifference_Op; name="NAND"; break; } |