summaryrefslogtreecommitdiff
path: root/libs/hwui/DamageAccumulator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/DamageAccumulator.cpp')
-rw-r--r--libs/hwui/DamageAccumulator.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp
index 9bd3bdc5617e..c2e14a29f29e 100644
--- a/libs/hwui/DamageAccumulator.cpp
+++ b/libs/hwui/DamageAccumulator.cpp
@@ -121,7 +121,14 @@ void DamageAccumulator::popTransform() {
static inline void mapRect(const Matrix4* matrix, const SkRect& in, SkRect* out) {
if (in.isEmpty()) return;
Rect temp(in);
- matrix->mapRect(temp);
+ if (CC_LIKELY(!matrix->isPerspective())) {
+ matrix->mapRect(temp);
+ } else {
+ // Don't attempt to calculate damage for a perspective transform
+ // as the numbers this works with can break the perspective
+ // calculations. Just give up and expand to DIRTY_MIN/DIRTY_MAX
+ temp.set(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
+ }
out->join(RECT_ARGS(temp));
}
@@ -134,7 +141,14 @@ static inline void mapRect(const RenderProperties& props, const SkRect& in, SkRe
const SkMatrix* transform = props.getTransformMatrix();
SkRect temp(in);
if (transform && !transform->isIdentity()) {
- transform->mapRect(&temp);
+ if (CC_LIKELY(!transform->hasPerspective())) {
+ transform->mapRect(&temp);
+ } else {
+ // Don't attempt to calculate damage for a perspective transform
+ // as the numbers this works with can break the perspective
+ // calculations. Just give up and expand to DIRTY_MIN/DIRTY_MAX
+ temp.set(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
+ }
}
temp.offset(props.getLeft(), props.getTop());
out->join(temp);