aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureContext.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-05 12:45:52 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-05 12:46:02 +0000
commit171cc5fc87ede62712923f5a01db58059a027700 (patch)
tree7cdad3bf4c252d43badcc9ce6442f9a2368dadb3 /src/gpu/GrTextureContext.cpp
parent1cfcf2b167754cd3a9158ff6b73407c238c86269 (diff)
Revert "Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv"
This reverts commit fb0bd98a43fa11e09705837418167dd72bb4a361. Reason for revert: ANGLE failures Original change's description: > Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv > > This is in service of: https://skia-review.googlesource.com/c/11125/ (Add parallel proxyID to StencilOps & RenderTargetOpList) where I want a better choke point for texture creation to improve discard handling. > > Change-Id: If57a7de47edc0853dae7bc61337d9acdc03d63b0 > Reviewed-on: https://skia-review.googlesource.com/11200 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I7241070dc1f9df47181061e07adab141f9857974 Reviewed-on: https://skia-review.googlesource.com/11324 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrTextureContext.cpp')
-rw-r--r--src/gpu/GrTextureContext.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index f946290795..00cc97cf53 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -120,14 +120,17 @@ bool GrTextureContext::onReadPixels(const SkImageInfo& dstInfo, void* dstBuffer,
// TODO: this seems to duplicate code in SkImage_Gpu::onReadPixels
if (kUnpremul_SkAlphaType == dstInfo.alphaType()) {
- flags |= GrContextPriv::kUnpremul_PixelOpsFlag;
+ flags |= GrContext::kUnpremul_PixelOpsFlag;
}
- return fContext->contextPriv().readSurfacePixels(fTextureProxy.get(), this->getColorSpace(),
- x, y, dstInfo.width(), dstInfo.height(),
- config,
- dstInfo.colorSpace(), dstBuffer, dstRowBytes,
- flags);
+ // Deferral of the VRAM resources must end in this instance anyway
+ sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->resourceProvider())));
+ if (!tex) {
+ return false;
+ }
+
+ return tex->readPixels(this->getColorSpace(), x, y, dstInfo.width(), dstInfo.height(),
+ config, dstInfo.colorSpace(), dstBuffer, dstRowBytes, flags);
}
// TODO: move this (and GrRenderTargetContext::onReadPixels) to GrSurfaceContext?
@@ -140,12 +143,15 @@ bool GrTextureContext::onWritePixels(const SkImageInfo& srcInfo, const void* src
return false;
}
if (kUnpremul_SkAlphaType == srcInfo.alphaType()) {
- flags |= GrContextPriv::kUnpremul_PixelOpsFlag;
+ flags |= GrContext::kUnpremul_PixelOpsFlag;
+ }
+
+ // Deferral of the VRAM resources must end in this instance anyway
+ sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->resourceProvider())));
+ if (!tex) {
+ return false;
}
- return fContext->contextPriv().writeSurfacePixels(fTextureProxy.get(), this->getColorSpace(),
- x, y, srcInfo.width(), srcInfo.height(),
- config,
- srcInfo.colorSpace(), srcBuffer, srcRowBytes,
- flags);
+ return tex->writePixels(this->getColorSpace(), x, y, srcInfo.width(), srcInfo.height(),
+ config, srcInfo.colorSpace(), srcBuffer, srcRowBytes, flags);
}