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

Unified Diff: gm/drawminibitmaprect.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/drawbitmaprect.cpp ('k') | gm/etc1bitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawminibitmaprect.cpp
diff --git a/gm/drawminibitmaprect.cpp b/gm/drawminibitmaprect.cpp
index f0ce1a2db6d57cfbf7181c27f0552a4c08b8533a..c494605daf37ce4437711a4bb9c336c6ecf08e59 100644
--- a/gm/drawminibitmaprect.cpp
+++ b/gm/drawminibitmaprect.cpp
@@ -13,7 +13,7 @@
#include "SkShader.h"
#include "SkSurface.h"
-static SkImage* makebm(SkCanvas* caller, int w, int h) {
+static sk_sp<SkImage> makebm(SkCanvas* caller, int w, int h) {
SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
if (nullptr == surface) {
@@ -56,7 +56,7 @@ static SkImage* makebm(SkCanvas* caller, int w, int h) {
rect.inset(wScalar / 8, hScalar / 8);
mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4);
}
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
static const int gSize = 1024;
@@ -80,7 +80,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
if (nullptr == fImage) {
- fImage.reset(makebm(canvas, gSurfaceSize, gSurfaceSize));
+ fImage = makebm(canvas, gSurfaceSize, gSurfaceSize);
}
const SkRect dstRect = { 0, 0, SkIntToScalar(64), SkIntToScalar(64)};
@@ -113,7 +113,7 @@ protected:
// rect stays rect
break;
}
- canvas->drawImageRect(fImage, srcRect, dstRect, &paint,
+ canvas->drawImageRect(fImage.get(), srcRect, dstRect, &paint,
SkCanvas::kFast_SrcRectConstraint);
canvas->restore();
@@ -131,9 +131,9 @@ protected:
}
private:
- bool fAA;
- SkAutoTUnref<SkImage> fImage;
- SkString fName;
+ bool fAA;
+ sk_sp<SkImage> fImage;
+ SkString fName;
typedef skiagm::GM INHERITED;
};
« no previous file with comments | « gm/drawbitmaprect.cpp ('k') | gm/etc1bitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698