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

Unified Diff: gm/recordopts.cpp

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rely on RVO in picturerecorder 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 | « gm/pictureshadertile.cpp ('k') | gm/verylargebitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/recordopts.cpp
diff --git a/gm/recordopts.cpp b/gm/recordopts.cpp
index 58cbbf3b9f90139ceac7e34fd634052a786f62dd..97d13cb9c90836d616044b18c400f3e3ebcc0920 100644
--- a/gm/recordopts.cpp
+++ b/gm/recordopts.cpp
@@ -100,7 +100,7 @@ static void draw_svg_opacity_and_filter_layer_sequence(SkCanvas* canvas, SkColor
InstallDetectorFunc installDetector) {
SkRect targetRect(SkRect::MakeWH(SkIntToScalar(kTestRectSize), SkIntToScalar(kTestRectSize)));
- SkAutoTUnref<SkPicture> shape;
+ sk_sp<SkPicture> shape;
{
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kTestRectSize + 2),
@@ -108,7 +108,7 @@ static void draw_svg_opacity_and_filter_layer_sequence(SkCanvas* canvas, SkColor
SkPaint shapePaint;
shapePaint.setColor(shapeColor);
canvas->drawRect(targetRect, shapePaint);
- shape.reset(recorder.endRecordingAsPicture());
+ shape = recorder.finishRecordingAsPicture();
}
SkPaint layerPaint;
@@ -117,7 +117,7 @@ static void draw_svg_opacity_and_filter_layer_sequence(SkCanvas* canvas, SkColor
canvas->save();
canvas->clipRect(targetRect);
SkPaint drawPaint;
- drawPaint.setImageFilter(SkPictureImageFilter::Create(shape))->unref();
+ drawPaint.setImageFilter(SkPictureImageFilter::Create(shape.get()))->unref();
installDetector(&drawPaint);
canvas->saveLayer(&targetRect, &drawPaint);
canvas->restore();
@@ -161,8 +161,7 @@ DEF_SIMPLE_GM(recordopts, canvas, (kTestRectSize+1)*2, (kTestRectSize+1)*15) {
drawTestSequence(recorder.beginRecording(SkIntToScalar(kTestRectSize),
SkIntToScalar(kTestRectSize)),
shapeColor, no_detector_install);
- SkAutoTUnref<SkPicture> optimizedPicture(recorder.endRecordingAsPicture());
- optimizedPicture->playback(canvas);
+ recorder.finishRecordingAsPicture()->playback(canvas);
canvas->flush();
}
canvas->restore();
@@ -203,8 +202,7 @@ DEF_SIMPLE_GM(recordopts, canvas, (kTestRectSize+1)*2, (kTestRectSize+1)*15) {
drawTestSequence(recorder.beginRecording(SkIntToScalar(kTestRectSize),
SkIntToScalar(kTestRectSize)),
shapeColor, detectorInstallFunc);
- SkAutoTUnref<SkPicture> optimizedPicture(recorder.endRecordingAsPicture());
- optimizedPicture->playback(canvas);
+ recorder.finishRecordingAsPicture()->playback(canvas);
canvas->flush();
}
« no previous file with comments | « gm/pictureshadertile.cpp ('k') | gm/verylargebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698