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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 SkDEBUGCODE(fDrawContext->validate();) | 208 SkDEBUGCODE(fDrawContext->validate();) |
209 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContextPriv::cle
ar"); | 209 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContextPriv::cle
ar"); |
210 | 210 |
211 AutoCheckFlush acf(fDrawContext->fDrawingManager); | 211 AutoCheckFlush acf(fDrawContext->fDrawingManager); |
212 fDrawContext->internalClear(clip, color, canIgnoreClip); | 212 fDrawContext->internalClear(clip, color, canIgnoreClip); |
213 } | 213 } |
214 | 214 |
215 void GrDrawContext::internalClear(const GrFixedClip& clip, | 215 void GrDrawContext::internalClear(const GrFixedClip& clip, |
216 const GrColor color, | 216 const GrColor color, |
217 bool canIgnoreClip) { | 217 bool canIgnoreClip) { |
218 bool isFull = false; | 218 bool isFull = !clip.scissorEnabled() || |
219 if (!clip.hasWindowRectangles()) { | 219 (canIgnoreClip && fContext->caps()->fullClearIsFree()) || |
220 isFull = !clip.scissorEnabled() || | 220 clip.scissorRect().contains(SkIRect::MakeWH(this->width(), thi
s->height())); |
221 (canIgnoreClip && fContext->caps()->fullClearIsFree()) || | |
222 clip.scissorRect().contains(SkIRect::MakeWH(this->width(), this
->height())); | |
223 } | |
224 | 221 |
225 if (fContext->caps()->useDrawInsteadOfClear()) { | 222 if (fContext->caps()->useDrawInsteadOfClear()) { |
226 // This works around a driver bug with clear by drawing a rect instead. | 223 // This works around a driver bug with clear by drawing a rect instead. |
227 // The driver will ignore a clear if it is the only thing rendered to a | 224 // The driver will ignore a clear if it is the only thing rendered to a |
228 // target before the target is read. | 225 // target before the target is read. |
229 SkRect clearRect = SkRect::MakeIWH(this->width(), this->height()); | 226 SkRect clearRect = SkRect::MakeIWH(this->width(), this->height()); |
230 if (isFull) { | 227 if (isFull) { |
231 this->discard(); | 228 this->discard(); |
232 } else if (!clearRect.intersect(SkRect::Make(clip.scissorRect()))) { | 229 } else if (!clearRect.intersect(SkRect::Make(clip.scissorRect()))) { |
233 return; | 230 return; |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 | 1425 |
1429 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1426 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
1430 GrDrawBatch* batch) { | 1427 GrDrawBatch* batch) { |
1431 ASSERT_SINGLE_OWNER | 1428 ASSERT_SINGLE_OWNER |
1432 RETURN_IF_ABANDONED | 1429 RETURN_IF_ABANDONED |
1433 SkDEBUGCODE(this->validate();) | 1430 SkDEBUGCODE(this->validate();) |
1434 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1431 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1435 | 1432 |
1436 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1433 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1437 } | 1434 } |
OLD | NEW |