| 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 "GrBufferedDrawTarget.h" | 8 #include "GrBufferedDrawTarget.h" |
| 9 | 9 |
| 10 // We will use the reordering buffer, unless we have NVPR. | 10 // We will use the reordering buffer, unless we have NVPR. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } else { | 82 } else { |
| 83 fPipelineBuffer.reset(); | 83 fPipelineBuffer.reset(); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 void GrBufferedDrawTarget::onFlush() { | 87 void GrBufferedDrawTarget::onFlush() { |
| 88 fCommands->flush(this->getGpu(), this->getContext()->resourceProvider()); | 88 fCommands->flush(this->getGpu(), this->getContext()->resourceProvider()); |
| 89 ++fDrawID; | 89 ++fDrawID; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void GrBufferedDrawTarget::onCopySurface(GrSurface* dst, | |
| 93 GrSurface* src, | |
| 94 const SkIRect& srcRect, | |
| 95 const SkIPoint& dstPoint) { | |
| 96 fCommands->recordCopySurface(dst, src, srcRect, dstPoint); | |
| 97 } | |
| 98 | |
| 99 GrTargetCommands::StateForPathDraw* | 92 GrTargetCommands::StateForPathDraw* |
| 100 GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primPro
c, | 93 GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primPro
c, |
| 101 const GrDrawTarget::PipelineInfo& p
ipelineInfo, | 94 const GrDrawTarget::PipelineInfo& p
ipelineInfo, |
| 102 GrPipelineOptimizations* opts) { | 95 GrPipelineOptimizations* opts) { |
| 103 StateForPathDraw* state = this->allocState(primProc); | 96 StateForPathDraw* state = this->allocState(primProc); |
| 104 if (!GrPipeline::CreateAt(state->pipelineLocation(), pipelineInfo.pipelineCr
eateArgs(), opts)) { | 97 if (!GrPipeline::CreateAt(state->pipelineLocation(), pipelineInfo.pipelineCr
eateArgs(), opts)) { |
| 105 this->unallocState(state); | 98 this->unallocState(state); |
| 106 return NULL; | 99 return NULL; |
| 107 } | 100 } |
| 108 | 101 |
| 109 state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, *opts); | 102 state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, *opts); |
| 110 | 103 |
| 111 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && | 104 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && |
| 112 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, | 105 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, |
| 113 *state->fPrimitiveProcesso
r, | 106 *state->fPrimitiveProcesso
r, |
| 114 state->fBatchTracker) && | 107 state->fBatchTracker) && |
| 115 GrPipeline::AreEqual(*fPrevState->getPipeline(), *state->getPipeline(),
false)) { | 108 GrPipeline::AreEqual(*fPrevState->getPipeline(), *state->getPipeline(),
false)) { |
| 116 this->unallocState(state); | 109 this->unallocState(state); |
| 117 } else { | 110 } else { |
| 118 fPrevState.reset(state); | 111 fPrevState.reset(state); |
| 119 } | 112 } |
| 120 | 113 |
| 121 return fPrevState; | 114 return fPrevState; |
| 122 } | 115 } |
| OLD | NEW |