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 "GrGpuResourceCacheAccess.h" | 11 #include "GrGpuResourceCacheAccess.h" |
12 #include "GrInOrderDrawBuffer.h" | 12 #include "GrInOrderDrawBuffer.h" |
13 #include "GrResourceCache.h" | 13 #include "GrResourceCache.h" |
14 #include "SkString.h" | 14 #include "SkString.h" |
15 | 15 |
16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
17 SkASSERT(!fContext); | 17 SkASSERT(!fContext); |
18 | 18 |
19 fContext.reset(SkRef(ctx)); | 19 fContext.reset(SkRef(ctx)); |
20 fDrawTarget.reset(SkRef(target)); | 20 fDrawTarget.reset(SkRef(target)); |
21 | 21 |
22 SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target)); | |
23 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); | 22 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); |
24 } | 23 } |
25 | 24 |
26 void GrContext::getTestTarget(GrTestTarget* tar) { | 25 void GrContext::getTestTarget(GrTestTarget* tar) { |
27 this->flush(); | 26 this->flush(); |
28 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and | 27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and |
29 // then disconnects. This would help prevent test writers from mixing using
the returned | 28 // then disconnects. This would help prevent test writers from mixing using
the returned |
30 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods | 29 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods |
31 // until ~GrTestTarget(). | 30 // until ~GrTestTarget(). |
32 tar->init(this, fDrawBuffer); | 31 tar->init(this, fDrawBuffer); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 266 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
268 // resources in the buffer pools. | 267 // resources in the buffer pools. |
269 SkDELETE(fDrawBuffer); | 268 SkDELETE(fDrawBuffer); |
270 SkDELETE(fDrawBufferVBAllocPool); | 269 SkDELETE(fDrawBufferVBAllocPool); |
271 SkDELETE(fDrawBufferIBAllocPool); | 270 SkDELETE(fDrawBufferIBAllocPool); |
272 | 271 |
273 fDrawBuffer = NULL; | 272 fDrawBuffer = NULL; |
274 fDrawBufferVBAllocPool = NULL; | 273 fDrawBufferVBAllocPool = NULL; |
275 fDrawBufferIBAllocPool = NULL; | 274 fDrawBufferIBAllocPool = NULL; |
276 } | 275 } |
OLD | NEW |