| Index: src/image/SkImage_Gpu.cpp
|
| diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
|
| index dd4bee311d0a864109af766e33d05eaf67dfd74f..24381b833a250be6d0485b2d9809e2b9f01d01b5 100644
|
| --- a/src/image/SkImage_Gpu.cpp
|
| +++ b/src/image/SkImage_Gpu.cpp
|
| @@ -157,6 +157,7 @@ SkImage* SkImage_Gpu::onNewSubset(const SkIRect& subset) const {
|
| if (!subTx) {
|
| return nullptr;
|
| }
|
| +
|
| ctx->copySurface(subTx, fTexture, subset, SkIPoint::Make(0, 0));
|
| return new SkImage_Gpu(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, fAlphaType, subTx,
|
| fBudgeted);
|
| @@ -284,6 +285,9 @@ SkImage* SkImage::NewFromTextureCopy(GrContext* ctx, const GrBackendTextureDesc&
|
| return nullptr;
|
| }
|
|
|
| + src->setFromRawPixels(true);
|
| + src->setException(true);
|
| +
|
| const bool isBudgeted = true;
|
| SkAutoTUnref<GrTexture> dst(GrDeepCopyTexture(src, isBudgeted));
|
| if (!dst) {
|
| @@ -295,6 +299,8 @@ SkImage* SkImage::NewFromTextureCopy(GrContext* ctx, const GrBackendTextureDesc&
|
| budgeted);
|
| }
|
|
|
| +#include "GrDrawTarget.h"
|
| +
|
| SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorSpace,
|
| const GrBackendObject yuvTextureHandles[3],
|
| const SkISize yuvSizes[3],
|
| @@ -341,6 +347,13 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
|
| return nullptr;
|
| }
|
|
|
| + yTex->setFromRawPixels(true);
|
| + yTex->setException(true);
|
| + uTex->setFromRawPixels(true);
|
| + uTex->setException(true);
|
| + vTex->setFromRawPixels(true);
|
| + vTex->setException(true);
|
| +
|
| GrSurfaceDesc dstDesc;
|
| // Needs to be a render target in order to draw to it for the yuv->rgb conversion.
|
| dstDesc.fFlags = kRenderTarget_GrSurfaceFlag;
|
| @@ -358,7 +371,7 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
|
| GrPaint paint;
|
| paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
|
| paint.addColorFragmentProcessor(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, yuvSizes,
|
| - colorSpace))->unref();
|
| + colorSpace, dst->asRenderTarget()))->unref();
|
|
|
| const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
|
| SkIntToScalar(dstDesc.fHeight));
|
| @@ -367,7 +380,9 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
|
| return nullptr;
|
| }
|
|
|
| + // nothing to "use" in this case
|
| drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect);
|
| +
|
| ctx->flushSurfaceWrites(dst);
|
| return new SkImage_Gpu(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID,
|
| kOpaque_SkAlphaType, dst, budgeted);
|
| @@ -383,7 +398,7 @@ GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) {
|
| if (!dst) {
|
| return nullptr;
|
| }
|
| -
|
| +
|
| const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
|
| const SkIPoint dstP = SkIPoint::Make(0, 0);
|
| ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
|
|
|