| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTargetCommands.h" | 8 #include "GrTargetCommands.h" |
| 9 | 9 |
| 10 #include "GrBufferedDrawTarget.h" | 10 #include "GrBufferedDrawTarget.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 GrGpu* gpu = bufferedDrawTarget->getGpu(); | 25 GrGpu* gpu = bufferedDrawTarget->getGpu(); |
| 26 | 26 |
| 27 // Loop over all batches and generate geometry | 27 // Loop over all batches and generate geometry |
| 28 CmdBuffer::Iter genIter(fCmdBuffer); | 28 CmdBuffer::Iter genIter(fCmdBuffer); |
| 29 while (genIter.next()) { | 29 while (genIter.next()) { |
| 30 if (Cmd::kDrawBatch_CmdType == genIter->type()) { | 30 if (Cmd::kDrawBatch_CmdType == genIter->type()) { |
| 31 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get()); | 31 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get()); |
| 32 fBatchTarget.resetNumberOfDraws(); | 32 fBatchTarget.resetNumberOfDraws(); |
| 33 db->batch()->generateGeometry(&fBatchTarget); | 33 // TODO: encapsulate the specialization of GrVertexBatch in GrVertex
Batch so that we can |
| 34 db->batch()->setNumberOfDraws(fBatchTarget.numberOfDraws()); | 34 // remove this cast. Currently all GrDrawBatches are in fact GrVerte
xBatch. |
| 35 GrVertexBatch* vertexBatch = static_cast<GrVertexBatch*>(db->batch()
); |
| 36 |
| 37 vertexBatch->generateGeometry(&fBatchTarget); |
| 38 vertexBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); |
| 35 } | 39 } |
| 36 } | 40 } |
| 37 | 41 |
| 38 fBatchTarget.preFlush(); | 42 fBatchTarget.preFlush(); |
| 39 | 43 |
| 40 CmdBuffer::Iter iter(fCmdBuffer); | 44 CmdBuffer::Iter iter(fCmdBuffer); |
| 41 | 45 |
| 42 while (iter.next()) { | 46 while (iter.next()) { |
| 43 iter->execute(gpu); | 47 iter->execute(gpu); |
| 44 } | 48 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 69 fState->fBatchTracker); | 73 fState->fBatchTracker); |
| 70 fState->fCompiled = true; | 74 fState->fCompiled = true; |
| 71 } | 75 } |
| 72 GrPathRendering::DrawPathArgs args(fState->fPrimitiveProcessor.get(), fState
->getPipeline(), | 76 GrPathRendering::DrawPathArgs args(fState->fPrimitiveProcessor.get(), fState
->getPipeline(), |
| 73 &fState->fDesc, &fState->fBatchTracker, &
fStencilSettings); | 77 &fState->fDesc, &fState->fBatchTracker, &
fStencilSettings); |
| 74 gpu->pathRendering()->drawPaths(args, this->pathRange(), fIndices, fIndexTyp
e, fTransforms, | 78 gpu->pathRendering()->drawPaths(args, this->pathRange(), fIndices, fIndexTyp
e, fTransforms, |
| 75 fTransformType, fCount); | 79 fTransformType, fCount); |
| 76 } | 80 } |
| 77 | 81 |
| 78 void GrTargetCommands::DrawBatch::execute(GrGpu* gpu) { | 82 void GrTargetCommands::DrawBatch::execute(GrGpu* gpu) { |
| 79 fBatchTarget->flushNext(fBatch->numberOfDraws()); | 83 // TODO: encapsulate the specialization of GrVertexBatch in GrVertexBatch so
that we can |
| 84 // remove this cast. Currently all GrDrawBatches are in fact GrVertexBatch. |
| 85 const GrVertexBatch* vertexBatch = static_cast<const GrVertexBatch*>(fBatch.
get()); |
| 86 fBatchTarget->flushNext(vertexBatch->numberOfDraws()); |
| 80 } | 87 } |
| 81 | 88 |
| 82 void GrTargetCommands::Clear::execute(GrGpu* gpu) { | 89 void GrTargetCommands::Clear::execute(GrGpu* gpu) { |
| 83 if (GrColor_ILLEGAL == fColor) { | 90 if (GrColor_ILLEGAL == fColor) { |
| 84 gpu->discard(this->renderTarget()); | 91 gpu->discard(this->renderTarget()); |
| 85 } else { | 92 } else { |
| 86 gpu->clear(fRect, fColor, this->renderTarget()); | 93 gpu->clear(fRect, fColor, this->renderTarget()); |
| 87 } | 94 } |
| 88 } | 95 } |
| 89 | 96 |
| 90 void GrTargetCommands::ClearStencilClip::execute(GrGpu* gpu) { | 97 void GrTargetCommands::ClearStencilClip::execute(GrGpu* gpu) { |
| 91 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); | 98 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); |
| 92 } | 99 } |
| 93 | 100 |
| 94 void GrTargetCommands::CopySurface::execute(GrGpu* gpu) { | 101 void GrTargetCommands::CopySurface::execute(GrGpu* gpu) { |
| 95 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); | 102 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); |
| 96 } | 103 } |
| OLD | NEW |