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" |
11 #include "GrCaps.h" | 11 #include "GrCaps.h" |
12 #include "GrDrawContext.h" | 12 #include "GrDrawContext.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrGpuCommandBuffer.h" | 14 #include "GrGpuCommandBuffer.h" |
15 #include "GrPath.h" | 15 #include "GrPath.h" |
16 #include "GrPipeline.h" | 16 #include "GrPipeline.h" |
17 #include "GrMemoryPool.h" | 17 #include "GrMemoryPool.h" |
18 #include "GrPipelineBuilder.h" | 18 #include "GrPipelineBuilder.h" |
19 #include "GrRenderTarget.h" | 19 #include "GrRenderTarget.h" |
20 #include "GrResourceProvider.h" | 20 #include "GrResourceProvider.h" |
21 #include "GrRenderTargetPriv.h" | 21 #include "GrRenderTargetPriv.h" |
22 #include "GrStencilAttachment.h" | 22 #include "GrStencilAttachment.h" |
23 #include "GrSurfacePriv.h" | 23 #include "GrSurfacePriv.h" |
24 #include "GrTexture.h" | 24 #include "GrTexture.h" |
25 #include "gl/GrGLRenderTarget.h" | 25 #include "gl/GrGLRenderTarget.h" |
26 | 26 |
27 #include "SkStrokeRec.h" | 27 #include "SkStrokeRec.h" |
28 | 28 |
| 29 #include "batches/GrClearBatch.h" |
29 #include "batches/GrClearStencilClipBatch.h" | 30 #include "batches/GrClearStencilClipBatch.h" |
30 #include "batches/GrCopySurfaceBatch.h" | 31 #include "batches/GrCopySurfaceBatch.h" |
31 #include "batches/GrDiscardBatch.h" | 32 #include "batches/GrDiscardBatch.h" |
32 #include "batches/GrDrawBatch.h" | 33 #include "batches/GrDrawBatch.h" |
33 #include "batches/GrDrawPathBatch.h" | 34 #include "batches/GrDrawPathBatch.h" |
34 #include "batches/GrRectBatchFactory.h" | 35 #include "batches/GrRectBatchFactory.h" |
35 #include "batches/GrStencilPathBatch.h" | 36 #include "batches/GrStencilPathBatch.h" |
36 | 37 |
37 #include "instanced/InstancedRendering.h" | 38 #include "instanced/InstancedRendering.h" |
38 | 39 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 drawContext->accessRenderTarget(
), | 450 drawContext->accessRenderTarget(
), |
450 path); | 451 path); |
451 this->recordBatch(batch, appliedClip.deviceBounds()); | 452 this->recordBatch(batch, appliedClip.deviceBounds()); |
452 batch->unref(); | 453 batch->unref(); |
453 } | 454 } |
454 | 455 |
455 void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) { | 456 void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) { |
456 this->recordBatch(batch.get(), batch->bounds()); | 457 this->recordBatch(batch.get(), batch->bounds()); |
457 } | 458 } |
458 | 459 |
| 460 void GrDrawTarget::fullClear(GrRenderTarget* renderTarget, GrColor color) { |
| 461 // Currently this just inserts a clear batch. However, once in MDB this can
remove all the |
| 462 // previously recorded batches and change the load op to clear with supplied
color. |
| 463 sk_sp<GrBatch> batch = GrClearBatch::Make(SkIRect::MakeWH(renderTarget->widt
h(), |
| 464 renderTarget->heig
ht()), |
| 465 color, renderTarget); |
| 466 this->recordBatch(batch.get(), batch->bounds()); |
| 467 } |
| 468 |
459 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { | 469 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
| 470 // Currently this just inserts a discard batch. However, once in MDB this ca
n remove all the |
| 471 // previously recorded batches and change the load op to discard. |
460 if (this->caps()->discardRenderTargetSupport()) { | 472 if (this->caps()->discardRenderTargetSupport()) { |
461 GrBatch* batch = new GrDiscardBatch(renderTarget); | 473 GrBatch* batch = new GrDiscardBatch(renderTarget); |
462 this->recordBatch(batch, batch->bounds()); | 474 this->recordBatch(batch, batch->bounds()); |
463 batch->unref(); | 475 batch->unref(); |
464 } | 476 } |
465 } | 477 } |
466 | 478 |
467 //////////////////////////////////////////////////////////////////////////////// | 479 //////////////////////////////////////////////////////////////////////////////// |
468 | 480 |
469 bool GrDrawTarget::copySurface(GrSurface* dst, | 481 bool GrDrawTarget::copySurface(GrSurface* dst, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 611 } |
600 } | 612 } |
601 | 613 |
602 /////////////////////////////////////////////////////////////////////////////// | 614 /////////////////////////////////////////////////////////////////////////////// |
603 | 615 |
604 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 616 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
605 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 617 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
606 this->recordBatch(batch, batch->bounds()); | 618 this->recordBatch(batch, batch->bounds()); |
607 batch->unref(); | 619 batch->unref(); |
608 } | 620 } |
OLD | NEW |