aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/image_pict.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-18 07:25:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-18 07:25:55 -0700
commitca2622ba051829fed5f30facd74c5b41cd4b931c (patch)
tree3d8248b7764e500f857b3d6cfb6866e72b632199 /gm/image_pict.cpp
parenteb75c7db3a7372de68347d0df8d58acebc33a9ad (diff)
return pictures as sk_sp
Diffstat (limited to 'gm/image_pict.cpp')
-rw-r--r--gm/image_pict.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index fd21d717c0..b5eb522dfa 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -35,7 +35,7 @@ static void draw_something(SkCanvas* canvas, const SkRect& bounds) {
* (correctly) when it is inside an image.
*/
class ImagePictGM : public skiagm::GM {
- SkAutoTUnref<SkPicture> fPicture;
+ sk_sp<SkPicture> fPicture;
sk_sp<SkImage> fImage0;
sk_sp<SkImage> fImage1;
public:
@@ -54,18 +54,18 @@ protected:
const SkRect bounds = SkRect::MakeXYWH(100, 100, 100, 100);
SkPictureRecorder recorder;
draw_something(recorder.beginRecording(bounds), bounds);
- fPicture.reset(recorder.endRecording());
+ fPicture = recorder.finishRecordingAsPicture();
// extract enough just for the oval.
const SkISize size = SkISize::Make(100, 100);
SkMatrix matrix;
matrix.setTranslate(-100, -100);
- fImage0 = SkImage::MakeFromPicture(sk_ref_sp(fPicture.get()), size, &matrix, nullptr);
+ fImage0 = SkImage::MakeFromPicture(fPicture, size, &matrix, nullptr);
matrix.postTranslate(-50, -50);
matrix.postRotate(45);
matrix.postTranslate(50, 50);
- fImage1 = SkImage::MakeFromPicture(sk_ref_sp(fPicture.get()), size, &matrix, nullptr);
+ fImage1 = SkImage::MakeFromPicture(fPicture, size, &matrix, nullptr);
}
void drawSet(SkCanvas* canvas) const {
@@ -254,7 +254,7 @@ static SkImageGenerator* make_tex_generator(GrContext* ctx, SkPicture* pic) {
class ImageCacheratorGM : public skiagm::GM {
SkString fName;
SkImageGenerator* (*fFactory)(GrContext*, SkPicture*);
- SkAutoTUnref<SkPicture> fPicture;
+ sk_sp<SkPicture> fPicture;
SkAutoTDelete<SkImageCacherator> fCache;
SkAutoTDelete<SkImageCacherator> fCacheSubset;
@@ -278,17 +278,17 @@ protected:
const SkRect bounds = SkRect::MakeXYWH(100, 100, 100, 100);
SkPictureRecorder recorder;
draw_something(recorder.beginRecording(bounds), bounds);
- fPicture.reset(recorder.endRecording());
+ fPicture = recorder.finishRecordingAsPicture();
}
void makeCaches(GrContext* ctx) {
- auto gen = fFactory(ctx, fPicture);
+ auto gen = fFactory(ctx, fPicture.get());
SkDEBUGCODE(const uint32_t genID = gen->uniqueID();)
fCache.reset(SkImageCacherator::NewFromGenerator(gen));
const SkIRect subset = SkIRect::MakeLTRB(50, 50, 100, 100);
- gen = fFactory(ctx, fPicture);
+ gen = fFactory(ctx, fPicture.get());
SkDEBUGCODE(const uint32_t genSubsetID = gen->uniqueID();)
fCacheSubset.reset(SkImageCacherator::NewFromGenerator(gen, &subset));