diff options
| author | 2016-04-07 13:51:07 -0700 | |
|---|---|---|
| committer | 2016-04-07 15:02:39 -0700 | |
| commit | 04d46eb69fb4f4c4c332c36c6ae845da3b2ae848 (patch) | |
| tree | e6a598b4e1d29bf25ec139a07e8a0867b8b745d9 /libs/hwui/Snapshot.cpp | |
| parent | f2cf5987a6aea262187208ad269ceb1534955704 (diff) | |
Support replace op in new pipeline
bug:26562461
Change-Id: Ie48d2da30f5e9d9abe88a5cd973dfb26e38abf63
Diffstat (limited to 'libs/hwui/Snapshot.cpp')
| -rw-r--r-- | libs/hwui/Snapshot.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp index d7842801fdd8..2c9c9d90f686 100644 --- a/libs/hwui/Snapshot.cpp +++ b/libs/hwui/Snapshot.cpp @@ -242,6 +242,33 @@ void Snapshot::setProjectionPathMask(LinearAllocator& allocator, const SkPath* p #endif } +static Snapshot* getClipRoot(Snapshot* target) { + while (target->previous && target->previous->previous) { + target = target->previous; + } + return target; +} + +const ClipBase* Snapshot::serializeIntersectedClip(LinearAllocator& allocator, + const ClipBase* recordedClip, const Matrix4& recordedClipTransform) { + auto target = this; + if (CC_UNLIKELY(recordedClip && recordedClip->intersectWithRoot)) { + // Clip must be intersected with root, instead of current clip. + target = getClipRoot(this); + } + + return target->mClipArea->serializeIntersectedClip(allocator, + recordedClip, recordedClipTransform); +} + +void Snapshot::applyClip(const ClipBase* recordedClip, const Matrix4& transform) { + if (CC_UNLIKELY(recordedClip && recordedClip->intersectWithRoot)) { + // current clip is being replaced, but must intersect with clip root + *mClipArea = *(getClipRoot(this)->mClipArea); + } + mClipArea->applyClip(recordedClip, transform); +} + /////////////////////////////////////////////////////////////////////////////// // Queries /////////////////////////////////////////////////////////////////////////////// |