Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2556)

Unified Diff: samplecode/SampleAll.cpp

Issue 1813123003: Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.or… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move flag into sktypes, so it is visible to both paint and other patheffect clients Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/ClockFaceView.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « samplecode/ClockFaceView.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698