Index: samplecode/SampleAARectModes.cpp |
diff --git a/samplecode/SampleAARectModes.cpp b/samplecode/SampleAARectModes.cpp |
index 43392235c9fed3a0fee0e1dfb9aad45176ca299c..8066e682b18b2cb17a2528a2fa6594c9aa2d4e87 100644 |
--- a/samplecode/SampleAARectModes.cpp |
+++ b/samplecode/SampleAARectModes.cpp |
@@ -35,9 +35,7 @@ const int gHeight = 64; |
const SkScalar W = SkIntToScalar(gWidth); |
const SkScalar H = SkIntToScalar(gHeight); |
-static SkScalar drawCell(SkCanvas* canvas, SkXfermode* mode, |
- SkAlpha a0, SkAlpha a1) { |
- |
+static SkScalar drawCell(SkCanvas* canvas, const sk_sp<SkXfermode>& mode, SkAlpha a0, SkAlpha a1) { |
SkPaint paint; |
paint.setAntiAlias(true); |
@@ -109,17 +107,15 @@ protected: |
canvas->translate(W * 5, 0); |
canvas->save(); |
} |
- SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); |
+ sk_sp<SkXfermode> mode = SkXfermode::Make(gModes[i].fMode); |
canvas->drawRect(bounds, fBGPaint); |
canvas->saveLayer(&bounds, nullptr); |
- SkScalar dy = drawCell(canvas, mode, |
- gAlphaValue[alpha & 1], |
+ SkScalar dy = drawCell(canvas, mode, gAlphaValue[alpha & 1], |
gAlphaValue[alpha & 2]); |
canvas->restore(); |
canvas->translate(0, dy * 5 / 4); |
- SkSafeUnref(mode); |
} |
canvas->restore(); |
canvas->restore(); |