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

Unified Diff: gm/bigtileimagefilter.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/astcbitmap.cpp ('k') | gm/bleed.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bigtileimagefilter.cpp
diff --git a/gm/bigtileimagefilter.cpp b/gm/bigtileimagefilter.cpp
index f2164e8e2fc3d02231b5f31fdfc0da519cf72b91..84b9816a83c70177d57675a4657e4e12f08b2838 100644
--- a/gm/bigtileimagefilter.cpp
+++ b/gm/bigtileimagefilter.cpp
@@ -10,7 +10,7 @@
#include "SkTileImageFilter.h"
#include "gm.h"
-static SkImage* create_circle_texture(int size, SkColor color) {
+static sk_sp<SkImage> create_circle_texture(int size, SkColor color) {
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(size, size));
SkCanvas* canvas = surface->getCanvas();
canvas->clear(0xFF000000);
@@ -22,7 +22,7 @@ static SkImage* create_circle_texture(int size, SkColor color) {
canvas->drawCircle(SkScalarHalf(size), SkScalarHalf(size), SkScalarHalf(size), paint);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
namespace skiagm {
@@ -44,8 +44,8 @@ protected:
}
void onOnceBeforeDraw() override {
- fRedImage.reset(create_circle_texture(kBitmapSize, SK_ColorRED));
- fGreenImage.reset(create_circle_texture(kBitmapSize, SK_ColorGREEN));
+ fRedImage = create_circle_texture(kBitmapSize, SK_ColorRED);
+ fGreenImage = create_circle_texture(kBitmapSize, SK_ColorGREEN);
}
void onDraw(SkCanvas* canvas) override {
@@ -55,11 +55,11 @@ protected:
SkPaint p;
SkRect bound = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight));
- SkAutoTUnref<SkImageFilter> imageSource(SkImageSource::Create(fRedImage));
+ sk_sp<SkImageFilter> imageSource(SkImageSource::Create(fRedImage.get()));
SkAutoTUnref<SkImageFilter> tif(SkTileImageFilter::Create(
SkRect::MakeWH(SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize)),
SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight)),
- imageSource));
+ imageSource.get()));
p.setImageFilter(tif);
canvas->saveLayer(&bound, &p);
@@ -84,7 +84,7 @@ protected:
SkRect bound3 = SkRect::MakeXYWH(320, 320,
SkIntToScalar(kBitmapSize),
SkIntToScalar(kBitmapSize));
- canvas->drawImageRect(fGreenImage, bound2, bound3, nullptr,
+ canvas->drawImageRect(fGreenImage.get(), bound2, bound3, nullptr,
SkCanvas::kStrict_SrcRectConstraint);
canvas->restore();
}
@@ -95,8 +95,8 @@ private:
static const int kHeight = 512;
static const int kBitmapSize = 64;
- SkAutoTUnref<SkImage> fRedImage;
- SkAutoTUnref<SkImage> fGreenImage;
+ sk_sp<SkImage> fRedImage;
+ sk_sp<SkImage> fGreenImage;
typedef GM INHERITED;
};
« no previous file with comments | « gm/astcbitmap.cpp ('k') | gm/bleed.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698