Index: src/gpu/GrInOrderDrawBuffer.cpp |
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp |
index 178df7553a97a6dcfdd2aa62e6d0de829bc223ab..8d34e6cf763fdc5fea3c8ee4348ebed26f8b1ce7 100644 |
--- a/src/gpu/GrInOrderDrawBuffer.cpp |
+++ b/src/gpu/GrInOrderDrawBuffer.cpp |
@@ -504,6 +504,7 @@ void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, |
rect = &r; |
} |
Clear* clr = this->recordClear(); |
+ GrColorIsPMAssert(color); |
clr->fColor = color; |
clr->fRect = *rect; |
clr->fCanIgnoreRect = canIgnoreRect; |
@@ -511,6 +512,20 @@ void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, |
renderTarget->ref(); |
} |
+void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) { |
+ if (!this->caps()->discardRenderTargetSupport()) { |
+ return; |
+ } |
+ if (NULL == renderTarget) { |
+ renderTarget = this->drawState()->getRenderTarget(); |
+ SkASSERT(NULL != renderTarget); |
+ } |
+ Clear* clr = this->recordClear(); |
+ clr->fColor = GrColor_ILLEGAL; |
+ clr->fRenderTarget = renderTarget; |
+ renderTarget->ref(); |
+} |
+ |
void GrInOrderDrawBuffer::reset() { |
SkASSERT(1 == fGeoPoolStateStack.count()); |
this->resetVertexSource(); |
@@ -630,10 +645,14 @@ void GrInOrderDrawBuffer::flush() { |
++currClip; |
break; |
case kClear_Cmd: |
- fDstGpu->clear(&fClears[currClear].fRect, |
- fClears[currClear].fColor, |
- fClears[currClear].fCanIgnoreRect, |
- fClears[currClear].fRenderTarget); |
+ if (GrColor_ILLEGAL == fClears[currClear].fColor) { |
+ fDstGpu->discard(fClears[currClear].fRenderTarget); |
+ } else { |
+ fDstGpu->clear(&fClears[currClear].fRect, |
+ fClears[currClear].fColor, |
+ fClears[currClear].fCanIgnoreRect, |
+ fClears[currClear].fRenderTarget); |
+ } |
++currClear; |
break; |
case kCopySurface_Cmd: |