Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: src/gpu/GrDrawContext.cpp

Issue 2289363005: Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: Improve usage of window rectangles Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698