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 "GrBatchAtlas.h" |
12 #include "GrBatchFontCache.h" | 12 #include "GrBatchFontCache.h" |
13 #include "GrContextOptions.h" | 13 #include "GrContextOptions.h" |
| 14 #include "GrDrawingManager.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 |
19 namespace GrTest { | 20 namespace GrTest { |
20 void SetupAlwaysEvictAtlas(GrContext* context) { | 21 void SetupAlwaysEvictAtlas(GrContext* context) { |
21 // These sizes were selected because they allow each atlas to hold a single
plot and will thus | 22 // These sizes were selected because they allow each atlas to hold a single
plot and will thus |
22 // stress the atlas | 23 // stress the atlas |
23 int dim = GrBatchAtlas::kGlyphMaxDim; | 24 int dim = GrBatchAtlas::kGlyphMaxDim; |
(...skipping 23 matching lines...) Expand all Loading... |
47 fContext.reset(SkRef(ctx)); | 48 fContext.reset(SkRef(ctx)); |
48 fDrawTarget.reset(SkRef(target)); | 49 fDrawTarget.reset(SkRef(target)); |
49 } | 50 } |
50 | 51 |
51 void GrContext::getTestTarget(GrTestTarget* tar) { | 52 void GrContext::getTestTarget(GrTestTarget* tar) { |
52 this->flush(); | 53 this->flush(); |
53 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and | 54 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and |
54 // then disconnects. This would help prevent test writers from mixing using
the returned | 55 // then disconnects. This would help prevent test writers from mixing using
the returned |
55 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods | 56 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods |
56 // until ~GrTestTarget(). | 57 // until ~GrTestTarget(). |
57 SkAutoTUnref<GrDrawTarget> dt(fDrawingMgr.newDrawTarget(nullptr)); | 58 SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(nullptr)); |
58 tar->init(this, dt); | 59 tar->init(this, dt); |
59 } | 60 } |
60 | 61 |
61 void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) { | 62 void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) { |
62 fTextBlobCache->setBudget(bytes); | 63 fTextBlobCache->setBudget(bytes); |
63 } | 64 } |
64 | 65 |
65 void GrContext::setTextContextAtlasSizes_ForTesting(const GrBatchAtlasConfig* co
nfigs) { | 66 void GrContext::setTextContextAtlasSizes_ForTesting(const GrBatchAtlasConfig* co
nfigs) { |
66 fBatchFontCache->setAtlasSizes_ForTesting(configs); | 67 fBatchFontCache->setAtlasSizes_ForTesting(configs); |
67 } | 68 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 GrContextOptions options; | 286 GrContextOptions options; |
286 options.fGeometryBufferMapThreshold = 0; | 287 options.fGeometryBufferMapThreshold = 0; |
287 SkASSERT(nullptr == fGpu); | 288 SkASSERT(nullptr == fGpu); |
288 fGpu = new MockGpu(this, options); | 289 fGpu = new MockGpu(this, options); |
289 SkASSERT(fGpu); | 290 SkASSERT(fGpu); |
290 this->initCommon(); | 291 this->initCommon(); |
291 | 292 |
292 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 293 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
293 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 294 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
294 // resources in the buffer pools. | 295 // resources in the buffer pools. |
295 fDrawingMgr.abandon(); | 296 fDrawingManager->abandon(); |
296 } | 297 } |
OLD | NEW |