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

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

Merge "Add fast path for roundrect Outline changes"

parents d416398c 40de9f28
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -484,13 +484,13 @@ static JNINativeMethod gMethods[] = {
    { "nSetProjectBackwards",  "!(JZ)Z",  (void*) android_view_RenderNode_setProjectBackwards },
    { "nSetProjectionReceiver","!(JZ)Z",  (void*) android_view_RenderNode_setProjectionReceiver },

    { "nSetOutlineRoundRect",  "(JIIIIFF)Z", (void*) android_view_RenderNode_setOutlineRoundRect },
    { "nSetOutlineConvexPath", "(JJF)Z", (void*) android_view_RenderNode_setOutlineConvexPath },
    { "nSetOutlineEmpty",      "(J)Z",   (void*) android_view_RenderNode_setOutlineEmpty },
    { "nSetOutlineNone",       "(J)Z",   (void*) android_view_RenderNode_setOutlineNone },
    { "nSetOutlineRoundRect",  "!(JIIIIFF)Z", (void*) android_view_RenderNode_setOutlineRoundRect },
    { "nSetOutlineConvexPath", "!(JJF)Z", (void*) android_view_RenderNode_setOutlineConvexPath },
    { "nSetOutlineEmpty",      "!(J)Z",   (void*) android_view_RenderNode_setOutlineEmpty },
    { "nSetOutlineNone",       "!(J)Z",   (void*) android_view_RenderNode_setOutlineNone },
    { "nHasShadow",            "!(J)Z",   (void*) android_view_RenderNode_hasShadow },
    { "nSetClipToOutline",     "!(JZ)Z",  (void*) android_view_RenderNode_setClipToOutline },
    { "nSetRevealClip",        "(JZFFF)Z", (void*) android_view_RenderNode_setRevealClip },
    { "nSetRevealClip",        "!(JZFFF)Z", (void*) android_view_RenderNode_setRevealClip },

    { "nSetAlpha",             "!(JF)Z",  (void*) android_view_RenderNode_setAlpha },
    { "nSetHasOverlappingRendering", "!(JZ)Z",
+19 −3
Original line number Diff line number Diff line
@@ -33,13 +33,29 @@ public:
            , mAlpha(0.0f) {}

    void setRoundRect(int left, int top, int right, int bottom, float radius, float alpha) {
        mAlpha = alpha;
        if (mType == kOutlineType_RoundRect
                && left == mBounds.left
                && right == mBounds.right
                && top == mBounds.top
                && bottom == mBounds.bottom
                && radius == mRadius) {
            // nothing to change, don't do any work
            return;
        }

        mType = kOutlineType_RoundRect;
        mBounds.set(left, top, right, bottom);
        mRadius = radius;

        // update mPath to reflect new outline
        mPath.reset();
        if (MathUtils::isPositive(radius)) {
            mPath.addRoundRect(SkRect::MakeLTRB(left, top, right, bottom),
                    radius, radius);
        mAlpha = alpha;
        } else {
            mPath.addRect(left, top, right, bottom);
        }
    }

    void setConvexPath(const SkPath* outline, float alpha) {