aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkImage_Gpu.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-28 06:21:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-28 06:21:55 -0700
commitaa19a5fbc58e372df11443c90a25f02a04ecef52 (patch)
tree4c6f03988d11d06477e9cedae7fda5d44dfcc650 /src/image/SkImage_Gpu.cpp
parentb8498825b54718cdd90c30c39323cfc433695f23 (diff)
Revert of Refactor drawContext/RenderTarget creation (patchset #8 id:140001 of https://codereview.chromium.org/1914883002/ )
Reason for revert: Experimental revert to see if this is blocking the DEPS roll. Original issue's description: > Refactor drawContext/RenderTarget creation > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1914883002 > > Committed: https://skia.googlesource.com/skia/+/2f1c42e8448bbbadeb3df1c626faa90aa33f8907 TBR=bsalomon@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/1929833004
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r--src/image/SkImage_Gpu.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index eea7e2c040..a66a623638 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -249,16 +249,17 @@ sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace
return nullptr;
}
- const int width = yuvSizes[0].fWidth;
- const int height = yuvSizes[0].fHeight;
-
+ GrSurfaceDesc dstDesc;
// Needs to be a render target in order to draw to it for the yuv->rgb conversion.
- sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(GrContext::kTight_BackingFit,
- width, height,
- kRGBA_8888_GrPixelConfig,
- 0,
- origin));
- if (!drawContext) {
+ dstDesc.fFlags = kRenderTarget_GrSurfaceFlag;
+ dstDesc.fOrigin = origin;
+ dstDesc.fWidth = yuvSizes[0].fWidth;
+ dstDesc.fHeight = yuvSizes[0].fHeight;
+ dstDesc.fConfig = kRGBA_8888_GrPixelConfig;
+ dstDesc.fSampleCnt = 0;
+
+ SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, SkBudgeted::kYes));
+ if (!dst) {
return nullptr;
}
@@ -267,13 +268,17 @@ sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace
paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex, yuvSizes,
colorSpace))->unref();
- const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
+ const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
+ SkIntToScalar(dstDesc.fHeight));
+ sk_sp<GrDrawContext> drawContext(ctx->drawContext(sk_ref_sp(dst->asRenderTarget())));
+ if (!drawContext) {
+ return nullptr;
+ }
drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect);
- ctx->flushSurfaceWrites(drawContext->accessRenderTarget());
- return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
- kOpaque_SkAlphaType,
- drawContext->asTexture().get(), budgeted);
+ ctx->flushSurfaceWrites(dst);
+ return sk_make_sp<SkImage_Gpu>(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID,
+ kOpaque_SkAlphaType, dst, budgeted);
}
static sk_sp<SkImage> create_image_from_maker(GrTextureMaker* maker, SkAlphaType at, uint32_t id) {