| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2014 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 "GrFlushToGpuDrawTarget.h" | |
| 9 #include "GrContext.h" | |
| 10 #include "GrGpu.h" | |
| 11 #include "GrBufferAllocPool.h" | |
| 12 | |
| 13 GrFlushToGpuDrawTarget::GrFlushToGpuDrawTarget(GrGpu* gpu, | |
| 14 GrVertexBufferAllocPool* vertexPo
ol, | |
| 15 GrIndexBufferAllocPool* indexPool
) | |
| 16 : INHERITED(gpu->getContext()) | |
| 17 , fGpu(SkRef(gpu)) | |
| 18 , fVertexPool(vertexPool) | |
| 19 , fIndexPool(indexPool) | |
| 20 , fFlushing(false) { | |
| 21 | |
| 22 fCaps.reset(SkRef(fGpu->caps())); | |
| 23 | |
| 24 SkASSERT(vertexPool); | |
| 25 SkASSERT(indexPool); | |
| 26 | |
| 27 } | |
| 28 | |
| 29 void GrFlushToGpuDrawTarget::reset() { | |
| 30 fVertexPool->reset(); | |
| 31 fIndexPool->reset(); | |
| 32 | |
| 33 this->onReset(); | |
| 34 } | |
| 35 | |
| 36 void GrFlushToGpuDrawTarget::flush() { | |
| 37 if (fFlushing) { | |
| 38 return; | |
| 39 } | |
| 40 fFlushing = true; | |
| 41 | |
| 42 fGpu->saveActiveTraceMarkers(); | |
| 43 | |
| 44 this->onFlush(); | |
| 45 | |
| 46 fGpu->restoreActiveTraceMarkers(); | |
| 47 | |
| 48 fFlushing = false; | |
| 49 this->reset(); | |
| 50 } | |
| 51 | |
| 52 bool GrFlushToGpuDrawTarget::onCanCopySurface(const GrSurface* dst, | |
| 53 const GrSurface* src, | |
| 54 const SkIRect& srcRect, | |
| 55 const SkIPoint& dstPoint) { | |
| 56 return getGpu()->canCopySurface(dst, src, srcRect, dstPoint); | |
| 57 } | |
| 58 | |
| 59 bool GrFlushToGpuDrawTarget::onInitCopySurfaceDstDesc(const GrSurface* src, GrSu
rfaceDesc* desc) { | |
| 60 return getGpu()->initCopySurfaceDstDesc(src, desc); | |
| 61 } | |
| OLD | NEW |