Index: samplecode/SampleHairModes.cpp |
diff --git a/samplecode/SampleHairModes.cpp b/samplecode/SampleHairModes.cpp |
index 085581cfc958817da68e118b3ad7c6298da670d6..fd937e22a74da80075aea42d1703629ed5a3bec2 100644 |
--- a/samplecode/SampleHairModes.cpp |
+++ b/samplecode/SampleHairModes.cpp |
@@ -35,8 +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, sk_sp<SkXfermode> mode, SkAlpha a0, SkAlpha a1) { |
SkPaint paint; |
paint.setAntiAlias(true); |
@@ -105,17 +104,14 @@ protected: |
canvas->translate(W * 5, 0); |
canvas->save(); |
} |
- SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); |
- |
canvas->drawRect(bounds, fBGPaint); |
canvas->saveLayer(&bounds, nullptr); |
- SkScalar dy = drawCell(canvas, mode, |
+ SkScalar dy = drawCell(canvas, SkXfermode::Make(gModes[i].fMode), |
gAlphaValue[alpha & 1], |
gAlphaValue[alpha & 2]); |
canvas->restore(); |
canvas->translate(0, dy * 5 / 4); |
- SkSafeUnref(mode); |
} |
canvas->restore(); |
canvas->restore(); |