Index: samplecode/SampleAll.cpp |
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp |
index 90fc5bdb166778455109cba722d340e92cde1e2d..7c0557fc40e4a61a2a0a97fb1c72dde7736771c5 100644 |
--- a/samplecode/SampleAll.cpp |
+++ b/samplecode/SampleAll.cpp |
@@ -141,7 +141,7 @@ static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { |
static void r5(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { |
rastBuilder->addLayer(p); |
- p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->unref(); |
+ p.setPathEffect(SkDiscretePathEffect::Make(SK_Scalar1*4, SK_Scalar1*3)); |
p.setXfermodeMode(SkXfermode::kSrcOut_Mode); |
rastBuilder->addLayer(p); |
} |
@@ -184,7 +184,7 @@ static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { |
SkMatrix lattice; |
lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); |
lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
- p.setPathEffect(new Dot2DPathEffect(SK_Scalar1*4, lattice))->unref(); |
+ p.setPathEffect(sk_make_sp<Dot2DPathEffect>(SK_Scalar1*4, lattice)); |
rastBuilder->addLayer(p); |
} |
@@ -194,7 +194,7 @@ static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { |
SkMatrix lattice; |
lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); |
lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
- p.setPathEffect(new Dot2DPathEffect(SK_Scalar1*2, lattice))->unref(); |
+ p.setPathEffect(sk_make_sp<Dot2DPathEffect>(SK_Scalar1*2, lattice)); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
rastBuilder->addLayer(p); |
@@ -211,7 +211,7 @@ static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { |
SkMatrix lattice; |
lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); |
lattice.postRotate(SkIntToScalar(30), 0, 0); |
- p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref(); |
+ p.setPathEffect(SkLine2DPathEffect::Make(SK_Scalar1*2, lattice)); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
rastBuilder->addLayer(p); |
@@ -416,7 +416,7 @@ protected: |
canvas->translate(SkIntToScalar(50), 0); |
paint.setColor(SK_ColorYELLOW); |
paint.setShader(linear); |
- paint.setPathEffect(pathEffectTest())->unref(); |
+ paint.setPathEffect(pathEffectTest()); |
canvas->drawRect(rect, paint); |
paint.setPathEffect(nullptr); |
@@ -481,7 +481,7 @@ protected: |
return this->INHERITED::onFindClickHandler(x, y, modi); |
} |
- SkPathEffect* pathEffectTest() { |
+ sk_sp<SkPathEffect> pathEffectTest() { |
static const int gXY[] = { 1, 0, 0, -1, 2, -1, 3, 0, 2, 1, 0, 1 }; |
SkScalar gPhase = 0; |
SkPath path; |
@@ -490,14 +490,11 @@ protected: |
path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1])); |
path.close(); |
path.offset(SkIntToScalar(-6), 0); |
- SkPathEffect* outer = SkPath1DPathEffect::Create(path, SkIntToScalar(12), |
+ auto outer = SkPath1DPathEffect::Make(path, SkIntToScalar(12), |
gPhase, SkPath1DPathEffect::kRotate_Style); |
- SkPathEffect* inner = SkDiscretePathEffect::Create(SkIntToScalar(2), |
+ auto inner = SkDiscretePathEffect::Make(SkIntToScalar(2), |
SkIntToScalar(1)/10); // SkCornerPathEffect(SkIntToScalar(2)); |
- SkPathEffect* result = SkComposePathEffect::Create(outer, inner); |
- outer->unref(); |
- inner->unref(); |
- return result; |
+ return SkComposePathEffect::Make(outer, inner); |
} |
sk_sp<SkShader> shaderTest() { |