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 |
11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
12 #include "GrBufferAllocPool.h" | |
13 #include "GrContext.h" | 12 #include "GrContext.h" |
14 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
15 #include "GrPath.h" | 14 #include "GrPath.h" |
16 #include "GrPipeline.h" | 15 #include "GrPipeline.h" |
17 #include "GrMemoryPool.h" | 16 #include "GrMemoryPool.h" |
18 #include "GrRectBatch.h" | 17 #include "GrRectBatch.h" |
19 #include "GrRenderTarget.h" | 18 #include "GrRenderTarget.h" |
20 #include "GrRenderTargetPriv.h" | 19 #include "GrRenderTargetPriv.h" |
21 #include "GrSurfacePriv.h" | 20 #include "GrSurfacePriv.h" |
22 #include "GrTemplates.h" | 21 #include "GrTemplates.h" |
23 #include "GrTexture.h" | 22 #include "GrTexture.h" |
24 #include "GrVertexBuffer.h" | 23 #include "GrVertexBuffer.h" |
25 | 24 |
26 #include "SkStrokeRec.h" | 25 #include "SkStrokeRec.h" |
27 | 26 |
28 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
29 | 28 |
30 #define DEBUG_INVAL_BUFFER 0xdeadcafe | 29 #define DEBUG_INVAL_BUFFER 0xdeadcafe |
31 #define DEBUG_INVAL_START_IDX -1 | 30 #define DEBUG_INVAL_START_IDX -1 |
32 | 31 |
33 GrDrawTarget::GrDrawTarget(GrContext* context, | 32 GrDrawTarget::GrDrawTarget(GrContext* context) |
34 GrVertexBufferAllocPool* vpool, | |
35 GrIndexBufferAllocPool* ipool) | |
36 : fContext(context) | 33 : fContext(context) |
37 , fCaps(SkRef(context->getGpu()->caps())) | 34 , fCaps(SkRef(context->getGpu()->caps())) |
38 , fGpuTraceMarkerCount(0) | 35 , fGpuTraceMarkerCount(0) |
39 , fVertexPool(vpool) | |
40 , fIndexPool(ipool) | |
41 , fFlushing(false) { | 36 , fFlushing(false) { |
42 SkASSERT(context); | 37 SkASSERT(context); |
43 } | 38 } |
44 | 39 |
45 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
46 | 41 |
47 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, | 42 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, |
48 const GrProcOptInfo& colorPOI, | 43 const GrProcOptInfo& colorPOI, |
49 const GrProcOptInfo& coveragePOI, | 44 const GrProcOptInfo& coveragePOI, |
50 GrDeviceCoordTexture* dstCopy, | 45 GrDeviceCoordTexture* dstCopy, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 SkIPoint dstPoint = {0, 0}; | 101 SkIPoint dstPoint = {0, 0}; |
107 if (this->copySurface(copy, rt, copyRect, dstPoint)) { | 102 if (this->copySurface(copy, rt, copyRect, dstPoint)) { |
108 dstCopy->setTexture(copy); | 103 dstCopy->setTexture(copy); |
109 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); | 104 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); |
110 return true; | 105 return true; |
111 } else { | 106 } else { |
112 return false; | 107 return false; |
113 } | 108 } |
114 } | 109 } |
115 | 110 |
116 void GrDrawTarget::reset() { | |
117 fVertexPool->reset(); | |
118 fIndexPool->reset(); | |
119 | |
120 this->onReset(); | |
121 } | |
122 | |
123 void GrDrawTarget::flush() { | 111 void GrDrawTarget::flush() { |
124 if (fFlushing) { | 112 if (fFlushing) { |
125 return; | 113 return; |
126 } | 114 } |
127 fFlushing = true; | 115 fFlushing = true; |
128 | 116 |
129 this->getGpu()->saveActiveTraceMarkers(); | 117 this->getGpu()->saveActiveTraceMarkers(); |
130 | 118 |
131 this->onFlush(); | 119 this->onFlush(); |
132 | 120 |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, | 763 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, |
776 GrPipelineBuilder::AutoRestoreStencil* ars, | 764 GrPipelineBuilder::AutoRestoreStencil* ars, |
777 GrScissorState* scissorState, | 765 GrScissorState* scissorState, |
778 const SkRect* devBounds) { | 766 const SkRect* devBounds) { |
779 return fClipMaskManager.setupClipping(pipelineBuilder, | 767 return fClipMaskManager.setupClipping(pipelineBuilder, |
780 arfp, | 768 arfp, |
781 ars, | 769 ars, |
782 scissorState, | 770 scissorState, |
783 devBounds); | 771 devBounds); |
784 } | 772 } |
OLD | NEW |