| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrTest.h" | 8 #include "GrTest.h" |
| 9 | 9 |
| 10 #include "GrBatchAtlas.h" | 10 #include "GrBatchAtlas.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "text/GrTextBlobCache.h" | 22 #include "text/GrTextBlobCache.h" |
| 23 | 23 |
| 24 namespace GrTest { | 24 namespace GrTest { |
| 25 void SetupAlwaysEvictAtlas(GrContext* context) { | 25 void SetupAlwaysEvictAtlas(GrContext* context) { |
| 26 // These sizes were selected because they allow each atlas to hold a single
plot and will thus | 26 // These sizes were selected because they allow each atlas to hold a single
plot and will thus |
| 27 // stress the atlas | 27 // stress the atlas |
| 28 int dim = GrBatchAtlas::kGlyphMaxDim; | 28 int dim = GrBatchAtlas::kGlyphMaxDim; |
| 29 GrBatchAtlasConfig configs[3]; | 29 GrBatchAtlasConfig configs[3]; |
| 30 configs[kA8_GrMaskFormat].fWidth = dim; | 30 configs[kA8_GrMaskFormat].fWidth = dim; |
| 31 configs[kA8_GrMaskFormat].fHeight = dim; | 31 configs[kA8_GrMaskFormat].fHeight = dim; |
| 32 configs[kA8_GrMaskFormat].fLog2Width = SkNextLog2(dim); |
| 33 configs[kA8_GrMaskFormat].fLog2Height = SkNextLog2(dim); |
| 32 configs[kA8_GrMaskFormat].fPlotWidth = dim; | 34 configs[kA8_GrMaskFormat].fPlotWidth = dim; |
| 33 configs[kA8_GrMaskFormat].fPlotHeight = dim; | 35 configs[kA8_GrMaskFormat].fPlotHeight = dim; |
| 34 | 36 |
| 35 configs[kA565_GrMaskFormat].fWidth = dim; | 37 configs[kA565_GrMaskFormat].fWidth = dim; |
| 36 configs[kA565_GrMaskFormat].fHeight = dim; | 38 configs[kA565_GrMaskFormat].fHeight = dim; |
| 39 configs[kA565_GrMaskFormat].fLog2Width = SkNextLog2(dim); |
| 40 configs[kA565_GrMaskFormat].fLog2Height = SkNextLog2(dim); |
| 37 configs[kA565_GrMaskFormat].fPlotWidth = dim; | 41 configs[kA565_GrMaskFormat].fPlotWidth = dim; |
| 38 configs[kA565_GrMaskFormat].fPlotHeight = dim; | 42 configs[kA565_GrMaskFormat].fPlotHeight = dim; |
| 39 | 43 |
| 40 configs[kARGB_GrMaskFormat].fWidth = dim; | 44 configs[kARGB_GrMaskFormat].fWidth = dim; |
| 41 configs[kARGB_GrMaskFormat].fHeight = dim; | 45 configs[kARGB_GrMaskFormat].fHeight = dim; |
| 46 configs[kARGB_GrMaskFormat].fLog2Width = SkNextLog2(dim); |
| 47 configs[kARGB_GrMaskFormat].fLog2Height = SkNextLog2(dim); |
| 42 configs[kARGB_GrMaskFormat].fPlotWidth = dim; | 48 configs[kARGB_GrMaskFormat].fPlotWidth = dim; |
| 43 configs[kARGB_GrMaskFormat].fPlotHeight = dim; | 49 configs[kARGB_GrMaskFormat].fPlotHeight = dim; |
| 44 | 50 |
| 45 context->setTextContextAtlasSizes_ForTesting(configs); | 51 context->setTextContextAtlasSizes_ForTesting(configs); |
| 46 } | 52 } |
| 47 }; | 53 }; |
| 48 | 54 |
| 49 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, GrRenderTarget* rt
) { | 55 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, GrRenderTarget* rt
) { |
| 50 SkASSERT(!fContext); | 56 SkASSERT(!fContext); |
| 51 | 57 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 SkASSERT(nullptr == fGpu); | 412 SkASSERT(nullptr == fGpu); |
| 407 fGpu = new MockGpu(this, options); | 413 fGpu = new MockGpu(this, options); |
| 408 SkASSERT(fGpu); | 414 SkASSERT(fGpu); |
| 409 this->initCommon(options); | 415 this->initCommon(options); |
| 410 | 416 |
| 411 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 417 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
| 412 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 418 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 413 // resources in the buffer pools. | 419 // resources in the buffer pools. |
| 414 fDrawingManager->abandon(); | 420 fDrawingManager->abandon(); |
| 415 } | 421 } |
| OLD | NEW |