OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrTest.h" | 9 #include "GrTest.h" |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
11 #include "GrGpuResourceCacheAccess.h" | 11 #include "GrGpuResourceCacheAccess.h" |
12 #include "GrInOrderDrawBuffer.h" | 12 #include "GrInOrderDrawBuffer.h" |
13 #include "GrResourceCache.h" | 13 #include "GrResourceCache.h" |
| 14 #include "gl/GrGLInterface.h" |
14 #include "SkString.h" | 15 #include "SkString.h" |
15 | 16 |
16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLContext*
gl) { | 17 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLInterfac
e* gl) { |
17 SkASSERT(!fContext); | 18 SkASSERT(!fContext); |
18 | 19 |
19 fContext.reset(SkRef(ctx)); | 20 fContext.reset(SkRef(ctx)); |
20 fDrawTarget.reset(SkRef(target)); | 21 fDrawTarget.reset(SkRef(target)); |
21 fGLContext.reset(SkRef(gl)); | 22 fGLInterface.reset(SkSafeRef(gl)); |
22 } | 23 } |
23 | 24 |
24 void GrContext::getTestTarget(GrTestTarget* tar) { | 25 void GrContext::getTestTarget(GrTestTarget* tar) { |
25 this->flush(); | 26 this->flush(); |
26 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and | 27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and |
27 // then disconnects. This would help prevent test writers from mixing using
the returned | 28 // then disconnects. This would help prevent test writers from mixing using
the returned |
28 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods | 29 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods |
29 // until ~GrTestTarget(). | 30 // until ~GrTestTarget(). |
30 tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glContextForTesting()); | 31 tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glInterfaceForTesting()); |
31 } | 32 } |
32 | 33 |
33 /////////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////////// |
34 | 35 |
35 void GrContext::purgeAllUnlockedResources() { | 36 void GrContext::purgeAllUnlockedResources() { |
36 fResourceCache->purgeAllUnlocked(); | 37 fResourceCache->purgeAllUnlocked(); |
37 } | 38 } |
38 | 39 |
39 void GrContext::dumpCacheStats(SkString* out) const { | 40 void GrContext::dumpCacheStats(SkString* out) const { |
40 #if GR_CACHE_STATS | 41 #if GR_CACHE_STATS |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 SkASSERT(NULL == fGpu); | 253 SkASSERT(NULL == fGpu); |
253 fGpu = SkNEW_ARGS(MockGpu, (this, options)); | 254 fGpu = SkNEW_ARGS(MockGpu, (this, options)); |
254 SkASSERT(fGpu); | 255 SkASSERT(fGpu); |
255 this->initCommon(); | 256 this->initCommon(); |
256 | 257 |
257 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 258 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
258 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 259 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
259 // resources in the buffer pools. | 260 // resources in the buffer pools. |
260 fDrawingMgr.abandon(); | 261 fDrawingMgr.abandon(); |
261 } | 262 } |
OLD | NEW |