| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
| 9 | 9 |
| 10 GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrContext* context, | 10 GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrContext* context) |
| 11 GrVertexBufferAllocPool* vertexPool, | 11 : INHERITED(context) |
| 12 GrIndexBufferAllocPool* indexPool) | 12 , fCommands(SkNEW_ARGS(GrInOrderCommandBuilder, (context->getGpu()))) |
| 13 : INHERITED(context, vertexPool, indexPool) | |
| 14 , fCommands(SkNEW_ARGS(GrInOrderCommandBuilder, (context->getGpu(), vertexPo
ol, indexPool))) | |
| 15 , fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4) | 13 , fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4) |
| 16 , fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4) | 14 , fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4) |
| 17 , fPipelineBuffer(kPipelineBufferMinReserve) | 15 , fPipelineBuffer(kPipelineBufferMinReserve) |
| 18 , fDrawID(0) { | 16 , fDrawID(0) { |
| 19 | |
| 20 SkASSERT(vertexPool); | |
| 21 SkASSERT(indexPool); | |
| 22 } | 17 } |
| 23 | 18 |
| 24 GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { | 19 GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { |
| 25 this->reset(); | 20 this->reset(); |
| 26 } | 21 } |
| 27 | 22 |
| 28 void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch, | 23 void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch, |
| 29 const PipelineInfo& pipelineInfo) { | 24 const PipelineInfo& pipelineInfo) { |
| 30 State* state = this->setupPipelineAndShouldDraw(batch, pipelineInfo); | 25 State* state = this->setupPipelineAndShouldDraw(batch, pipelineInfo); |
| 31 if (!state) { | 26 if (!state) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { | 187 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { |
| 193 this->unallocState(state); | 188 this->unallocState(state); |
| 194 } else { | 189 } else { |
| 195 fPrevState.reset(state); | 190 fPrevState.reset(state); |
| 196 } | 191 } |
| 197 | 192 |
| 198 this->recordTraceMarkersIfNecessary( | 193 this->recordTraceMarkersIfNecessary( |
| 199 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); | 194 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); |
| 200 return fPrevState; | 195 return fPrevState; |
| 201 } | 196 } |
| OLD | NEW |