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

Unified Diff: gm/drawbitmaprect.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/drawatlascolor.cpp ('k') | gm/drawminibitmaprect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawbitmaprect.cpp
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 7ee2271c5cb10f91b7aaad2d57fc0dc1165973f9..8ec7cee28e421968a612700af8ef81a3a33a6922 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -33,7 +33,7 @@ static SkBitmap make_chessbm(int w, int h) {
return bm;
}
-static SkImage* makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, int h) {
+static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, int h) {
SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info));
@@ -81,7 +81,7 @@ static SkImage* makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, int h) {
mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4);
}
- SkImage* image = surface->newImageSnapshot();
+ auto image = surface->makeImageSnapshot();
SkBitmap tempBM;
@@ -125,10 +125,10 @@ public:
}
}
- DrawRectRectProc* fProc;
- SkBitmap fLargeBitmap;
- SkAutoTUnref<SkImage> fImage;
- SkString fName;
+ DrawRectRectProc* fProc;
+ SkBitmap fLargeBitmap;
+ sk_sp<SkImage> fImage;
+ SkString fName;
protected:
SkString onShortName() override { return fName; }
@@ -136,7 +136,7 @@ protected:
SkISize onISize() override { return SkISize::Make(gSize, gSize); }
void setupImage(SkCanvas* canvas) {
- fImage.reset(makebm(canvas, &fLargeBitmap, gBmpSize, gBmpSize));
+ fImage = makebm(canvas, &fLargeBitmap, gBmpSize, gBmpSize);
}
void onDraw(SkCanvas* canvas) override {
@@ -172,7 +172,7 @@ protected:
for (int h = 1; h <= kMaxSrcRectSize; h *= 4) {
SkIRect srcRect = SkIRect::MakeXYWH((gBmpSize - w) / 2, (gBmpSize - h) / 2, w, h);
- fProc(canvas, fImage, fLargeBitmap, srcRect, dstRect);
+ fProc(canvas, fImage.get(), fLargeBitmap, srcRect, dstRect);
SkString label;
label.appendf("%d x %d", w, h);
« no previous file with comments | « gm/drawatlascolor.cpp ('k') | gm/drawminibitmaprect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698