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/colormatrix.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/colorfilterimagefilter.cpp ('k') | gm/colorwheel.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/colormatrix.cpp
diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp
index b6e83d3ceb9a2a0f270eee7679ab8c0b4c53864f..de80ebb64b3b8cc9ffe43cbffe42ebc3affe1a95 100644
--- a/gm/colormatrix.cpp
+++ b/gm/colormatrix.cpp
@@ -37,11 +37,11 @@ protected:
}
void onOnceBeforeDraw() override {
- fSolidImg.reset(CreateSolidBitmap(64, 64));
- fTransparentImg.reset(CreateTransparentBitmap(64, 64));
+ fSolidImg = CreateSolidBitmap(64, 64);
+ fTransparentImg = CreateTransparentBitmap(64, 64);
}
- static SkImage* CreateSolidBitmap(int width, int height) {
+ static sk_sp<SkImage> CreateSolidBitmap(int width, int height) {
SkBitmap bm;
bm.allocN32Pixels(width, height);
SkCanvas canvas(bm);
@@ -54,11 +54,11 @@ protected:
SkIntToScalar(y), SK_Scalar1, SK_Scalar1), paint);
}
}
- return SkImage::NewFromBitmap(bm);
+ return SkImage::MakeFromBitmap(bm);
}
// creates a bitmap with shades of transparent gray.
- static SkImage* CreateTransparentBitmap(int width, int height) {
+ static sk_sp<SkImage> CreateTransparentBitmap(int width, int height) {
SkBitmap bm;
bm.allocN32Pixels(width, height);
SkCanvas canvas(bm);
@@ -70,7 +70,7 @@ protected:
paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode));
canvas.drawRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), paint);
- return SkImage::NewFromBitmap(bm);
+ return SkImage::MakeFromBitmap(bm);
}
void onDraw(SkCanvas* canvas) override {
@@ -78,7 +78,7 @@ protected:
SkColorMatrix matrix;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
- const SkImage* bmps[] = { fSolidImg, fTransparentImg };
+ const SkImage* bmps[] = { fSolidImg.get(), fTransparentImg.get() };
for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) {
matrix.setIdentity();
@@ -139,8 +139,8 @@ protected:
}
private:
- SkAutoTUnref<SkImage> fSolidImg;
- SkAutoTUnref<SkImage> fTransparentImg;
+ sk_sp<SkImage> fSolidImg;
+ sk_sp<SkImage> fTransparentImg;
typedef skiagm::GM INHERITED;
};
« no previous file with comments | « gm/colorfilterimagefilter.cpp ('k') | gm/colorwheel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698