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 | |
22 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); | |
23 } | 21 } |
24 | 22 |
25 void GrContext::getTestTarget(GrTestTarget* tar) { | 23 void GrContext::getTestTarget(GrTestTarget* tar) { |
26 this->flush(); | 24 this->flush(); |
27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and | 25 // 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 | 26 // 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 | 27 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods |
30 // until ~GrTestTarget(). | 28 // until ~GrTestTarget(). |
31 tar->init(this, fDrawBuffer); | 29 tar->init(this, fDrawBuffer); |
32 } | 30 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 264 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
267 // resources in the buffer pools. | 265 // resources in the buffer pools. |
268 SkDELETE(fDrawBuffer); | 266 SkDELETE(fDrawBuffer); |
269 SkDELETE(fDrawBufferVBAllocPool); | 267 SkDELETE(fDrawBufferVBAllocPool); |
270 SkDELETE(fDrawBufferIBAllocPool); | 268 SkDELETE(fDrawBufferIBAllocPool); |
271 | 269 |
272 fDrawBuffer = NULL; | 270 fDrawBuffer = NULL; |
273 fDrawBufferVBAllocPool = NULL; | 271 fDrawBufferVBAllocPool = NULL; |
274 fDrawBufferIBAllocPool = NULL; | 272 fDrawBufferIBAllocPool = NULL; |
275 } | 273 } |
OLD | NEW |