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

Unified Diff: gm/imagefiltersscaled.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/imagefiltersgraph.cpp ('k') | gm/imagefilterstransformed.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersscaled.cpp
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp
index da4467882bccc773b2a2820051ca642c6231367b..391f4e5c1cd86aa37d16f22cfc95b0adb9197adc 100644
--- a/gm/imagefiltersscaled.cpp
+++ b/gm/imagefiltersscaled.cpp
@@ -44,16 +44,16 @@ protected:
}
void onOnceBeforeDraw() override {
- fCheckerboard.reset(SkImage::NewFromBitmap(
- sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8)));
- fGradientCircle.reset(MakeGradientCircle(64, 64));
+ fCheckerboard = SkImage::MakeFromBitmap(
+ sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
+ fGradientCircle = MakeGradientCircle(64, 64);
}
void onDraw(SkCanvas* canvas) override {
canvas->clear(SK_ColorBLACK);
- SkAutoTUnref<SkImageFilter> gradient(SkImageSource::Create(fGradientCircle));
- SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerboard));
+ SkAutoTUnref<SkImageFilter> gradient(SkImageSource::Create(fGradientCircle.get()));
+ SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerboard.get()));
SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise(
SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0));
SkPaint noisePaint;
@@ -135,7 +135,7 @@ protected:
}
private:
- static SkImage* MakeGradientCircle(int width, int height) {
+ static sk_sp<SkImage> MakeGradientCircle(int width, int height) {
SkScalar x = SkIntToScalar(width / 2);
SkScalar y = SkIntToScalar(height / 2);
SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIntToScalar(5));
@@ -150,10 +150,10 @@ private:
2, SkShader::kClamp_TileMode));
canvas->drawCircle(x, y, radius, paint);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
- SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle;
+ sk_sp<SkImage> fCheckerboard, fGradientCircle;
typedef GM INHERITED;
};
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | gm/imagefilterstransformed.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698