Index: samplecode/SampleXfermodesBlur.cpp |
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp |
index 52419a06d0adb4d3669bc64dd14460aaa4dcd127..cab13391ed0468d6ef1a40eb37e48a5e378ce362 100644 |
--- a/samplecode/SampleXfermodesBlur.cpp |
+++ b/samplecode/SampleXfermodesBlur.cpp |
@@ -39,7 +39,7 @@ class XfermodesBlurView : public SampleView { |
SkBitmap fBG; |
SkBitmap fSrcB, fDstB; |
- void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha, |
+ void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha, |
SkScalar x, SkScalar y) { |
SkPaint p; |
SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
@@ -58,7 +58,7 @@ class XfermodesBlurView : public SampleView { |
r.offset(x, y); |
canvas->drawOval(r, p); |
- p.setXfermode(mode); |
+ p.setXfermode(std::move(mode)); |
// draw a square overlapping the circle |
// in the lower right of the canvas |
@@ -163,8 +163,6 @@ protected: |
for (int twice = 0; twice < 2; twice++) { |
SkScalar x = x0, y = 0; |
for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) { |
- SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); |
- SkAutoUnref aur(mode); |
SkRect r; |
r.set(x, y, x+w, y+h); |
@@ -174,7 +172,8 @@ protected: |
canvas->drawRect(r, p); |
canvas->saveLayer(&r, nullptr); |
- draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop); |
+ draw_mode(canvas, SkXfermode::Make(gModes[i].fMode), |
+ twice ? 0x88 : 0xFF, r.fLeft, r.fTop); |
canvas->restore(); |
r.inset(-SK_ScalarHalf, -SK_ScalarHalf); |