Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: src/gpu/GrTest.cpp

Issue 1255943006: Allow setting of GrBatchFontCache atlas sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@debugatlas2
Patch Set: tweaks Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrFontAtlasSizes.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrBatchFontCache.h"
11 #include "GrBufferedDrawTarget.h" 12 #include "GrBufferedDrawTarget.h"
12 #include "GrContextOptions.h" 13 #include "GrContextOptions.h"
13 #include "GrGpuResourceCacheAccess.h" 14 #include "GrGpuResourceCacheAccess.h"
14 #include "GrResourceCache.h" 15 #include "GrResourceCache.h"
15 #include "GrTextBlobCache.h" 16 #include "GrTextBlobCache.h"
16 #include "SkString.h" 17 #include "SkString.h"
17 18
18 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { 19 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
19 SkASSERT(!fContext); 20 SkASSERT(!fContext);
20 21
21 fContext.reset(SkRef(ctx)); 22 fContext.reset(SkRef(ctx));
22 fDrawTarget.reset(SkRef(target)); 23 fDrawTarget.reset(SkRef(target));
23 } 24 }
24 25
25 void GrContext::getTestTarget(GrTestTarget* tar) { 26 void GrContext::getTestTarget(GrTestTarget* tar) {
26 this->flush(); 27 this->flush();
27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and 28 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and
28 // then disconnects. This would help prevent test writers from mixing using the returned 29 // then disconnects. This would help prevent test writers from mixing using the returned
29 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte xt drawing methods 30 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte xt drawing methods
30 // until ~GrTestTarget(). 31 // until ~GrTestTarget().
31 tar->init(this, fDrawingMgr.fDrawTarget); 32 tar->init(this, fDrawingMgr.fDrawTarget);
32 } 33 }
33 34
34 void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) { 35 void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {
35 fTextBlobCache->setBudget(bytes); 36 fTextBlobCache->setBudget(bytes);
36 } 37 }
37 38
39 void GrContext::setTextContextAtlasSizes_ForTesting(const GrBatchAtlasConfig* co nfigs) {
40 fBatchFontCache->setAtlasSizes_ForTesting(configs);
41 }
42
38 /////////////////////////////////////////////////////////////////////////////// 43 ///////////////////////////////////////////////////////////////////////////////
39 44
40 void GrContext::purgeAllUnlockedResources() { 45 void GrContext::purgeAllUnlockedResources() {
41 fResourceCache->purgeAllUnlocked(); 46 fResourceCache->purgeAllUnlocked();
42 } 47 }
43 48
44 void GrContext::dumpCacheStats(SkString* out) const { 49 void GrContext::dumpCacheStats(SkString* out) const {
45 #if GR_CACHE_STATS 50 #if GR_CACHE_STATS
46 fResourceCache->dumpStats(out); 51 fResourceCache->dumpStats(out);
47 #endif 52 #endif
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 SkASSERT(NULL == fGpu); 267 SkASSERT(NULL == fGpu);
263 fGpu = SkNEW_ARGS(MockGpu, (this, options)); 268 fGpu = SkNEW_ARGS(MockGpu, (this, options));
264 SkASSERT(fGpu); 269 SkASSERT(fGpu);
265 this->initCommon(); 270 this->initCommon();
266 271
267 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 272 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
268 // these objects are required for any of tests that use this context. TODO: make stop allocating 273 // these objects are required for any of tests that use this context. TODO: make stop allocating
269 // resources in the buffer pools. 274 // resources in the buffer pools.
270 fDrawingMgr.abandon(); 275 fDrawingMgr.abandon();
271 } 276 }
OLDNEW
« no previous file with comments | « src/gpu/GrFontAtlasSizes.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698