1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "GrFlushToGpuDrawTarget.h"
#include "GrContext.h"
#include "GrGpu.h"
#include "GrBufferAllocPool.h"
GrFlushToGpuDrawTarget::GrFlushToGpuDrawTarget(GrGpu* gpu,
GrVertexBufferAllocPool* vertexPool,
GrIndexBufferAllocPool* indexPool)
: INHERITED(gpu->getContext())
, fGpu(SkRef(gpu))
, fVertexPool(vertexPool)
, fIndexPool(indexPool)
, fFlushing(false) {
fCaps.reset(SkRef(fGpu->caps()));
SkASSERT(vertexPool);
SkASSERT(indexPool);
}
void GrFlushToGpuDrawTarget::reset() {
fVertexPool->reset();
fIndexPool->reset();
this->onReset();
}
void GrFlushToGpuDrawTarget::flush() {
if (fFlushing) {
return;
}
fFlushing = true;
fGpu->saveActiveTraceMarkers();
this->onFlush();
fGpu->restoreActiveTraceMarkers();
fFlushing = false;
this->reset();
}
bool GrFlushToGpuDrawTarget::onCanCopySurface(const GrSurface* dst,
const GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
return getGpu()->canCopySurface(dst, src, srcRect, dstPoint);
}
bool GrFlushToGpuDrawTarget::onInitCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) {
return getGpu()->initCopySurfaceDstDesc(src, desc);
}
|