| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrBatchTest.h" | 8 #include "GrBatchTest.h" |
| 9 #include "GrColor.h" | 9 #include "GrColor.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 SkDEBUGCODE(fDrawContext->validate();) | 207 SkDEBUGCODE(fDrawContext->validate();) |
| 208 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContextPriv::cle
ar"); | 208 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContextPriv::cle
ar"); |
| 209 | 209 |
| 210 AutoCheckFlush acf(fDrawContext->fDrawingManager); | 210 AutoCheckFlush acf(fDrawContext->fDrawingManager); |
| 211 fDrawContext->internalClear(clip, color, canIgnoreClip); | 211 fDrawContext->internalClear(clip, color, canIgnoreClip); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void GrDrawContext::internalClear(const GrFixedClip& clip, | 214 void GrDrawContext::internalClear(const GrFixedClip& clip, |
| 215 const GrColor color, | 215 const GrColor color, |
| 216 bool canIgnoreClip) { | 216 bool canIgnoreClip) { |
| 217 bool isFull = !clip.scissorEnabled() || | 217 bool isFull = false; |
| 218 (canIgnoreClip && fContext->caps()->fullClearIsFree()) || | 218 if (clip.windowRectsState().disabled()) { |
| 219 clip.scissorRect().contains(SkIRect::MakeWH(this->width(), thi
s->height())); | 219 isFull = !clip.scissorEnabled() || |
| 220 (canIgnoreClip && fContext->caps()->fullClearIsFree()) || |
| 221 clip.scissorRect().contains(SkIRect::MakeWH(this->width(), this
->height())); |
| 222 } |
| 220 | 223 |
| 221 if (fContext->caps()->useDrawInsteadOfClear()) { | 224 if (fContext->caps()->useDrawInsteadOfClear()) { |
| 222 // This works around a driver bug with clear by drawing a rect instead. | 225 // This works around a driver bug with clear by drawing a rect instead. |
| 223 // The driver will ignore a clear if it is the only thing rendered to a | 226 // The driver will ignore a clear if it is the only thing rendered to a |
| 224 // target before the target is read. | 227 // target before the target is read. |
| 225 SkRect clearRect = SkRect::MakeIWH(this->width(), this->height()); | 228 SkRect clearRect = SkRect::MakeIWH(this->width(), this->height()); |
| 226 if (isFull) { | 229 if (isFull) { |
| 227 this->discard(); | 230 this->discard(); |
| 228 } else if (!clearRect.intersect(SkRect::Make(clip.scissorRect()))) { | 231 } else if (!clearRect.intersect(SkRect::Make(clip.scissorRect()))) { |
| 229 return; | 232 return; |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 | 1396 |
| 1394 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1397 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
| 1395 GrDrawBatch* batch) { | 1398 GrDrawBatch* batch) { |
| 1396 ASSERT_SINGLE_OWNER | 1399 ASSERT_SINGLE_OWNER |
| 1397 RETURN_IF_ABANDONED | 1400 RETURN_IF_ABANDONED |
| 1398 SkDEBUGCODE(this->validate();) | 1401 SkDEBUGCODE(this->validate();) |
| 1399 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1402 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 1400 | 1403 |
| 1401 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1404 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 1402 } | 1405 } |
| OLD | NEW |