diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/animator/SkDrawPaint.cpp | 4 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 4 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPaint.cpp | 17 | ||||
-rw-r--r-- | src/effects/SkLayerDrawLooper.cpp | 8 | ||||
-rw-r--r-- | src/gpu/text/GrTextUtils.cpp | 2 | ||||
-rw-r--r-- | src/svg/SkSVGDevice.cpp | 3 |
7 files changed, 25 insertions, 15 deletions
diff --git a/src/animator/SkDrawPaint.cpp b/src/animator/SkDrawPaint.cpp index 1026630eb1..bbd02221ed 100644 --- a/src/animator/SkDrawPaint.cpp +++ b/src/animator/SkDrawPaint.cpp @@ -233,11 +233,11 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const { if (pathEffect == nullptr) paint->setPathEffect(nullptr); else if (pathEffect != (SkDrawPathEffect*) -1) - paint->setPathEffect(sk_ref_sp(pathEffect->getPathEffect())); + paint->setPathEffect(pathEffect->refPathEffect()); if (shader == nullptr) paint->setShader(nullptr); else if (shader != (SkDrawShader*) -1) - paint->setShader(sk_ref_sp(shader->getShader())); + paint->setShader(shader->refShader()); if (strikeThru != -1) paint->setStrikeThruText(SkToBool(strikeThru)); if (strokeCap != -1) diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 4716053197..8bcc421432 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -485,7 +485,7 @@ public: * draw onto the previous layer using the xfermode from the original paint. */ SkPaint tmp; - tmp.setImageFilter(sk_ref_sp(fPaint->getImageFilter())); + tmp.setImageFilter(fPaint->refImageFilter()); tmp.setBlendMode(fPaint->getBlendMode()); SkRect storage; if (rawBounds) { @@ -1180,7 +1180,7 @@ static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i return SkImageInfo::MakeN32(w, h, alphaType); } else { // keep the same characteristics as the prev - return SkImageInfo::Make(w, h, prev.colorType(), alphaType, sk_ref_sp(prev.colorSpace())); + return SkImageInfo::Make(w, h, prev.colorType(), alphaType, prev.refColorSpace()); } } diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 2f3dd3eccd..f9f9a28aeb 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1648,7 +1648,7 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, // Now restore the original settings, so we "draw" with whatever style/stroking. paint.setStyle(origPaint.getStyle()); - paint.setPathEffect(sk_ref_sp(origPaint.getPathEffect())); + paint.setPathEffect(origPaint.refPathEffect()); while (text < stop) { const SkGlyph& glyph = glyphCacheProc(cache.get(), &text); diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index fb89a67127..ea33d5b6c9 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -184,6 +184,17 @@ bool operator==(const SkPaint& a, const SkPaint& b) { #undef EQUAL } +#define DEFINE_REF_FOO(type) sk_sp<Sk##type> SkPaint::ref##type() const { return f##type; } +DEFINE_REF_FOO(ColorFilter) +DEFINE_REF_FOO(DrawLooper) +DEFINE_REF_FOO(ImageFilter) +DEFINE_REF_FOO(MaskFilter) +DEFINE_REF_FOO(PathEffect) +DEFINE_REF_FOO(Rasterizer) +DEFINE_REF_FOO(Shader) +DEFINE_REF_FOO(Typeface) +#undef DEFINE_REF_FOO + void SkPaint::reset() { SkPaint init; *this = init; @@ -2244,12 +2255,12 @@ SkTextBaseIter::SkTextBaseIter(const char text[], size_t length, sk_sp<SkPathEffect> pe; if (!applyStrokeAndPathEffects) { - style = paint.getStyle(); // restore - pe = sk_ref_sp(paint.getPathEffect()); // restore + style = paint.getStyle(); // restore + pe = paint.refPathEffect(); // restore } fPaint.setStyle(style); fPaint.setPathEffect(pe); - fPaint.setMaskFilter(sk_ref_sp(paint.getMaskFilter())); // restore + fPaint.setMaskFilter(paint.refMaskFilter()); // restore // now compute fXOffset if needed diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp index e72d137c7b..737cdf6cc2 100644 --- a/src/effects/SkLayerDrawLooper.cpp +++ b/src/effects/SkLayerDrawLooper.cpp @@ -92,16 +92,16 @@ void SkLayerDrawLooper::LayerDrawLooperContext::ApplyInfo( } if (bits & kPathEffect_Bit) { - dst->setPathEffect(sk_ref_sp(src.getPathEffect())); + dst->setPathEffect(src.refPathEffect()); } if (bits & kMaskFilter_Bit) { - dst->setMaskFilter(sk_ref_sp(src.getMaskFilter())); + dst->setMaskFilter(src.refMaskFilter()); } if (bits & kShader_Bit) { - dst->setShader(sk_ref_sp(src.getShader())); + dst->setShader(src.refShader()); } if (bits & kColorFilter_Bit) { - dst->setColorFilter(sk_ref_sp(src.getColorFilter())); + dst->setColorFilter(src.refColorFilter()); } if (bits & kXfermode_Bit) { dst->setBlendMode(src.getBlendMode()); diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index 5793aded67..548d4aa27e 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -524,7 +524,7 @@ void GrTextUtils::DrawPosTextAsPath(GrContext* context, // Now restore the original settings, so we "draw" with whatever style/stroking. paint.setStyle(origPaint.getStyle()); - paint.setPathEffect(sk_ref_sp(origPaint.getPathEffect())); + paint.setPathEffect(origPaint.refPathEffect()); while (text < stop) { const SkGlyph& glyph = glyphCacheProc(cache, &text); diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp index 09bd09bf2e..06679daf9e 100644 --- a/src/svg/SkSVGDevice.cpp +++ b/src/svg/SkSVGDevice.cpp @@ -535,8 +535,7 @@ void SkSVGDevice::AutoElement::addTextAttributes(const SkPaint& paint) { SkString familyName; SkTHashSet<SkString> familySet; - sk_sp<const SkTypeface> tface(paint.getTypeface() ? - sk_ref_sp(paint.getTypeface()) : SkTypeface::MakeDefault()); + sk_sp<SkTypeface> tface(paint.getTypeface() ? paint.refTypeface() : SkTypeface::MakeDefault()); SkASSERT(tface); SkTypeface::Style style = tface->style(); |