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

Unified Diff: samplecode/ClockFaceView.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 | « include/effects/SkDiscretePathEffect.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/ClockFaceView.cpp
diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp
index 11684e11ada34150d462a6e744c7b333512fba64..f5b43fb82f72864cd37bc27320860d999c7d9c7c 100644
--- a/samplecode/ClockFaceView.cpp
+++ b/samplecode/ClockFaceView.cpp
@@ -132,16 +132,16 @@ private:
SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { return new InverseFillPE; }
-static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) {
+static sk_sp<SkPathEffect> makepe(float interp, SkTDArray<SkPoint>* pts) {
SkMatrix lattice;
SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp);
lattice.setScale(rad*2, rad*2, 0, 0);
lattice.postSkew(SK_Scalar1/3, 0, 0, 0);
- return new Dot2DPathEffect(rad, lattice, pts);
+ return sk_make_sp<Dot2DPathEffect>(rad, lattice, pts);
}
static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar interp) {
- p.setPathEffect(makepe(SkScalarToFloat(interp), nullptr))->unref();
+ p.setPathEffect(makepe(SkScalarToFloat(interp), nullptr));
rastBuilder->addLayer(p);
#if 0
p.setPathEffect(new InverseFillPE())->unref();
@@ -201,7 +201,7 @@ protected:
static void drawdots(SkCanvas* canvas, const SkPaint& orig) {
SkTDArray<SkPoint> pts;
- SkPathEffect* pe = makepe(0, &pts);
+ auto pe = makepe(0, &pts);
SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
SkPath path, dstPath;
@@ -212,8 +212,7 @@ protected:
p.setAntiAlias(true);
p.setStrokeWidth(10);
p.setColor(SK_ColorRED);
- canvas->drawPoints(SkCanvas::kPoints_PointMode, pts.count(), pts.begin(),
- p);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, pts.count(), pts.begin(), p);
}
virtual void onDraw(SkCanvas* canvas) {
« no previous file with comments | « include/effects/SkDiscretePathEffect.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698