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

Commit fca52b75 authored by Chris Craik's avatar Chris Craik
Browse files

Use path intersection instead of saveLayer+mesh to mask projected ripples

bug:14297149

SaveLayer's performance cost is high, and proportional to the surface
being projected onto. Since ripples (even unbounded ones) are now
always projected to the arbitrary background content behind them, this
cost is especially important to avoid.

This removes the last semi-secret, saveLayer from the projected
ripple implementation.

Also fixes the HW test app to correctly demonstrate this projection
masking behavior.

Additionaly, alters PathTessellator to gracefully handle
counter-clockwise paths, and simplifies the work done by
ShadowTessellator to ensure all of its paths are counterclockwise.

Change-Id: Ibe9e12812bd10a774e20b1d444a140c368cbba8c
parent aa1cd25d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -189,6 +189,9 @@ void CanvasState::setClippingRoundRect(LinearAllocator& allocator,
    mSnapshot->setClippingRoundRect(allocator, rect, radius, highPriority);
}

void CanvasState::setProjectionPathMask(LinearAllocator& allocator, const SkPath* path) {
    mSnapshot->setProjectionPathMask(allocator, path);
}

///////////////////////////////////////////////////////////////////////////////
// Quick Rejection
+1 −0
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ public:
    void setClippingOutline(LinearAllocator& allocator, const Outline* outline);
    void setClippingRoundRect(LinearAllocator& allocator,
            const Rect& rect, float radius, bool highPriority = true);
    void setProjectionPathMask(LinearAllocator& allocator, const SkPath* path);

    /**
     * Returns true if drawing in the rectangle (left, top, right, bottom)
+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ public:
        // Identical round rect clip state means both ops will clip in the same way, or not at all.
        // As the state objects are const, we can compare their pointers to determine mergeability
        if (lhs->mRoundRectClipState != rhs->mRoundRectClipState) return false;
        if (lhs->mProjectionPathMask != rhs->mProjectionPathMask) return false;

        /* Clipping compatibility check
         *
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public:
    mat4 mMatrix;
    float mAlpha;
    const RoundRectClipState* mRoundRectClipState;
    const ProjectionPathMask* mProjectionPathMask;
};

class OpStatePair {
+6 −0
Original line number Diff line number Diff line
@@ -134,6 +134,12 @@ public:

    uint8_t getType() const;

    void multiplyInverse(const Matrix4& v) {
        Matrix4 inv;
        inv.loadInverse(v);
        multiply(inv);
    }

    void multiply(const Matrix4& v) {
        Matrix4 u;
        u.loadMultiply(*this, v);
Loading