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

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: update 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
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 420
421 if (this->caps()->useDrawInsteadOfClear()) { 421 if (this->caps()->useDrawInsteadOfClear()) {
422 // This works around a driver bug with clear by drawing a rect instead. 422 // This works around a driver bug with clear by drawing a rect instead.
423 // The driver will ignore a clear if it is the only thing rendered to a 423 // The driver will ignore a clear if it is the only thing rendered to a
424 // target before the target is read. 424 // target before the target is read.
425 if (rect == &rtRect) { 425 if (rect == &rtRect) {
426 drawContext->discard(); 426 drawContext->discard();
427 } 427 }
428 428
429 // TODO: flip this into real draw! 429 SkRect scalarRect = SkRect::Make(*rect);
430 GrPipelineBuilder pipelineBuilder;
431 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSr c_Mode));
432 430
433 SkRect scalarRect = SkRect::Make(*rect); 431 GrPaint paint;
434 SkAutoTUnref<GrDrawBatch> batch( 432 paint.setColor4f(GrColor4f::FromGrColor(color));
435 GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(), scalar Rect, 433 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
436 nullptr, nullptr)); 434
437 this->drawBatch(pipelineBuilder, drawContext, GrNoClip(), batch); 435 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), scalarRect);
438 } else { 436 } else {
439 GrBatch* batch = new GrClearBatch(*rect, color, drawContext->accessRende rTarget()); 437 GrBatch* batch = new GrClearBatch(*rect, color, drawContext->accessRende rTarget());
440 this->recordBatch(batch); 438 this->recordBatch(batch);
441 batch->unref(); 439 batch->unref();
442 } 440 }
443 } 441 }
444 442
445 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { 443 void GrDrawTarget::discard(GrRenderTarget* renderTarget) {
446 if (this->caps()->discardRenderTargetSupport()) { 444 if (this->caps()->discardRenderTargetSupport()) {
447 GrBatch* batch = new GrDiscardBatch(renderTarget); 445 GrBatch* batch = new GrDiscardBatch(renderTarget);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 570 }
573 } 571 }
574 572
575 /////////////////////////////////////////////////////////////////////////////// 573 ///////////////////////////////////////////////////////////////////////////////
576 574
577 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 575 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
578 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 576 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
579 this->recordBatch(batch); 577 this->recordBatch(batch);
580 batch->unref(); 578 batch->unref();
581 } 579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698