Chromium Code Reviews| Index: src/gpu/GrGpu.cpp |
| diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp |
| index 728fb880622010fa9495932d467b7f6df7d3ff04..8577050a637e5fc0b99e57fa19186bc1e39215fe 100644 |
| --- a/src/gpu/GrGpu.cpp |
| +++ b/src/gpu/GrGpu.cpp |
| @@ -232,6 +232,61 @@ void GrGpu::clearStencilClip(const SkIRect& rect, |
| this->onClearStencilClip(renderTarget, rect, insideClip); |
| } |
| +bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, size_t rowBytes, |
| + GrPixelConfig readConfig, DrawPreference* drawPreference, |
| + ReadPixelTempDrawInfo* tempDrawInfo) { |
| + SkASSERT(drawPreference); |
| + SkASSERT(tempDrawInfo); |
| + SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); |
| + |
| + if (!this->onGetReadPixelsInfo(srcSurface, width, height, rowBytes, readConfig, drawPreference, |
|
robertphillips
2015/07/28 13:15:23
tab this over to the '(' ?
bsalomon
2015/07/28 14:58:17
Done.
|
| + 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, false)) { |
| + // 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, int width, int height, size_t rowBytes, |
| + GrPixelConfig srcConfig, DrawPreference* drawPreference, |
| + WritePixelTempDrawInfo* tempDrawInfo) { |
| + SkASSERT(drawPreference); |
| + SkASSERT(tempDrawInfo); |
| + SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); |
| + |
| + if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && |
| + SkToBool(dstSurface->asRenderTarget()) && |
| + (width < dstSurface->width() || height < dstSurface->height())) { |
| + ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
| + } |
| + |
| + if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConfig, drawPreference, |
|
robertphillips
2015/07/28 13:15:23
match with '(' ?
bsalomon
2015/07/28 14:58:17
Done.
|
| + tempDrawInfo)) { |
| + return false; |
| + } |
| + |
| + // Check to see if we're going to request that the caller draw when drawing is not possible. |
| + if (!dstSurface->asRenderTarget() || |
| + !this->caps()->isConfigTexturable(tempDrawInfo->fTempSurfaceDesc.fConfig)) { |
| + // If we don't have a fallback to a straight upload then fail. |
| + if (kRequireDraw_DrawPreference == *drawPreference || |
| + !this->caps()->isConfigTexturable(srcConfig)) { |
| + return false; |
| + } |
| + *drawPreference = kNoDraw_DrawPreference; |
| + } |
| + return true; |
| +} |
| + |
| bool GrGpu::readPixels(GrRenderTarget* target, |
| int left, int top, int width, int height, |
| GrPixelConfig config, void* buffer, |