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

Unified Diff: src/gpu/GrYUVProvider.cpp

Issue 1967743003: Minor GrRenderTarget retraction (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more clean up Created 4 years, 7 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/GrYUVProvider.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrYUVProvider.cpp
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 6cd7c959b020b151ab5ef63fa192ba84898823e7..b4320d0b028a66550c52f7694baf5c025a0bed8e 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -80,7 +80,9 @@ bool YUVScoper::init(GrYUVProvider* provider, SkYUVPlanesCache::Info* yuvInfo, v
return true;
}
-GrTexture* GrYUVProvider::refAsTexture(GrContext* ctx, const GrSurfaceDesc& desc, bool useCache) {
+sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
+ const GrSurfaceDesc& desc,
+ bool useCache) {
SkYUVPlanesCache::Info yuvInfo;
void* planes[3];
YUVScoper scoper;
@@ -110,18 +112,13 @@ GrTexture* GrYUVProvider::refAsTexture(GrContext* ctx, const GrSurfaceDesc& desc
}
}
- GrSurfaceDesc rtDesc = desc;
- rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag;
-
- SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, SkBudgeted::kYes,
- nullptr, 0));
- if (!result) {
+ sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact,
+ desc.fWidth, desc.fHeight,
+ desc.fConfig, desc.fSampleCnt));
+ if (!drawContext) {
return nullptr;
}
- GrRenderTarget* renderTarget = result->asRenderTarget();
- SkASSERT(renderTarget);
-
GrPaint paint;
// We may be decoding an sRGB image, but the result of our linear math on the YUV planes
// is already in sRGB in that case. Don't convert (which will make the image too bright).
@@ -137,12 +134,7 @@ GrTexture* GrYUVProvider::refAsTexture(GrContext* ctx, const GrSurfaceDesc& desc
const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fWidth,
yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight);
- sk_sp<GrDrawContext> drawContext(ctx->drawContext(sk_ref_sp(renderTarget)));
- if (!drawContext) {
- return nullptr;
- }
-
drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r);
- return result.release();
+ return drawContext->asTexture();
}
« no previous file with comments | « src/gpu/GrYUVProvider.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698