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

Commit 7611bd1d authored by Doris Liu's avatar Doris Liu Committed by android-build-merger
Browse files

Merge "Fix ref count of fillGradient and strokeGradient" into nyc-dev

am: da62de4f

* commit 'da62de4f':
  Fix ref count of fillGradient and strokeGradient

Change-Id: Id4aa38d26fd568f4a312fd5ba507306b84ce8ac7
parents d39f9458 da62de4f
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -219,22 +219,24 @@ public:
            int fillType = 0; /* non-zero or kWinding_FillType in Skia */
        };
        FullPathProperties(Node* mNode) : Properties(mNode), mTrimDirty(false) {}
        ~FullPathProperties() {
            SkSafeUnref(fillGradient);
            SkSafeUnref(strokeGradient);
        }
        void syncProperties(const FullPathProperties& prop) {
            mPrimitiveFields = prop.mPrimitiveFields;
            mTrimDirty = true;
            fillGradient.reset(prop.fillGradient);
            strokeGradient.reset(prop.strokeGradient);
            UPDATE_SKPROP(fillGradient, prop.fillGradient);
            UPDATE_SKPROP(strokeGradient, prop.strokeGradient);
            onPropertyChanged();
        }
        void setFillGradient(SkShader* gradient) {
            if(fillGradient != gradient){
                fillGradient.reset(gradient);
            if(UPDATE_SKPROP(fillGradient, gradient)) {
                onPropertyChanged();
            }
        }
        void setStrokeGradient(SkShader* gradient) {
            if(strokeGradient != gradient){
                strokeGradient.reset(gradient);
            if(UPDATE_SKPROP(strokeGradient, gradient)) {
                onPropertyChanged();
            }
        }
@@ -346,8 +348,8 @@ public:
            count,
        };
        PrimitiveFields mPrimitiveFields;
        SkAutoTUnref<SkShader> fillGradient;
        SkAutoTUnref<SkShader> strokeGradient;
        SkShader* fillGradient = nullptr;
        SkShader* strokeGradient = nullptr;
    };

    // Called from UI thread