Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index 5f0001bad70f0258da0b16af822efca4bec0a9fb..5c3fb8de961f34bc987e1487f8610fc0087da3c2 100755 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -576,6 +576,8 @@ void GrContext::clear(const SkIRect* rect, |
| bool canIgnoreRect, |
| GrRenderTarget* renderTarget) { |
| ASSERT_OWNED_RESOURCE(renderTarget); |
| + SkASSERT(renderTarget); |
| + |
| AutoRestoreEffects are; |
| AutoCheckFlush acf(this); |
| GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::clear", this); |
| @@ -749,7 +751,7 @@ void GrContext::drawRect(const GrPaint& paint, |
| // Will it blend? |
| GrColor clearColor; |
| if (paint.isOpaqueAndConstantColor(&clearColor)) { |
| - target->clear(NULL, clearColor, true); |
| + target->clear(NULL, clearColor, true, fRenderTarget); |
| return; |
| } |
| } |
| @@ -1396,13 +1398,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target, |
| GrPixelConfig dstConfig, void* buffer, size_t rowBytes, |
| uint32_t flags) { |
| ASSERT_OWNED_RESOURCE(target); |
| - |
| - if (NULL == target) { |
| - target = fRenderTarget.get(); |
| - if (NULL == target) { |
| - return false; |
| - } |
| - } |
| + SkASSERT(target); |
| if (!(kDontFlush_PixelOpsFlag & flags) && target->surfacePriv().hasPendingWrite()) { |
| this->flush(); |
| @@ -1537,10 +1533,12 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target, |
| void GrContext::resolveRenderTarget(GrRenderTarget* target) { |
| SkASSERT(target); |
| ASSERT_OWNED_RESOURCE(target); |
| - // In the future we may track whether there are any pending draws to this |
| - // target. We don't today so we always perform a flush. We don't promise |
| - // this to our clients, though. |
| - this->flush(); |
| + if (!target->needsResolve()) { |
| + return; |
| + } |
| + if (!target->surfacePriv().hasPendingIO()) { |
|
joshualitt
2014/11/03 19:33:14
is the ! correct here?
bsalomon
2014/11/03 19:59:19
ack, no it's not! Fixed.
|
| + this->flush(); |
| + } |
| if (fGpu) { |
| fGpu->resolveRenderTarget(target); |
| } |