Loading libs/hwui/Android.mk +3 −2 Original line number Diff line number Diff line Loading @@ -248,16 +248,17 @@ LOCAL_SRC_FILES += \ tests/unit/FatVectorTests.cpp \ tests/unit/GlopBuilderTests.cpp \ tests/unit/GpuMemoryTrackerTests.cpp \ tests/unit/GradientCacheTests.cpp \ tests/unit/LayerUpdateQueueTests.cpp \ tests/unit/LinearAllocatorTests.cpp \ tests/unit/MatrixTests.cpp \ tests/unit/OffscreenBufferPoolTests.cpp \ tests/unit/RenderNodeTests.cpp \ tests/unit/SkiaBehaviorTests.cpp \ tests/unit/SnapshotTests.cpp \ tests/unit/StringUtilsTests.cpp \ tests/unit/TextDropShadowCacheTests.cpp \ tests/unit/VectorDrawableTests.cpp \ tests/unit/GradientCacheTests.cpp tests/unit/VectorDrawableTests.cpp ifeq (true, $(HWUI_NEW_OPS)) LOCAL_SRC_FILES += \ Loading libs/hwui/BakedOpState.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& s } // resolvedClipRect = intersect(parentMatrix * localClip, parentClip) clipState = snapshot.mutateClipArea().serializeIntersectedClip(allocator, clipState = snapshot.serializeIntersectedClip(allocator, recordedOp.localClip, *(snapshot.transform)); LOG_ALWAYS_FATAL_IF(!clipState, "must clip!"); Loading Loading @@ -85,8 +85,7 @@ ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& s ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot, const Matrix4& localTransform, const ClipBase* localClip) { transform.loadMultiply(*snapshot.transform, localTransform); clipState = snapshot.mutateClipArea().serializeIntersectedClip(allocator, localClip, *(snapshot.transform)); clipState = snapshot.serializeIntersectedClip(allocator, localClip, *(snapshot.transform)); clippedBounds = clipState->rect; clipSideFlags = OpClipSideFlags::Full; localProjectionPathMask = nullptr; Loading libs/hwui/ClipArea.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,7 @@ void ClipArea::setClip(float left, float top, float right, float bottom) { void ClipArea::clipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op) { if (op == SkRegion::kReplace_Op) mReplaceOpObserved = true; if (!mPostViewportClipObserved && op == SkRegion::kIntersect_Op) op = SkRegion::kReplace_Op; onClipUpdated(); switch (mMode) { Loading @@ -233,6 +234,7 @@ void ClipArea::clipRectWithTransform(const Rect& r, const mat4* transform, } void ClipArea::clipRegion(const SkRegion& region, SkRegion::Op op) { if (op == SkRegion::kReplace_Op) mReplaceOpObserved = true; if (!mPostViewportClipObserved && op == SkRegion::kIntersect_Op) op = SkRegion::kReplace_Op; onClipUpdated(); enterRegionMode(); Loading @@ -242,6 +244,7 @@ void ClipArea::clipRegion(const SkRegion& region, SkRegion::Op op) { void ClipArea::clipPathWithTransform(const SkPath& path, const mat4* transform, SkRegion::Op op) { if (op == SkRegion::kReplace_Op) mReplaceOpObserved = true; if (!mPostViewportClipObserved && op == SkRegion::kIntersect_Op) op = SkRegion::kReplace_Op; onClipUpdated(); SkMatrix skTransform; Loading Loading @@ -379,6 +382,7 @@ const ClipBase* ClipArea::serializeClip(LinearAllocator& allocator) { serialization->rect.set(mClipRegion.getBounds()); break; } serialization->intersectWithRoot = mReplaceOpObserved; // TODO: this is only done for draw time, should eventually avoid for record time serialization->rect.snapToPixelBoundaries(); mLastSerialization = serialization; Loading libs/hwui/ClipArea.h +4 −2 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ struct ClipBase { : mode(ClipMode::Rectangle) , rect(rect) {} const ClipMode mode; bool intersectWithRoot = false; // Bounds of the clipping area, used to define the scissor, and define which // portion of the stencil is updated/used Rect rect; Loading Loading @@ -173,8 +174,8 @@ public: return mMode == ClipMode::RectangleList; } const ClipBase* serializeClip(LinearAllocator& allocator); const ClipBase* serializeIntersectedClip(LinearAllocator& allocator, WARN_UNUSED_RESULT const ClipBase* serializeClip(LinearAllocator& allocator); WARN_UNUSED_RESULT const ClipBase* serializeIntersectedClip(LinearAllocator& allocator, const ClipBase* recordedClip, const Matrix4& recordedClipTransform); void applyClip(const ClipBase* recordedClip, const Matrix4& recordedClipTransform); Loading Loading @@ -214,6 +215,7 @@ private: ClipMode mMode; bool mPostViewportClipObserved = false; bool mReplaceOpObserved = false; /** * If mLastSerialization is non-null, it represents an already serialized copy Loading libs/hwui/FrameBuilder.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -462,7 +462,7 @@ void FrameBuilder::deferRenderNodeOpImpl(const RenderNodeOp& op) { int count = mCanvasState.save(SaveFlags::MatrixClip); // apply state from RecordedOp (clip first, since op's clip is transformed by current matrix) mCanvasState.writableSnapshot()->mutateClipArea().applyClip(op.localClip, mCanvasState.writableSnapshot()->applyClip(op.localClip, *mCanvasState.currentSnapshot()->transform); mCanvasState.concatMatrix(op.localMatrix); Loading Loading
libs/hwui/Android.mk +3 −2 Original line number Diff line number Diff line Loading @@ -248,16 +248,17 @@ LOCAL_SRC_FILES += \ tests/unit/FatVectorTests.cpp \ tests/unit/GlopBuilderTests.cpp \ tests/unit/GpuMemoryTrackerTests.cpp \ tests/unit/GradientCacheTests.cpp \ tests/unit/LayerUpdateQueueTests.cpp \ tests/unit/LinearAllocatorTests.cpp \ tests/unit/MatrixTests.cpp \ tests/unit/OffscreenBufferPoolTests.cpp \ tests/unit/RenderNodeTests.cpp \ tests/unit/SkiaBehaviorTests.cpp \ tests/unit/SnapshotTests.cpp \ tests/unit/StringUtilsTests.cpp \ tests/unit/TextDropShadowCacheTests.cpp \ tests/unit/VectorDrawableTests.cpp \ tests/unit/GradientCacheTests.cpp tests/unit/VectorDrawableTests.cpp ifeq (true, $(HWUI_NEW_OPS)) LOCAL_SRC_FILES += \ Loading
libs/hwui/BakedOpState.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& s } // resolvedClipRect = intersect(parentMatrix * localClip, parentClip) clipState = snapshot.mutateClipArea().serializeIntersectedClip(allocator, clipState = snapshot.serializeIntersectedClip(allocator, recordedOp.localClip, *(snapshot.transform)); LOG_ALWAYS_FATAL_IF(!clipState, "must clip!"); Loading Loading @@ -85,8 +85,7 @@ ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& s ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot, const Matrix4& localTransform, const ClipBase* localClip) { transform.loadMultiply(*snapshot.transform, localTransform); clipState = snapshot.mutateClipArea().serializeIntersectedClip(allocator, localClip, *(snapshot.transform)); clipState = snapshot.serializeIntersectedClip(allocator, localClip, *(snapshot.transform)); clippedBounds = clipState->rect; clipSideFlags = OpClipSideFlags::Full; localProjectionPathMask = nullptr; Loading
libs/hwui/ClipArea.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,7 @@ void ClipArea::setClip(float left, float top, float right, float bottom) { void ClipArea::clipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op) { if (op == SkRegion::kReplace_Op) mReplaceOpObserved = true; if (!mPostViewportClipObserved && op == SkRegion::kIntersect_Op) op = SkRegion::kReplace_Op; onClipUpdated(); switch (mMode) { Loading @@ -233,6 +234,7 @@ void ClipArea::clipRectWithTransform(const Rect& r, const mat4* transform, } void ClipArea::clipRegion(const SkRegion& region, SkRegion::Op op) { if (op == SkRegion::kReplace_Op) mReplaceOpObserved = true; if (!mPostViewportClipObserved && op == SkRegion::kIntersect_Op) op = SkRegion::kReplace_Op; onClipUpdated(); enterRegionMode(); Loading @@ -242,6 +244,7 @@ void ClipArea::clipRegion(const SkRegion& region, SkRegion::Op op) { void ClipArea::clipPathWithTransform(const SkPath& path, const mat4* transform, SkRegion::Op op) { if (op == SkRegion::kReplace_Op) mReplaceOpObserved = true; if (!mPostViewportClipObserved && op == SkRegion::kIntersect_Op) op = SkRegion::kReplace_Op; onClipUpdated(); SkMatrix skTransform; Loading Loading @@ -379,6 +382,7 @@ const ClipBase* ClipArea::serializeClip(LinearAllocator& allocator) { serialization->rect.set(mClipRegion.getBounds()); break; } serialization->intersectWithRoot = mReplaceOpObserved; // TODO: this is only done for draw time, should eventually avoid for record time serialization->rect.snapToPixelBoundaries(); mLastSerialization = serialization; Loading
libs/hwui/ClipArea.h +4 −2 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ struct ClipBase { : mode(ClipMode::Rectangle) , rect(rect) {} const ClipMode mode; bool intersectWithRoot = false; // Bounds of the clipping area, used to define the scissor, and define which // portion of the stencil is updated/used Rect rect; Loading Loading @@ -173,8 +174,8 @@ public: return mMode == ClipMode::RectangleList; } const ClipBase* serializeClip(LinearAllocator& allocator); const ClipBase* serializeIntersectedClip(LinearAllocator& allocator, WARN_UNUSED_RESULT const ClipBase* serializeClip(LinearAllocator& allocator); WARN_UNUSED_RESULT const ClipBase* serializeIntersectedClip(LinearAllocator& allocator, const ClipBase* recordedClip, const Matrix4& recordedClipTransform); void applyClip(const ClipBase* recordedClip, const Matrix4& recordedClipTransform); Loading Loading @@ -214,6 +215,7 @@ private: ClipMode mMode; bool mPostViewportClipObserved = false; bool mReplaceOpObserved = false; /** * If mLastSerialization is non-null, it represents an already serialized copy Loading
libs/hwui/FrameBuilder.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -462,7 +462,7 @@ void FrameBuilder::deferRenderNodeOpImpl(const RenderNodeOp& op) { int count = mCanvasState.save(SaveFlags::MatrixClip); // apply state from RecordedOp (clip first, since op's clip is transformed by current matrix) mCanvasState.writableSnapshot()->mutateClipArea().applyClip(op.localClip, mCanvasState.writableSnapshot()->applyClip(op.localClip, *mCanvasState.currentSnapshot()->transform); mCanvasState.concatMatrix(op.localMatrix); Loading