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

Unified Diff: gm/perspshaders.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/offsetimagefilter.cpp ('k') | gm/rectangletexture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/perspshaders.cpp
diff --git a/gm/perspshaders.cpp b/gm/perspshaders.cpp
index a29ef52f460305dff7d1f01febf1b0d07c820f27..b2ac3287f2dcfb6a13a87566c4bf8c7b32e1303c 100644
--- a/gm/perspshaders.cpp
+++ b/gm/perspshaders.cpp
@@ -11,7 +11,7 @@
#include "SkPath.h"
#include "SkSurface.h"
-static SkImage* make_image(SkCanvas* origCanvas, int w, int h) {
+static sk_sp<SkImage> make_image(SkCanvas* origCanvas, int w, int h) {
SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info));
if (nullptr == surface) {
@@ -20,7 +20,7 @@ static SkImage* make_image(SkCanvas* origCanvas, int w, int h) {
SkCanvas* canvas = surface->getCanvas();
sk_tool_utils::draw_checkerboard(canvas, SK_ColorRED, SK_ColorGREEN, w/10);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
namespace skiagm {
@@ -106,7 +106,7 @@ protected:
canvas->translate(SkIntToScalar(kCellSize), 0);
canvas->save();
canvas->concat(fPerspMatrix);
- canvas->drawImage(fImage, 0, 0, &filterPaint);
+ canvas->drawImage(fImage.get(), 0, 0, &filterPaint);
canvas->restore();
canvas->translate(SkIntToScalar(kCellSize), 0);
@@ -138,7 +138,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
if (!fImage) {
- fImage.reset(make_image(canvas, kCellSize, kCellSize));
+ fImage = make_image(canvas, kCellSize, kCellSize);
}
this->drawRow(canvas, kNone_SkFilterQuality);
@@ -155,14 +155,14 @@ private:
static const int kNumRows = 4;
static const int kNumCols = 6;
- bool fDoAA;
- SkPath fPath;
- sk_sp<SkShader> fBitmapShader;
- sk_sp<SkShader> fLinearGrad1;
- sk_sp<SkShader> fLinearGrad2;
- SkMatrix fPerspMatrix;
- SkAutoTUnref<SkImage> fImage;
- SkBitmap fBitmap;
+ bool fDoAA;
+ SkPath fPath;
+ sk_sp<SkShader> fBitmapShader;
+ sk_sp<SkShader> fLinearGrad1;
+ sk_sp<SkShader> fLinearGrad2;
+ SkMatrix fPerspMatrix;
+ sk_sp<SkImage> fImage;
+ SkBitmap fBitmap;
typedef GM INHERITED;
};
« no previous file with comments | « gm/offsetimagefilter.cpp ('k') | gm/rectangletexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698