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

Unified Diff: gm/tileimagefilter.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/textblobmixedsizes.cpp ('k') | gm/verylargebitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/tileimagefilter.cpp
diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp
index eb0ad09f4be4cbfa6015532ee67ccd78d8b38e8e..b03af4420700ac6325f798f032f106f15b80e53c 100644
--- a/gm/tileimagefilter.cpp
+++ b/gm/tileimagefilter.cpp
@@ -35,14 +35,14 @@ protected:
}
void onOnceBeforeDraw() override {
- fBitmap.reset(SkImage::NewFromBitmap(
- sk_tool_utils::create_string_bitmap(50, 50, 0xD000D000, 10, 45, 50, "e")));
+ fBitmap = SkImage::MakeFromBitmap(
+ sk_tool_utils::create_string_bitmap(50, 50, 0xD000D000, 10, 45, 50, "e"));
- fCheckerboard.reset(SkImage::NewFromBitmap(
+ fCheckerboard = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(80, 80,
sk_tool_utils::color_to_565(0xFFA0A0A0),
sk_tool_utils::color_to_565(0xFF404040),
- 8)));
+ 8));
}
void onDraw(SkCanvas* canvas) override {
@@ -56,7 +56,7 @@ protected:
int x = 0, y = 0;
for (size_t i = 0; i < 4; i++) {
- const SkImage* image = (i & 0x01) ? fCheckerboard : fBitmap;
+ const SkImage* image = (i & 0x01) ? fCheckerboard.get() : fBitmap.get();
SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(image->width()/4),
SkIntToScalar(image->height()/4),
SkIntToScalar(image->width()/(i+1)),
@@ -72,7 +72,7 @@ protected:
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
SkPaint paint;
paint.setImageFilter(filter);
- canvas->drawImage(fBitmap, 0, 0, &paint);
+ canvas->drawImage(fBitmap.get(), 0, 0, &paint);
canvas->drawRect(srcRect, red);
canvas->drawRect(dstRect, blue);
canvas->restore();
@@ -102,14 +102,14 @@ protected:
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
canvas->clipRect(dstRect);
canvas->saveLayer(&dstRect, &paint);
- canvas->drawImage(fBitmap, 0, 0);
+ canvas->drawImage(fBitmap.get(), 0, 0);
canvas->restore();
canvas->drawRect(srcRect, red);
canvas->drawRect(dstRect, blue);
canvas->restore();
}
private:
- SkAutoTUnref<SkImage> fBitmap, fCheckerboard;
+ sk_sp<SkImage> fBitmap, fCheckerboard;
typedef GM INHERITED;
};
« no previous file with comments | « gm/textblobmixedsizes.cpp ('k') | gm/verylargebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698