diff options
author | 2017-04-04 16:50:22 -0400 | |
---|---|---|
committer | 2017-04-05 11:55:35 +0000 | |
commit | fb0bd98a43fa11e09705837418167dd72bb4a361 (patch) | |
tree | 67579cf4663c41d4b9ec36bbd61020aa3ccbe57f /src/gpu/GrRenderTargetContext.cpp | |
parent | be5387b9308ad0b92a48a1272b618b6eaa08a771 (diff) |
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>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 8ef09a4a3c..76a67c083e 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -8,6 +8,7 @@ #include "GrRenderTargetContext.h" #include "GrAppliedClip.h" #include "GrColor.h" +#include "GrContextPriv.h" #include "GrDrawingManager.h" #include "GrFixedClip.h" #include "GrGpuResourcePriv.h" @@ -162,18 +163,14 @@ bool GrRenderTargetContext::onReadPixels(const SkImageInfo& dstInfo, void* dstBu // TODO: this seems to duplicate code in SkImage_Gpu::onReadPixels if (kUnpremul_SkAlphaType == dstInfo.alphaType()) { - flags |= GrContext::kUnpremul_PixelOpsFlag; + flags |= GrContextPriv::kUnpremul_PixelOpsFlag; } - // Deferral of the VRAM resources must end in this instance anyway - sk_sp<GrRenderTarget> rt( - sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider()))); - if (!rt) { - return false; - } - - return rt->readPixels(this->getColorSpace(), x, y, dstInfo.width(), dstInfo.height(), - config, dstInfo.colorSpace(), dstBuffer, dstRowBytes, flags); + return fContext->contextPriv().readSurfacePixels(fRenderTargetProxy.get(), + this->getColorSpace(), x, y, + dstInfo.width(), dstInfo.height(), config, + dstInfo.colorSpace(), + dstBuffer, dstRowBytes, flags); } // TODO: move this (and GrTextureContext::onReadPixels) to GrSurfaceContext? @@ -185,18 +182,14 @@ bool GrRenderTargetContext::onWritePixels(const SkImageInfo& srcInfo, const void return false; } if (kUnpremul_SkAlphaType == srcInfo.alphaType()) { - flags |= GrContext::kUnpremul_PixelOpsFlag; - } - - // Deferral of the VRAM resources must end in this instance anyway - sk_sp<GrRenderTarget> rt( - sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider()))); - if (!rt) { - return false; + flags |= GrContextPriv::kUnpremul_PixelOpsFlag; } - return rt->writePixels(this->getColorSpace(), x, y, srcInfo.width(), srcInfo.height(), - config, srcInfo.colorSpace(), srcBuffer, srcRowBytes, flags); + return fContext->contextPriv().writeSurfacePixels(fRenderTargetProxy.get(), + this->getColorSpace(), x, y, + srcInfo.width(), srcInfo.height(), + config, srcInfo.colorSpace(), + srcBuffer, srcRowBytes, flags); } @@ -1787,7 +1780,7 @@ void GrRenderTargetContext::setupDstTexture(GrRenderTarget* rt, const GrClip& cl desc.fHeight = rt->height(); dstPoint = {copyRect.fLeft, copyRect.fTop}; dstOffset = {0, 0}; - copy.reset(fContext->resourceProvider()->createTexture(desc, SkBudgeted::kYes, kFlags)); + copy = fContext->resourceProvider()->createTexture(desc, SkBudgeted::kYes, kFlags); } else { desc.fWidth = copyRect.width(); desc.fHeight = copyRect.height(); |