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

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

Issue 2125333002: Add choke point for modifying non-AA rect draws (e.g., applying clipping) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix infinite optimization loop Created 4 years, 5 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
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 "GrDrawTarget.h" 8 #include "GrDrawTarget.h"
9 9
10 #include "GrAuditTrail.h" 10 #include "GrAuditTrail.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 462 }
463 463
464 if (this->caps()->useDrawInsteadOfClear()) { 464 if (this->caps()->useDrawInsteadOfClear()) {
465 // This works around a driver bug with clear by drawing a rect instead. 465 // This works around a driver bug with clear by drawing a rect instead.
466 // The driver will ignore a clear if it is the only thing rendered to a 466 // The driver will ignore a clear if it is the only thing rendered to a
467 // target before the target is read. 467 // target before the target is read.
468 if (rect == &rtRect) { 468 if (rect == &rtRect) {
469 drawContext->discard(); 469 drawContext->discard();
470 } 470 }
471 471
472 // TODO: flip this into real draw! 472 SkRect scalarRect = SkRect::Make(*rect);
473 GrPipelineBuilder pipelineBuilder;
474 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSr c_Mode));
475 473
476 SkRect scalarRect = SkRect::Make(*rect); 474 GrPaint paint;
477 SkAutoTUnref<GrDrawBatch> batch( 475 paint.setColor4f(GrColor4f::FromGrColor(color));
478 GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(), scalar Rect, 476 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
479 nullptr, nullptr)); 477
480 this->drawBatch(pipelineBuilder, drawContext, GrNoClip(), batch); 478 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), scalarRect);
481 } else { 479 } else {
482 GrBatch* batch = new GrClearBatch(*rect, color, drawContext->accessRende rTarget()); 480 GrBatch* batch = new GrClearBatch(*rect, color, drawContext->accessRende rTarget());
483 this->recordBatch(batch, batch->bounds()); 481 this->recordBatch(batch, batch->bounds());
484 batch->unref(); 482 batch->unref();
485 } 483 }
486 } 484 }
487 485
488 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { 486 void GrDrawTarget::discard(GrRenderTarget* renderTarget) {
489 if (this->caps()->discardRenderTargetSupport()) { 487 if (this->caps()->discardRenderTargetSupport()) {
490 GrBatch* batch = new GrDiscardBatch(renderTarget); 488 GrBatch* batch = new GrDiscardBatch(renderTarget);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 626 }
629 } 627 }
630 628
631 /////////////////////////////////////////////////////////////////////////////// 629 ///////////////////////////////////////////////////////////////////////////////
632 630
633 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 631 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
634 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 632 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
635 this->recordBatch(batch, batch->bounds()); 633 this->recordBatch(batch, batch->bounds());
636 batch->unref(); 634 batch->unref();
637 } 635 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698