| 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 // These sizes were selected because they allow each atlas to hold a single
plot and will thus |
| 23 // stress the atlas |
| 24 int dim = GrBatchAtlas::kGlyphMaxDim; |
| 25 GrBatchAtlasConfig configs[3]; |
| 26 configs[kA8_GrMaskFormat].fWidth = dim; |
| 27 configs[kA8_GrMaskFormat].fHeight = dim; |
| 28 configs[kA8_GrMaskFormat].fPlotWidth = dim; |
| 29 configs[kA8_GrMaskFormat].fPlotHeight = dim; |
| 30 |
| 31 configs[kA565_GrMaskFormat].fWidth = dim; |
| 32 configs[kA565_GrMaskFormat].fHeight = dim; |
| 33 configs[kA565_GrMaskFormat].fPlotWidth = dim; |
| 34 configs[kA565_GrMaskFormat].fPlotHeight = dim; |
| 35 |
| 36 configs[kARGB_GrMaskFormat].fWidth = dim; |
| 37 configs[kARGB_GrMaskFormat].fHeight = dim; |
| 38 configs[kARGB_GrMaskFormat].fPlotWidth = dim; |
| 39 configs[kARGB_GrMaskFormat].fPlotHeight = dim; |
| 40 |
| 41 context->setTextContextAtlasSizes_ForTesting(configs); |
| 42 } |
| 43 }; |
| 44 |
| 19 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 45 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
| 20 SkASSERT(!fContext); | 46 SkASSERT(!fContext); |
| 21 | 47 |
| 22 fContext.reset(SkRef(ctx)); | 48 fContext.reset(SkRef(ctx)); |
| 23 fDrawTarget.reset(SkRef(target)); | 49 fDrawTarget.reset(SkRef(target)); |
| 24 } | 50 } |
| 25 | 51 |
| 26 void GrContext::getTestTarget(GrTestTarget* tar) { | 52 void GrContext::getTestTarget(GrTestTarget* tar) { |
| 27 this->flush(); | 53 this->flush(); |
| 28 // 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 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 SkASSERT(NULL == fGpu); | 293 SkASSERT(NULL == fGpu); |
| 268 fGpu = SkNEW_ARGS(MockGpu, (this, options)); | 294 fGpu = SkNEW_ARGS(MockGpu, (this, options)); |
| 269 SkASSERT(fGpu); | 295 SkASSERT(fGpu); |
| 270 this->initCommon(); | 296 this->initCommon(); |
| 271 | 297 |
| 272 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 298 // 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 | 299 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 274 // resources in the buffer pools. | 300 // resources in the buffer pools. |
| 275 fDrawingMgr.abandon(); | 301 fDrawingMgr.abandon(); |
| 276 } | 302 } |
| OLD | NEW |