summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-08-31 12:45:33 -0700
committerMathias Agopian <mathias@google.com>2012-08-31 18:38:22 -0700
commit4c0a170585d5c8a1f3508ac55f799ebaf86e91db (patch)
treea5fb6a7ab7accc4dc0265572507e73c8142740b8 /libs/ui
parent2098517e3e12a401005d7a7510d6c4943707b98d (diff)
downloadframeworks_native-4c0a170585d5c8a1f3508ac55f799ebaf86e91db.tar.gz
frameworks_native-4c0a170585d5c8a1f3508ac55f799ebaf86e91db.tar.bz2
frameworks_native-4c0a170585d5c8a1f3508ac55f799ebaf86e91db.zip
don't generate a new Region when translating by 0,0
since regions are copy-on-write, this prevents to duplicate the region entirely and offseting by 0,0 is fairly common. Change-Id: I9b8c286315a2e00dda01c2456397d72b5e12006b
Diffstat (limited to 'libs/ui')
-rw-r--r--libs/ui/Region.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index a3d8b01b8..2569ae174 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -529,7 +529,7 @@ void Region::boolean_operation(int op, Region& dst,
void Region::translate(Region& reg, int dx, int dy)
{
- if (!reg.isEmpty()) {
+ if ((dx || dy) && !reg.isEmpty()) {
#if VALIDATE_REGIONS
validate(reg, "translate (before)");
#endif