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

Unified Diff: gm/image_pict.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage 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/image.cpp ('k') | gm/image_shader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/image_pict.cpp
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index 52c9309bc87de440fc546ee5909acd95dd333e50..fd21d717c010e811bfd22248cda95bbd9b5d188a 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -36,8 +36,8 @@ static void draw_something(SkCanvas* canvas, const SkRect& bounds) {
*/
class ImagePictGM : public skiagm::GM {
SkAutoTUnref<SkPicture> fPicture;
- SkAutoTUnref<SkImage> fImage0;
- SkAutoTUnref<SkImage> fImage1;
+ sk_sp<SkImage> fImage0;
+ sk_sp<SkImage> fImage1;
public:
ImagePictGM() {}
@@ -61,18 +61,18 @@ protected:
SkMatrix matrix;
matrix.setTranslate(-100, -100);
- fImage0.reset(SkImage::NewFromPicture(fPicture, size, &matrix, nullptr));
+ fImage0 = SkImage::MakeFromPicture(sk_ref_sp(fPicture.get()), size, &matrix, nullptr);
matrix.postTranslate(-50, -50);
matrix.postRotate(45);
matrix.postTranslate(50, 50);
- fImage1.reset(SkImage::NewFromPicture(fPicture, size, &matrix, nullptr));
+ fImage1 = SkImage::MakeFromPicture(sk_ref_sp(fPicture.get()), size, &matrix, nullptr);
}
void drawSet(SkCanvas* canvas) const {
SkMatrix matrix = SkMatrix::MakeTrans(-100, -100);
canvas->drawPicture(fPicture, &matrix, nullptr);
- canvas->drawImage(fImage0, 150, 0);
- canvas->drawImage(fImage1, 300, 0);
+ canvas->drawImage(fImage0.get(), 150, 0);
+ canvas->drawImage(fImage1.get(), 300, 0);
}
void onDraw(SkCanvas* canvas) override {
@@ -216,7 +216,7 @@ public:
surface->getCanvas()->clear(0);
surface->getCanvas()->translate(-100, -100);
surface->getCanvas()->drawPicture(pic);
- SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
+ sk_sp<SkImage> image(surface->makeImageSnapshot());
fTexture.reset(SkRef(as_IB(image)->peekTexture()));
}
protected:
« no previous file with comments | « gm/image.cpp ('k') | gm/image_shader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698