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

Commit 99ce4bda authored by Chris Craik's avatar Chris Craik Committed by Android Git Automerger
Browse files

am 08c96b55: Merge "Disable shadow overdraw avoidance in the inverse clip case"

* commit '08c96b55':
  Disable shadow overdraw avoidance in the inverse clip case
parents 4c0ef1cc 08c96b55
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1548,14 +1548,16 @@ private:
};

/**
 * Not a canvas operation, used only by 3d / z ordering logic in DisplayList::iterate()
 * Not a canvas operation, used only by 3d / z ordering logic in RenderNode::iterate()
 */
class DrawShadowOp : public DrawOp {
public:
    DrawShadowOp(const mat4& transformXY, const mat4& transformZ, float alpha,
    DrawShadowOp(const mat4& transformXY, const mat4& transformZ,
            float casterAlpha, bool casterUnclipped,
            float fallbackWidth, float fallbackHeight,
            const SkPath* outline, const SkPath* revealClip)
            : DrawOp(NULL), mTransformXY(transformXY), mTransformZ(transformZ), mAlpha(alpha),
            : DrawOp(NULL), mTransformXY(transformXY), mTransformZ(transformZ),
            mCasterAlpha(casterAlpha), mCasterUnclipped(casterUnclipped),
            mFallbackWidth(fallbackWidth), mFallbackHeight(fallbackHeight),
            mOutline(outline), mRevealClip(revealClip) {}

@@ -1572,7 +1574,8 @@ public:
            Op(casterPerimeter, *mRevealClip, kIntersect_PathOp, &casterPerimeter);
        }

        return renderer.drawShadow(mTransformXY, mTransformZ, mAlpha, &casterPerimeter);
        return renderer.drawShadow(mTransformXY, mTransformZ,
                mCasterAlpha, mCasterUnclipped, &casterPerimeter);
    }

    virtual void output(int level, uint32_t logFlags) const {
@@ -1584,7 +1587,8 @@ public:
private:
    const mat4 mTransformXY;
    const mat4 mTransformZ;
    const float mAlpha;
    const float mCasterAlpha;
    const bool mCasterUnclipped;
    const float mFallbackWidth;
    const float mFallbackHeight;

+2 −2
Original line number Diff line number Diff line
@@ -3203,7 +3203,7 @@ static void mapPointFakeZ(Vector3& point, const mat4& transformXY, const mat4& t
}

status_t OpenGLRenderer::drawShadow(const mat4& casterTransformXY, const mat4& casterTransformZ,
        float casterAlpha, const SkPath* casterPerimeter) {
        float casterAlpha, bool casterUnclipped, const SkPath* casterPerimeter) {
    if (currentSnapshot()->isIgnored()) return DrawGlInfo::kStatusDone;

    // TODO: use quickRejectWithScissor. For now, always force enable scissor.
@@ -3260,7 +3260,7 @@ status_t OpenGLRenderer::drawShadow(const mat4& casterTransformXY, const mat4& c
    Rect casterBounds(casterPerimeter->getBounds());
    casterTransformXY.mapRect(casterBounds);

    bool isCasterOpaque = (casterAlpha == 1.0f);
    bool isCasterOpaque = (casterAlpha == 1.0f) && casterUnclipped;
    // draw caster's shadows
    if (mCaches.propertyAmbientShadowStrength > 0) {
        paint.setARGB(casterAlpha * mCaches.propertyAmbientShadowStrength, 0, 0, 0);
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ public:
    virtual status_t drawRects(const float* rects, int count, const SkPaint* paint);

    status_t drawShadow(const mat4& casterTransformXY, const mat4& casterTransformZ,
            float casterAlpha, const SkPath* casterPerimeter);
            float casterAlpha, bool casterUnclipped, const SkPath* casterPerimeter);

    virtual void resetShader();
    virtual void setupShader(SkiaShader* shader);
+10 −1
Original line number Diff line number Diff line
@@ -433,8 +433,17 @@ void RenderNode::iterate3dChildren(const Vector<ZDrawDisplayListOpPair>& zTransl
                    const SkPath* revealClipPath = revealClip.hasConvexClip()
                            ?  revealClip.getPath() : NULL; // only pass the reveal clip's path if it's convex

                    /**
                     * The drawing area of the caster is always the same as the its perimeter (which
                     * the shadow system uses) *except* in the inverse clip case. Inform the shadow
                     * system that the caster's drawing area (as opposed to its perimeter) has been
                     * clipped, so that it knows the caster can't be opaque.
                     */
                    bool casterUnclipped = !revealClip.willClip() || revealClip.hasConvexClip();

                    DisplayListOp* shadowOp  = new (alloc) DrawShadowOp(
                            shadowMatrixXY, shadowMatrixZ, caster->properties().getAlpha(),
                            shadowMatrixXY, shadowMatrixZ,
                            caster->properties().getAlpha(), casterUnclipped,
                            caster->properties().getWidth(), caster->properties().getHeight(),
                            outlinePath, revealClipPath);
                    handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds());