OLD | NEW |
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 Loading... |
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! |
| 473 GrPipelineBuilder pipelineBuilder; |
| 474 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSr
c_Mode)); |
| 475 |
472 SkRect scalarRect = SkRect::Make(*rect); | 476 SkRect scalarRect = SkRect::Make(*rect); |
473 | 477 SkAutoTUnref<GrDrawBatch> batch( |
474 GrPaint paint; | 478 GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(), scalar
Rect, |
475 paint.setColor4f(GrColor4f::FromGrColor(color)); | 479 nullptr, nullptr)); |
476 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); | 480 this->drawBatch(pipelineBuilder, drawContext, GrNoClip(), batch); |
477 | |
478 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), scalarRect); | |
479 } else { | 481 } else { |
480 GrBatch* batch = new GrClearBatch(*rect, color, drawContext->accessRende
rTarget()); | 482 GrBatch* batch = new GrClearBatch(*rect, color, drawContext->accessRende
rTarget()); |
481 this->recordBatch(batch, batch->bounds()); | 483 this->recordBatch(batch, batch->bounds()); |
482 batch->unref(); | 484 batch->unref(); |
483 } | 485 } |
484 } | 486 } |
485 | 487 |
486 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { | 488 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
487 if (this->caps()->discardRenderTargetSupport()) { | 489 if (this->caps()->discardRenderTargetSupport()) { |
488 GrBatch* batch = new GrDiscardBatch(renderTarget); | 490 GrBatch* batch = new GrDiscardBatch(renderTarget); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 } | 628 } |
627 } | 629 } |
628 | 630 |
629 /////////////////////////////////////////////////////////////////////////////// | 631 /////////////////////////////////////////////////////////////////////////////// |
630 | 632 |
631 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 633 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
632 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 634 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
633 this->recordBatch(batch, batch->bounds()); | 635 this->recordBatch(batch, batch->bounds()); |
634 batch->unref(); | 636 batch->unref(); |
635 } | 637 } |
OLD | NEW |