| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2011 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "GrBufferedDrawTarget.h" | |
| 9 | |
| 10 // We will use the reordering buffer, unless we have NVPR. | |
| 11 // TODO move NVPR to batch so we can reorder | |
| 12 static inline bool allow_reordering(const GrCaps* caps) { | |
| 13 return caps && caps->shaderCaps() && !caps->shaderCaps()->pathRenderingSuppo
rt(); | |
| 14 } | |
| 15 | |
| 16 GrBufferedDrawTarget::GrBufferedDrawTarget(GrContext* context) | |
| 17 : INHERITED(context) | |
| 18 , fCommands(GrCommandBuilder::Create(context->getGpu(), allow_reordering(con
text->caps()))) | |
| 19 , fDrawID(0) { | |
| 20 } | |
| 21 | |
| 22 GrBufferedDrawTarget::~GrBufferedDrawTarget() { | |
| 23 this->reset(); | |
| 24 } | |
| 25 | |
| 26 void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch) { | |
| 27 fCommands->recordDrawBatch(batch, *this->caps()); | |
| 28 } | |
| 29 | |
| 30 void GrBufferedDrawTarget::onFlush() { | |
| 31 fCommands->flush(this->getGpu(), this->getContext()->resourceProvider()); | |
| 32 ++fDrawID; | |
| 33 } | |
| 34 | |
| 35 void GrBufferedDrawTarget::onReset() { | |
| 36 fCommands->reset(); | |
| 37 } | |
| OLD | NEW |