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

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

Issue 1207393002: Return GrGLContext from GrTestTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 6 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/GrTest.h ('k') | src/gpu/gl/GrGLContext.h » ('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 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
11 #include "GrGpuResourceCacheAccess.h" 11 #include "GrGpuResourceCacheAccess.h"
12 #include "GrInOrderDrawBuffer.h" 12 #include "GrInOrderDrawBuffer.h"
13 #include "GrResourceCache.h" 13 #include "GrResourceCache.h"
14 #include "gl/GrGLInterface.h"
15 #include "SkString.h" 14 #include "SkString.h"
16 15
17 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLInterfac e* gl) { 16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLContext* gl) {
18 SkASSERT(!fContext); 17 SkASSERT(!fContext);
19 18
20 fContext.reset(SkRef(ctx)); 19 fContext.reset(SkRef(ctx));
21 fDrawTarget.reset(SkRef(target)); 20 fDrawTarget.reset(SkRef(target));
22 fGLInterface.reset(SkSafeRef(gl)); 21 fGLContext.reset(SkRef(gl));
23 } 22 }
24 23
25 void GrContext::getTestTarget(GrTestTarget* tar) { 24 void GrContext::getTestTarget(GrTestTarget* tar) {
26 this->flush(); 25 this->flush();
27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and 26 // 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 27 // 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 28 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte xt drawing methods
30 // until ~GrTestTarget(). 29 // until ~GrTestTarget().
31 tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glInterfaceForTesting()); 30 tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glContextForTesting());
32 } 31 }
33 32
34 /////////////////////////////////////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////////////
35 34
36 void GrContext::purgeAllUnlockedResources() { 35 void GrContext::purgeAllUnlockedResources() {
37 fResourceCache->purgeAllUnlocked(); 36 fResourceCache->purgeAllUnlocked();
38 } 37 }
39 38
40 void GrContext::dumpCacheStats(SkString* out) const { 39 void GrContext::dumpCacheStats(SkString* out) const {
41 #if GR_CACHE_STATS 40 #if GR_CACHE_STATS
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 SkASSERT(NULL == fGpu); 252 SkASSERT(NULL == fGpu);
254 fGpu = SkNEW_ARGS(MockGpu, (this, options)); 253 fGpu = SkNEW_ARGS(MockGpu, (this, options));
255 SkASSERT(fGpu); 254 SkASSERT(fGpu);
256 this->initCommon(); 255 this->initCommon();
257 256
258 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 257 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
259 // these objects are required for any of tests that use this context. TODO: make stop allocating 258 // these objects are required for any of tests that use this context. TODO: make stop allocating
260 // resources in the buffer pools. 259 // resources in the buffer pools.
261 fDrawingMgr.abandon(); 260 fDrawingMgr.abandon();
262 } 261 }
OLDNEW
« no previous file with comments | « src/gpu/GrTest.h ('k') | src/gpu/gl/GrGLContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698