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

Unified Diff: gm/imagefromyuvtextures.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/imagefilterstransformed.cpp ('k') | gm/imagescalealigned.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefromyuvtextures.cpp
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 6280ae740b98442c8100098e0da1772d2625f00d..0d2637cabe219a6694df67c5991f8bc8c59d9509 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -90,7 +90,7 @@ protected:
((112 * rgb[0] - 94 * rgb[1] - 18 * rgb[2] + 128) >> 8) + 128);
}
}
- fRGBImage.reset(SkImage::NewRasterCopy(rgbBmp.info(), rgbColors, rgbBmp.rowBytes()));
+ fRGBImage = SkImage::MakeRasterCopy(SkPixmap(rgbBmp.info(), rgbColors, rgbBmp.rowBytes()));
}
void createYUVTextures(GrContext* context, GrBackendObject yuvHandles[3]) {
@@ -141,28 +141,26 @@ protected:
{ fYUVBmps[1].width(), fYUVBmps[1].height()},
{ fYUVBmps[2].width(), fYUVBmps[2].height()},
};
- SkTArray<SkImage*> images;
- images.push_back(SkRef(fRGBImage.get()));
+ SkTArray<sk_sp<SkImage>> images;
+ images.push_back(fRGBImage);
for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpace; ++space) {
- images.push_back(SkImage::NewFromYUVTexturesCopy(context,
- static_cast<SkYUVColorSpace>(space),
- yuvHandles, sizes,
- kTopLeft_GrSurfaceOrigin));
+ images.push_back(SkImage::MakeFromYUVTexturesCopy(context,
+ static_cast<SkYUVColorSpace>(space),
+ yuvHandles, sizes,
+ kTopLeft_GrSurfaceOrigin));
}
this->deleteYUVTextures(context, yuvHandles);
for (int i = 0; i < images.count(); ++ i) {
SkScalar y = (i + 1) * kPad + i * fYUVBmps[0].height();
SkScalar x = kPad;
- canvas->drawImage(images[i], x, y);
- images[i]->unref();
- images[i] = nullptr;
+ canvas->drawImage(images[i].get(), x, y);
}
}
private:
- SkAutoTUnref<SkImage> fRGBImage;
- SkBitmap fYUVBmps[3];
+ sk_sp<SkImage> fRGBImage;
+ SkBitmap fYUVBmps[3];
static const int kBmpSize = 32;
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | gm/imagescalealigned.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698