| 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 "GrInOrderDrawBuffer.h" | 11 #include "GrInOrderDrawBuffer.h" |
| 12 #include "GrResourceCache2.h" | 12 #include "GrResourceCache.h" |
| 13 | 13 |
| 14 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 14 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
| 15 SkASSERT(!fContext); | 15 SkASSERT(!fContext); |
| 16 | 16 |
| 17 fContext.reset(SkRef(ctx)); | 17 fContext.reset(SkRef(ctx)); |
| 18 fDrawTarget.reset(SkRef(target)); | 18 fDrawTarget.reset(SkRef(target)); |
| 19 | 19 |
| 20 SkNEW_IN_TLAZY(&fASR, GrDrawTarget::AutoStateRestore, (target, GrDrawTarget:
:kReset_ASRInit)); | 20 SkNEW_IN_TLAZY(&fASR, GrDrawTarget::AutoStateRestore, (target, GrDrawTarget:
:kReset_ASRInit)); |
| 21 SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target)); | 21 SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target)); |
| 22 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); | 22 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void GrContext::getTestTarget(GrTestTarget* tar) { | 25 void GrContext::getTestTarget(GrTestTarget* tar) { |
| 26 this->flush(); | 26 this->flush(); |
| 27 // 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 |
| 28 // 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 |
| 29 // 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 |
| 30 // until ~GrTestTarget(). | 30 // until ~GrTestTarget(). |
| 31 tar->init(this, fDrawBuffer); | 31 tar->init(this, fDrawBuffer); |
| 32 } | 32 } |
| 33 | 33 |
| 34 /////////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////////// |
| 35 | 35 |
| 36 void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) { | 36 void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) { |
| 37 fMaxTextureSizeOverride = maxTextureSizeOverride; | 37 fMaxTextureSizeOverride = maxTextureSizeOverride; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void GrContext::purgeAllUnlockedResources() { | 40 void GrContext::purgeAllUnlockedResources() { |
| 41 fResourceCache2->purgeAllUnlocked(); | 41 fResourceCache->purgeAllUnlocked(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 /////////////////////////////////////////////////////////////////////////////// | 44 /////////////////////////////////////////////////////////////////////////////// |
| 45 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. | 45 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. |
| 46 //// | 46 //// |
| 47 | 47 |
| 48 #include "GrBufferAllocPool.h" | 48 #include "GrBufferAllocPool.h" |
| 49 #include "GrInOrderDrawBuffer.h" | 49 #include "GrInOrderDrawBuffer.h" |
| 50 #include "GrGpu.h" | 50 #include "GrGpu.h" |
| 51 | 51 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 181 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 182 // resources in the buffer pools. | 182 // resources in the buffer pools. |
| 183 SkDELETE(fDrawBuffer); | 183 SkDELETE(fDrawBuffer); |
| 184 SkDELETE(fDrawBufferVBAllocPool); | 184 SkDELETE(fDrawBufferVBAllocPool); |
| 185 SkDELETE(fDrawBufferIBAllocPool); | 185 SkDELETE(fDrawBufferIBAllocPool); |
| 186 | 186 |
| 187 fDrawBuffer = NULL; | 187 fDrawBuffer = NULL; |
| 188 fDrawBufferVBAllocPool = NULL; | 188 fDrawBufferVBAllocPool = NULL; |
| 189 fDrawBufferIBAllocPool = NULL; | 189 fDrawBufferIBAllocPool = NULL; |
| 190 } | 190 } |
| OLD | NEW |