Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3060657 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Support replace op in new pipeline" into nyc-dev

parents d8ca02f2 04d46eb6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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 += \
+2 −3
Original line number Diff line number Diff line
@@ -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!");

@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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) {
@@ -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();
@@ -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;
@@ -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;
+4 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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);

@@ -214,6 +215,7 @@ private:

    ClipMode mMode;
    bool mPostViewportClipObserved = false;
    bool mReplaceOpObserved = false;

    /**
     * If mLastSerialization is non-null, it represents an already serialized copy
+1 −1
Original line number Diff line number Diff line
@@ -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