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 "GrBatchAtlas.h" | |
11 #include "GrBatchFontCache.h" | 12 #include "GrBatchFontCache.h" |
12 #include "GrBufferedDrawTarget.h" | 13 #include "GrBufferedDrawTarget.h" |
13 #include "GrContextOptions.h" | 14 #include "GrContextOptions.h" |
14 #include "GrGpuResourceCacheAccess.h" | 15 #include "GrGpuResourceCacheAccess.h" |
15 #include "GrResourceCache.h" | 16 #include "GrResourceCache.h" |
16 #include "GrTextBlobCache.h" | 17 #include "GrTextBlobCache.h" |
17 #include "SkString.h" | 18 #include "SkString.h" |
18 | 19 |
20 namespace GrTest { | |
21 void SetupAlwaysEvictAtlas(GrContext* context) { | |
22 GrBatchAtlasConfig configs[3]; | |
23 configs[kA8_GrMaskFormat].fWidth = 256; | |
bsalomon
2015/08/19 19:54:17
comments about why these numbers?
| |
24 configs[kA8_GrMaskFormat].fHeight = 256; | |
25 configs[kA8_GrMaskFormat].fPlotWidth = 256; | |
26 configs[kA8_GrMaskFormat].fPlotHeight = 256; | |
27 | |
28 configs[kA565_GrMaskFormat].fWidth = 256; | |
29 configs[kA565_GrMaskFormat].fHeight = 256; | |
30 configs[kA565_GrMaskFormat].fPlotWidth = 256; | |
31 configs[kA565_GrMaskFormat].fPlotHeight = 256; | |
32 | |
33 configs[kARGB_GrMaskFormat].fWidth = 256; | |
34 configs[kARGB_GrMaskFormat].fHeight = 256; | |
35 configs[kARGB_GrMaskFormat].fPlotWidth = 256; | |
36 configs[kARGB_GrMaskFormat].fPlotHeight = 256; | |
37 | |
38 context->setTextContextAtlasSizes_ForTesting(configs); | |
39 } | |
40 }; | |
41 | |
19 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 42 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
20 SkASSERT(!fContext); | 43 SkASSERT(!fContext); |
21 | 44 |
22 fContext.reset(SkRef(ctx)); | 45 fContext.reset(SkRef(ctx)); |
23 fDrawTarget.reset(SkRef(target)); | 46 fDrawTarget.reset(SkRef(target)); |
24 } | 47 } |
25 | 48 |
26 void GrContext::getTestTarget(GrTestTarget* tar) { | 49 void GrContext::getTestTarget(GrTestTarget* tar) { |
27 this->flush(); | 50 this->flush(); |
28 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and | 51 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 SkASSERT(NULL == fGpu); | 290 SkASSERT(NULL == fGpu); |
268 fGpu = SkNEW_ARGS(MockGpu, (this, options)); | 291 fGpu = SkNEW_ARGS(MockGpu, (this, options)); |
269 SkASSERT(fGpu); | 292 SkASSERT(fGpu); |
270 this->initCommon(); | 293 this->initCommon(); |
271 | 294 |
272 // We delete these because we want to test the cache starting with zero reso urces. Also, none of | 295 // We delete these because we want to test the cache starting with zero reso urces. Also, none of |
273 // these objects are required for any of tests that use this context. TODO: make stop allocating | 296 // these objects are required for any of tests that use this context. TODO: make stop allocating |
274 // resources in the buffer pools. | 297 // resources in the buffer pools. |
275 fDrawingMgr.abandon(); | 298 fDrawingMgr.abandon(); |
276 } | 299 } |
OLD | NEW |