| 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" |
| 11 | 11 |
| 12 void GrTargetCommands::reset() { | 12 void GrTargetCommands::reset() { |
| 13 fCmdBuffer.reset(); | 13 fCmdBuffer.reset(); |
| 14 fBatchTarget.reset(); | 14 fBatchTarget.reset(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 void GrTargetCommands::flush(GrBufferedDrawTarget* bufferedDrawTarget) { | 17 void GrTargetCommands::flush(GrBufferedDrawTarget* bufferedDrawTarget) { |
| 18 if (fCmdBuffer.empty()) { | 18 if (fCmdBuffer.empty()) { |
| 19 return; | 19 return; |
| 20 } | 20 } |
| 21 | 21 |
| 22 GrGpu* gpu = bufferedDrawTarget->getGpu(); | 22 GrGpu* gpu = bufferedDrawTarget->getGpu(); |
| 23 | 23 |
| 24 // Loop over all batches and generate geometry | 24 // Loop over all batches and generate geometry |
| 25 CmdBuffer::Iter genIter(fCmdBuffer); | 25 CmdBuffer::Iter genIter(fCmdBuffer); |
| 26 while (genIter.next()) { | 26 while (genIter.next()) { |
| 27 if (Cmd::kDrawBatch_CmdType == genIter->type()) { | 27 if (Cmd::kDrawBatch_CmdType == genIter->type()) { |
| 28 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get()); | 28 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get()); |
| 29 fBatchTarget.resetNumberOfDraws(); | 29 fBatchTarget.resetNumberOfDraws(); |
| 30 db->fBatch->generateGeometry(&fBatchTarget, db->fState->getPipeline(
)); | 30 db->fBatch->generateGeometry(&fBatchTarget); |
| 31 db->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); | 31 db->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 fBatchTarget.preFlush(); | 35 fBatchTarget.preFlush(); |
| 36 | 36 |
| 37 CmdBuffer::Iter iter(fCmdBuffer); | 37 CmdBuffer::Iter iter(fCmdBuffer); |
| 38 | 38 |
| 39 while (iter.next()) { | 39 while (iter.next()) { |
| 40 GrGpuTraceMarker newMarker("", -1); | 40 GrGpuTraceMarker newMarker("", -1); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); | 99 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void GrTargetCommands::CopySurface::execute(GrGpu* gpu) { | 102 void GrTargetCommands::CopySurface::execute(GrGpu* gpu) { |
| 103 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); | 103 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GrTargetCommands::XferBarrier::execute(GrGpu* gpu) { | 106 void GrTargetCommands::XferBarrier::execute(GrGpu* gpu) { |
| 107 gpu->xferBarrier(fRenderTarget.get(), fBarrierType); | 107 gpu->xferBarrier(fRenderTarget.get(), fBarrierType); |
| 108 } | 108 } |
| OLD | NEW |