aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-01-12 10:13:40 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-12 16:38:34 +0000
commit693fdbd6b81a860657612e7604430dd55d6e721b (patch)
tree6032cec90b209da8349a684e899b72b94edef49c /src/core
parenta005acc036f8772cb6537b71d366825653888636 (diff)
refFoo variant for getters that naturally have a sk_sp
BUG=skia: Change-Id: I13afa1b81e8a72d93e45fb4d37228be196b0f388 Reviewed-on: https://skia-review.googlesource.com/6923 Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCanvas.cpp4
-rw-r--r--src/core/SkDraw.cpp2
-rw-r--r--src/core/SkPaint.cpp17
3 files changed, 17 insertions, 6 deletions
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