Chromium Code Reviews| Index: src/gpu/GrGpu.cpp |
| diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp |
| index bb020f5b503d7ac7c7207fcc663e37e00542bab2..24cd08a1b60f9a5848d08ba9d5b9ed0be1317134 100644 |
| --- a/src/gpu/GrGpu.cpp |
| +++ b/src/gpu/GrGpu.cpp |
| @@ -222,7 +222,24 @@ void GrGpu::clear(const SkIRect* rect, |
| GrRenderTarget* renderTarget) { |
| SkASSERT(renderTarget); |
| this->handleDirtyContext(); |
| - this->onClear(renderTarget, rect, color, canIgnoreRect); |
| + |
| + if (canIgnoreRect && this->caps()->fullClearIsFree()) { |
| + rect = NULL; |
| + } |
| + |
| + SkIRect clippedRect; |
| + if (rect) { |
| + // flushScissor expects rect to be clipped to the target. |
| + clippedRect = *rect; |
| + SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height()); |
| + if (clippedRect.intersect(rtRect)) { |
|
egdaniel
2015/08/05 19:59:05
I wonder if its worth also checking if the clipped
bsalomon
2015/08/05 20:18:57
Should this all be done even higher up (e.g. GrDT)
|
| + rect = &clippedRect; |
| + } else { |
| + return; |
| + } |
| + } |
| + |
| + this->onClear(renderTarget, rect, color); |
| } |
| void GrGpu::clearStencilClip(const SkIRect& rect, |