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 | 10 |
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 "SkString.h" | 14 #include "SkString.h" |
15 | 15 |
16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
17 SkASSERT(!fContext); | 17 SkASSERT(!fContext); |
18 | 18 |
19 fContext.reset(SkRef(ctx)); | 19 fContext.reset(SkRef(ctx)); |
20 fDrawTarget.reset(SkRef(target)); | 20 fDrawTarget.reset(SkRef(target)); |
21 } | 21 } |
22 | 22 |
23 void GrContext::getTestTarget(GrTestTarget* tar) { | 23 void GrContext::getTestTarget(GrTestTarget* tar) { |
24 this->flush(); | 24 this->flush(); |
25 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and | 25 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and |
26 // then disconnects. This would help prevent test writers from mixing using
the returned | 26 // then disconnects. This would help prevent test writers from mixing using
the returned |
27 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods | 27 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods |
28 // until ~GrTestTarget(). | 28 // until ~GrTestTarget(). |
29 tar->init(this, fDrawBuffer); | 29 tar->init(this, fDrawingMgr.fDrawTarget); |
30 } | 30 } |
31 | 31 |
32 /////////////////////////////////////////////////////////////////////////////// | 32 /////////////////////////////////////////////////////////////////////////////// |
33 | 33 |
34 void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) { | 34 void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) { |
35 fMaxTextureSizeOverride = maxTextureSizeOverride; | 35 fMaxTextureSizeOverride = maxTextureSizeOverride; |
36 } | 36 } |
37 | 37 |
38 void GrContext::purgeAllUnlockedResources() { | 38 void GrContext::purgeAllUnlockedResources() { |
39 fResourceCache->purgeAllUnlocked(); | 39 fResourceCache->purgeAllUnlocked(); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 void GrContext::initMockContext() { | 258 void GrContext::initMockContext() { |
259 SkASSERT(NULL == fGpu); | 259 SkASSERT(NULL == fGpu); |
260 fGpu = SkNEW_ARGS(MockGpu, (this)); | 260 fGpu = SkNEW_ARGS(MockGpu, (this)); |
261 SkASSERT(fGpu); | 261 SkASSERT(fGpu); |
262 this->initCommon(); | 262 this->initCommon(); |
263 | 263 |
264 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 264 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
265 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 265 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
266 // resources in the buffer pools. | 266 // resources in the buffer pools. |
267 SkDELETE(fDrawBuffer); | 267 fDrawingMgr.abandon(); |
268 fDrawBuffer = NULL; | |
269 | |
270 } | 268 } |
OLD | NEW |