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

Unified Diff: gm/displacement.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/dftext.cpp ('k') | gm/drawatlas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/displacement.cpp
diff --git a/gm/displacement.cpp b/gm/displacement.cpp
index c5f1837c91133bede3fcf4f01ba98cca24253173..a3fb9e5e5b9d1757dcdca04499caa9d63abd92b2 100644
--- a/gm/displacement.cpp
+++ b/gm/displacement.cpp
@@ -30,16 +30,16 @@ protected:
SkColor c1 = sk_tool_utils::color_to_565(0xFF244484);
SkColor c2 = sk_tool_utils::color_to_565(0xFF804020);
- fCheckerboard.reset(SkImage::NewFromBitmap(
- sk_tool_utils::create_checkerboard_bitmap(80, 80, c1, c2, 8)));
- fSmall.reset(SkImage::NewFromBitmap(
- sk_tool_utils::create_checkerboard_bitmap(64, 64, c1, c2, 8)));
- fLarge.reset(SkImage::NewFromBitmap(
- sk_tool_utils::create_checkerboard_bitmap(96, 96, c1, c2, 8)));
- fLargeW.reset(
- SkImage::NewFromBitmap(sk_tool_utils::create_checkerboard_bitmap(96, 64, c1, c2, 8)));
- fLargeH.reset(SkImage::NewFromBitmap(
- sk_tool_utils::create_checkerboard_bitmap(64, 96, c1, c2, 8)));
+ fCheckerboard = SkImage::MakeFromBitmap(
+ sk_tool_utils::create_checkerboard_bitmap(80, 80, c1, c2, 8));
+ fSmall = SkImage::MakeFromBitmap(
+ sk_tool_utils::create_checkerboard_bitmap(64, 64, c1, c2, 8));
+ fLarge = SkImage::MakeFromBitmap(
+ sk_tool_utils::create_checkerboard_bitmap(96, 96, c1, c2, 8));
+ fLargeW =
+ SkImage::MakeFromBitmap(sk_tool_utils::create_checkerboard_bitmap(96, 64, c1, c2, 8));
+ fLargeH = SkImage::MakeFromBitmap(
+ sk_tool_utils::create_checkerboard_bitmap(64, 96, c1, c2, 8));
}
SkISize onISize() override {
@@ -57,7 +57,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
canvas->clear(SK_ColorBLACK);
SkPaint paint;
- SkAutoTUnref<SkImageFilter> displ(SkImageSource::Create(fCheckerboard));
+ SkAutoTUnref<SkImageFilter> displ(SkImageSource::Create(fCheckerboard.get()));
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType, 0.0f, displ))->unref();
@@ -161,25 +161,25 @@ protected:
this->drawClippedBitmap(canvas, 500, 0, paint);
// Tests for images of different sizes
- displ.reset(SkImageSource::Create(fSmall));
+ displ.reset(SkImageSource::Create(fSmall.get()));
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType,
40.0f, displ))->unref();
drawClippedBitmap(canvas, 0, 400, paint);
- displ.reset(SkImageSource::Create(fLarge));
+ displ.reset(SkImageSource::Create(fLarge.get()));
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kB_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
40.0f, displ))->unref();
drawClippedBitmap(canvas, 100, 400, paint);
- displ.reset(SkImageSource::Create(fLargeW));
+ displ.reset(SkImageSource::Create(fLargeW.get()));
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kB_ChannelSelectorType,
40.0f, displ))->unref();
drawClippedBitmap(canvas, 200, 400, paint);
- displ.reset(SkImageSource::Create(fLargeH));
+ displ.reset(SkImageSource::Create(fLargeH.get()));
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
@@ -198,7 +198,7 @@ protected:
private:
SkBitmap fBitmap;
- SkAutoTUnref<SkImage> fCheckerboard, fSmall, fLarge, fLargeW, fLargeH;
+ sk_sp<SkImage> fCheckerboard, fSmall, fLarge, fLargeW, fLargeH;
typedef GM INHERITED;
};
« no previous file with comments | « gm/dftext.cpp ('k') | gm/drawatlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698