summaryrefslogtreecommitdiff
path: root/libs/hwui/ClipArea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/ClipArea.cpp')
-rw-r--r--libs/hwui/ClipArea.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/ClipArea.cpp b/libs/hwui/ClipArea.cpp
index e368537f0b4f..501cbe50ee05 100644
--- a/libs/hwui/ClipArea.cpp
+++ b/libs/hwui/ClipArea.cpp
@@ -404,11 +404,17 @@ static bool cannotFitInRectangleList(const ClipArea& clipArea, const ClipBase* s
return currentRectCount + recordedRectCount > RectangleList::kMaxTransformedRectangles;
}
+static const ClipRect sEmptyClipRect(Rect(0, 0));
+
const ClipBase* ClipArea::serializeIntersectedClip(LinearAllocator& allocator,
const ClipBase* recordedClip, const Matrix4& recordedClipTransform) {
+
// if no recordedClip passed, just serialize current state
if (!recordedClip) return serializeClip(allocator);
+ // if either is empty, clip is empty
+ if (CC_UNLIKELY(recordedClip->rect.isEmpty())|| mClipRect.isEmpty()) return &sEmptyClipRect;
+
if (!mLastResolutionResult
|| recordedClip != mLastResolutionClip
|| recordedClipTransform != mLastResolutionTransform) {