diff options
author | Robert Phillips <robertphillips@google.com> | 2017-04-10 08:19:26 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-10 12:56:33 +0000 |
commit | a90aa2bfd430ca9bc321c3c7b3f1c727927606d1 (patch) | |
tree | 48176ea4a4fb3d529760e60ca9e9ca3978c5cf39 /src/gpu/GrTextureContext.cpp | |
parent | 768f52ff85662e6627438987e3277f3926eb6577 (diff) |
consolidate read/writePixels in GrSurfaceContext
Change-Id: I118fcd49990597d4dfea92efd3f9d99e52fdbfab
Reviewed-on: https://skia-review.googlesource.com/11481
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrTextureContext.cpp')
-rw-r--r-- | src/gpu/GrTextureContext.cpp | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp index ca6f7a20bd..76b7588e39 100644 --- a/src/gpu/GrTextureContext.cpp +++ b/src/gpu/GrTextureContext.cpp @@ -15,7 +15,7 @@ #include "../private/GrAuditTrail.h" #define ASSERT_SINGLE_OWNER \ - SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) + SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());) #define RETURN_FALSE_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return false; } GrTextureContext::GrTextureContext(GrContext* context, @@ -98,43 +98,3 @@ bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy, return result; } -// TODO: move this (and GrRenderTargetContext::onReadPixels) to GrSurfaceContext? -bool GrTextureContext::onReadPixels(const SkImageInfo& dstInfo, void* dstBuffer, - size_t dstRowBytes, int x, int y, uint32_t flags) { - // TODO: teach GrTexture to take ImageInfo directly to specify the src pixels - GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps()); - if (kUnknown_GrPixelConfig == config) { - return false; - } - - // TODO: this seems to duplicate code in SkImage_Gpu::onReadPixels - if (kUnpremul_SkAlphaType == dstInfo.alphaType()) { - flags |= GrContextPriv::kUnpremul_PixelOpsFlag; - } - - return fContext->contextPriv().readSurfacePixels(fTextureProxy.get(), this->getColorSpace(), - x, y, dstInfo.width(), dstInfo.height(), - config, - dstInfo.colorSpace(), dstBuffer, dstRowBytes, - flags); -} - -// TODO: move this (and GrRenderTargetContext::onReadPixels) to GrSurfaceContext? -bool GrTextureContext::onWritePixels(const SkImageInfo& srcInfo, const void* srcBuffer, - size_t srcRowBytes, int x, int y, - uint32_t flags) { - // TODO: teach GrTexture to take ImageInfo directly to specify the src pixels - GrPixelConfig config = SkImageInfo2GrPixelConfig(srcInfo, *fContext->caps()); - if (kUnknown_GrPixelConfig == config) { - return false; - } - if (kUnpremul_SkAlphaType == srcInfo.alphaType()) { - flags |= GrContextPriv::kUnpremul_PixelOpsFlag; - } - - return fContext->contextPriv().writeSurfacePixels(fTextureProxy.get(), this->getColorSpace(), - x, y, srcInfo.width(), srcInfo.height(), - config, - srcInfo.colorSpace(), srcBuffer, srcRowBytes, - flags); -} |