OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) | 35 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) |
36 : fGpu(SkRef(gpu)) | 36 : fGpu(SkRef(gpu)) |
37 , fResourceProvider(resourceProvider) | 37 , fResourceProvider(resourceProvider) |
38 , fFlushState(fGpu, fResourceProvider, 0) | 38 , fFlushState(fGpu, fResourceProvider, 0) |
39 , fFlushing(false) | 39 , fFlushing(false) |
40 , fFirstUnpreparedBatch(0) | 40 , fFirstUnpreparedBatch(0) |
41 , fFlags(0) { | 41 , fFlags(0) { |
42 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) | 42 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) |
43 fContext = fGpu->getContext(); | 43 fContext = fGpu->getContext(); |
44 fClipMaskManager.reset(new GrClipMaskManager(this)); | 44 fClipMaskManager.reset(new GrClipMaskManager(this)); |
| 45 |
| 46 #ifdef SK_DEBUG |
| 47 static int debugID = 0; |
| 48 fDebugID = debugID++; |
| 49 #endif |
45 } | 50 } |
46 | 51 |
47 GrDrawTarget::~GrDrawTarget() { | 52 GrDrawTarget::~GrDrawTarget() { |
48 fGpu->unref(); | 53 fGpu->unref(); |
49 } | 54 } |
50 | 55 |
51 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
52 | 57 |
53 // Add a GrDrawTarget-based dependency | 58 // Add a GrDrawTarget-based dependency |
54 void GrDrawTarget::addDependency(GrDrawTarget* dependedOn) { | 59 void GrDrawTarget::addDependency(GrDrawTarget* dependedOn) { |
(...skipping 17 matching lines...) Expand all Loading... |
72 // self-read - presumably for dst reads | 77 // self-read - presumably for dst reads |
73 } else { | 78 } else { |
74 this->addDependency(dt); | 79 this->addDependency(dt); |
75 | 80 |
76 // Can't make it closed in the self-read case | 81 // Can't make it closed in the self-read case |
77 dt->makeClosed(); | 82 dt->makeClosed(); |
78 } | 83 } |
79 } | 84 } |
80 } | 85 } |
81 | 86 |
| 87 #ifdef SK_DEBUG |
| 88 void GrDrawTarget::dump() const { |
| 89 SkDebugf("--------------------------------------------------------------\n")
; |
| 90 SkDebugf("node: %d\n"); |
| 91 SkDebugf("relies On (%d): ", fDependencies.count()); |
| 92 for (int i = 0; i < fDependencies.count(); ++i) { |
| 93 SkDebugf("%d, ", fDependencies[i]->fDebugID); |
| 94 } |
| 95 SkDebugf("\n"); |
| 96 SkDebugf("batches (%d):\n", fBatches.count()); |
| 97 for (int i = 0; i < fBatches.count(); ++i) { |
| 98 #if 0 |
| 99 SkDebugf("*******************************\n"); |
| 100 #endif |
| 101 SkDebugf("%d: %s\n", i, fBatches[i]->name()); |
| 102 #if 0 |
| 103 SkString str = fBatches[i]->dumpInfo(); |
| 104 SkDebugf("%s\n", str.c_str()); |
| 105 #endif |
| 106 } |
| 107 } |
| 108 #endif |
| 109 |
82 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, | 110 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, |
83 const GrProcOptInfo& colorPOI, | 111 const GrProcOptInfo& colorPOI, |
84 const GrProcOptInfo& coveragePOI, | 112 const GrProcOptInfo& coveragePOI, |
85 GrXferProcessor::DstTexture* dstTextu
re, | 113 GrXferProcessor::DstTexture* dstTextu
re, |
86 const SkRect& batchBounds) { | 114 const SkRect& batchBounds) { |
87 SkRect bounds = batchBounds; | 115 SkRect bounds = batchBounds; |
88 bounds.outset(0.5f, 0.5f); | 116 bounds.outset(0.5f, 0.5f); |
89 | 117 |
90 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coverageP
OI)) { | 118 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coverageP
OI)) { |
91 return true; | 119 return true; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 } | 548 } |
521 | 549 |
522 return true; | 550 return true; |
523 } | 551 } |
524 | 552 |
525 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 553 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
526 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 554 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
527 this->recordBatch(batch); | 555 this->recordBatch(batch); |
528 batch->unref(); | 556 batch->unref(); |
529 } | 557 } |
OLD | NEW |