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

Unified Diff: src/gpu/GrTextureToYUVPlanes.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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 | « src/gpu/GrTextureParamsAdjuster.cpp ('k') | src/gpu/GrYUVProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextureToYUVPlanes.cpp
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index 42156026a3bfa0653d938a00e371424ad469db2b..58c4b9ac5eb0cb0accee7ca16e580bdfc67cb645 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -15,12 +15,12 @@
#include "GrTextureProvider.h"
namespace {
- using CreateFPProc = const GrFragmentProcessor* (*)(const GrFragmentProcessor*,
- SkYUVColorSpace colorSpace);
+ using MakeFPProc = sk_sp<GrFragmentProcessor> (*)(sk_sp<GrFragmentProcessor>,
+ SkYUVColorSpace colorSpace);
};
static bool convert_texture(GrTexture* src, GrDrawContext* dst, int dstW, int dstH,
- SkYUVColorSpace colorSpace, CreateFPProc proc) {
+ SkYUVColorSpace colorSpace, MakeFPProc proc) {
SkScalar xScale = SkIntToScalar(src->width()) / dstW / src->width();
SkScalar yScale = SkIntToScalar(src->height()) / dstH / src->height();
@@ -31,18 +31,18 @@ static bool convert_texture(GrTexture* src, GrDrawContext* dst, int dstW, int ds
filter = GrTextureParams::kBilerp_FilterMode;
}
- SkAutoTUnref<const GrFragmentProcessor> fp(
- GrSimpleTextureEffect::Create(src, SkMatrix::MakeScale(xScale, yScale), filter));
+ sk_sp<GrFragmentProcessor> fp(
+ GrSimpleTextureEffect::Make(src, SkMatrix::MakeScale(xScale, yScale), filter));
if (!fp) {
return false;
}
- fp.reset(proc(fp, colorSpace));
+ fp = proc(std::move(fp), colorSpace);
if (!fp) {
return false;
}
GrPaint paint;
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
- paint.addColorFragmentProcessor(fp);
+ paint.addColorFragmentProcessor(std::move(fp));
dst->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::MakeIWH(dstW, dstH));
return true;
}
@@ -107,32 +107,32 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
if (yuvDrawContext) {
if (!convert_texture(texture, yuvDrawContext.get(),
sizes[0].fWidth, sizes[0].fHeight,
- colorSpace, GrYUVEffect::CreateRGBToYUV)) {
+ colorSpace, GrYUVEffect::MakeRGBToYUV)) {
return false;
}
} else {
SkASSERT(yDrawContext);
if (!convert_texture(texture, yDrawContext.get(),
sizes[0].fWidth, sizes[0].fHeight,
- colorSpace, GrYUVEffect::CreateRGBToY)) {
+ colorSpace, GrYUVEffect::MakeRGBToY)) {
return false;
}
if (uvDrawContext) {
if (!convert_texture(texture, uvDrawContext.get(),
sizes[1].fWidth, sizes[1].fHeight,
- colorSpace, GrYUVEffect::CreateRGBToUV)) {
+ colorSpace, GrYUVEffect::MakeRGBToUV)) {
return false;
}
} else {
SkASSERT(uDrawContext && vDrawContext);
if (!convert_texture(texture, uDrawContext.get(),
sizes[1].fWidth, sizes[1].fHeight,
- colorSpace, GrYUVEffect::CreateRGBToU)) {
+ colorSpace, GrYUVEffect::MakeRGBToU)) {
return false;
}
if (!convert_texture(texture, vDrawContext.get(),
sizes[2].fWidth, sizes[2].fHeight,
- colorSpace, GrYUVEffect::CreateRGBToV)) {
+ colorSpace, GrYUVEffect::MakeRGBToV)) {
return false;
}
}
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.cpp ('k') | src/gpu/GrYUVProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698