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

Unified Diff: gm/imagescalealigned.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/imagefromyuvtextures.cpp ('k') | gm/imagesource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagescalealigned.cpp
diff --git a/gm/imagescalealigned.cpp b/gm/imagescalealigned.cpp
index c9e697cbadf88245514232808065b84fb15c7107..66ad8b62f4b16c953f05be744c7bd44ecb865d4f 100644
--- a/gm/imagescalealigned.cpp
+++ b/gm/imagescalealigned.cpp
@@ -20,11 +20,11 @@ protected:
auto& set = fSets.push_back();
set.fVector = vectors[i];
- set.fImages.push_back().reset(MakeImage(vectors[i], SK_ColorGREEN));
+ set.fImages.push_back() = MakeImage(vectors[i], SK_ColorGREEN);
set.fScales.push_back() = 1;
- set.fImages.push_back().reset(MakeImage(vectors[i], SK_ColorRED));
+ set.fImages.push_back() = MakeImage(vectors[i], SK_ColorRED);
set.fScales.push_back() = kStretchFactor;
- set.fImages.push_back().reset(MakeImage(vectors[i], SK_ColorGREEN));
+ set.fImages.push_back() = MakeImage(vectors[i], SK_ColorGREEN);
set.fScales.push_back() = 1;
}
}
@@ -63,12 +63,12 @@ protected:
private:
struct ImageSet {
- SkSTArray<3, SkAutoTUnref<SkImage>, true> fImages;
- SkSTArray<3, SkScalar> fScales;
- SkVector fVector;
+ SkSTArray<3, sk_sp<SkImage>, true> fImages;
+ SkSTArray<3, SkScalar> fScales;
+ SkVector fVector;
};
- static SkImage* MakeImage(const SkVector& vec, SkColor color) {
+ static sk_sp<SkImage> MakeImage(const SkVector& vec, SkColor color) {
const SkPoint start = SkPoint::Make(vec.y() * kSegLen / 2, vec.x() * kSegLen / 2);
const SkPoint end = SkPoint::Make(start.x() + vec.x() * (kSegLen - 1),
start.y() + vec.y() * (kSegLen - 1));
@@ -88,7 +88,7 @@ private:
surface->getCanvas()->drawPoint(start.x(), start.y(), color);
surface->getCanvas()->drawPoint(end.x(), end.y(), color);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
void drawSets(SkCanvas* canvas) const {
@@ -131,7 +131,7 @@ private:
img->width() * (1 + (set.fScales[i] - 1) * set.fVector.x()),
img->height() * (1 + (set.fScales[i] - 1) * set.fVector.y()));
- canvas->drawImageRect(img, dst, &paint);
+ canvas->drawImageRect(img.get(), dst, &paint);
pt.offset(dst.width() * set.fVector.x(), dst.height() * set.fVector.y());
}
« no previous file with comments | « gm/imagefromyuvtextures.cpp ('k') | gm/imagesource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698