diff options
author | Brian Salomon <bsalomon@google.com> | 2018-06-01 14:13:43 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-01 18:59:16 +0000 |
commit | d494f6e3d68269d1a60e864561aa66a7b125be1a (patch) | |
tree | 21541972d90da1252afd765d932020be1dd17a8e /src/gpu/GrGpu.cpp | |
parent | ee56b834fcd5e1834772d8e60195a21811833267 (diff) |
Replace GrContextPriv::read/writeSurfacePixels with GrContextPriv::read/WritePixels2
Change-Id: I08be0f347d360e97bf9a6d1aeb25f9f584cc3d89
Reviewed-on: https://skia-review.googlesource.com/131442
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r-- | src/gpu/GrGpu.cpp | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 725a534bc3..8d0cb7f4bb 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -214,90 +214,6 @@ bool GrGpu::copySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin, canDiscardOutsideDstRect); } -bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin, int width, - int height, size_t rowBytes, GrColorType dstColorType, - GrSRGBConversion srgbConversion, DrawPreference* drawPreference, - ReadPixelTempDrawInfo* tempDrawInfo) { - SkASSERT(drawPreference); - SkASSERT(tempDrawInfo); - SkASSERT(srcSurface); - SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); - - // We currently do not support reading into the packed formats 565 or 4444 as they are not - // required to have read back support on all devices and backends. - if (GrColorType::kRGB_565 == dstColorType || GrColorType::kABGR_4444 == dstColorType) { - return false; - } - - GrPixelConfig tempSurfaceConfig = kUnknown_GrPixelConfig; - // GrGpu::readPixels doesn't do any sRGB conversions, so we must draw if there is one. - switch (srgbConversion) { - case GrSRGBConversion::kNone: - // We support reading from RGBA to just A. In that case there is no sRGB version of the - // dst format but we still want to succeed. - if (GrColorTypeIsAlphaOnly(dstColorType)) { - tempSurfaceConfig = GrColorTypeToPixelConfig(dstColorType, GrSRGBEncoded::kNo); - } else { - tempSurfaceConfig = GrColorTypeToPixelConfig( - dstColorType, GrPixelConfigIsSRGBEncoded(srcSurface->config())); - } - break; - case GrSRGBConversion::kLinearToSRGB: - SkASSERT(this->caps()->srgbSupport()); - tempSurfaceConfig = GrColorTypeToPixelConfig(dstColorType, GrSRGBEncoded::kYes); - // Currently we don't expect to make a SRGB encoded surface and then read data from it - // such that we treat it as though it were linear and is then converted to sRGB. - if (GrPixelConfigIsSRGB(srcSurface->config())) { - return false; - } - ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); - break; - case GrSRGBConversion::kSRGBToLinear: - SkASSERT(this->caps()->srgbSupport()); - tempSurfaceConfig = GrColorTypeToPixelConfig(dstColorType, GrSRGBEncoded::kNo); - // We don't currently support reading sRGB encoded data into linear from a surface - // unless it is an sRGB-encoded config. That is likely to change when we need to store - // sRGB encoded data in 101010102 and F16 textures. We'll have to provoke the caller to - // do the conversion in a shader. - if (GrSRGBEncoded::kNo == GrPixelConfigIsSRGBEncoded(srcSurface->config())) { - return false; - } - ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); - break; - } - if (kUnknown_GrPixelConfig == tempSurfaceConfig) { - return false; - } - - // Default values for intermediate draws. The intermediate texture config matches the dst's - // config, is approx sized to the read rect, no swizzling or spoofing of the dst config. - tempDrawInfo->fTempSurfaceDesc.fFlags = kRenderTarget_GrSurfaceFlag; - tempDrawInfo->fTempSurfaceDesc.fWidth = width; - tempDrawInfo->fTempSurfaceDesc.fHeight = height; - tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 1; - tempDrawInfo->fTempSurfaceDesc.fConfig = tempSurfaceConfig; - tempDrawInfo->fTempSurfaceFit = SkBackingFit::kApprox; - tempDrawInfo->fSwizzle = GrSwizzle::RGBA(); - tempDrawInfo->fReadColorType = dstColorType; - - if (!this->onGetReadPixelsInfo(srcSurface, srcOrigin, width, height, rowBytes, dstColorType, - drawPreference, tempDrawInfo)) { - return false; - } - - // Check to see if we're going to request that the caller draw when drawing is not possible. - if (!srcSurface->asTexture() || - !this->caps()->isConfigRenderable(tempDrawInfo->fTempSurfaceDesc.fConfig)) { - // If we don't have a fallback to a straight read then fail. - if (kRequireDraw_DrawPreference == *drawPreference) { - return false; - } - *drawPreference = kNoDraw_DrawPreference; - } - - return true; -} - bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin, int width, int height, GrColorType srcColorType, GrSRGBConversion srgbConversion, DrawPreference* drawPreference, |