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 |
| 11 #include "GrBufferedDrawTarget.h" |
10 #include "GrContextOptions.h" | 12 #include "GrContextOptions.h" |
11 #include "GrGpuResourceCacheAccess.h" | 13 #include "GrGpuResourceCacheAccess.h" |
12 #include "GrInOrderDrawBuffer.h" | |
13 #include "GrResourceCache.h" | 14 #include "GrResourceCache.h" |
14 #include "SkString.h" | 15 #include "SkString.h" |
15 | 16 |
16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 17 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
17 SkASSERT(!fContext); | 18 SkASSERT(!fContext); |
18 | 19 |
19 fContext.reset(SkRef(ctx)); | 20 fContext.reset(SkRef(ctx)); |
20 fDrawTarget.reset(SkRef(target)); | 21 fDrawTarget.reset(SkRef(target)); |
21 } | 22 } |
22 | 23 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 #endif | 129 #endif |
129 | 130 |
130 /////////////////////////////////////////////////////////////////////////////// | 131 /////////////////////////////////////////////////////////////////////////////// |
131 | 132 |
132 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } | 133 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } |
133 | 134 |
134 /////////////////////////////////////////////////////////////////////////////// | 135 /////////////////////////////////////////////////////////////////////////////// |
135 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. | 136 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. |
136 //// | 137 //// |
137 | 138 |
138 #include "GrInOrderDrawBuffer.h" | |
139 #include "GrGpu.h" | 139 #include "GrGpu.h" |
140 | 140 |
141 class GrPipeline; | 141 class GrPipeline; |
142 | 142 |
143 class MockGpu : public GrGpu { | 143 class MockGpu : public GrGpu { |
144 public: | 144 public: |
145 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con
text) { | 145 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con
text) { |
146 fCaps.reset(SkNEW_ARGS(GrCaps, (options))); | 146 fCaps.reset(SkNEW_ARGS(GrCaps, (options))); |
147 } | 147 } |
148 ~MockGpu() override {} | 148 ~MockGpu() override {} |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 SkASSERT(NULL == fGpu); | 257 SkASSERT(NULL == fGpu); |
258 fGpu = SkNEW_ARGS(MockGpu, (this, options)); | 258 fGpu = SkNEW_ARGS(MockGpu, (this, options)); |
259 SkASSERT(fGpu); | 259 SkASSERT(fGpu); |
260 this->initCommon(); | 260 this->initCommon(); |
261 | 261 |
262 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 262 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
263 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 263 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
264 // resources in the buffer pools. | 264 // resources in the buffer pools. |
265 fDrawingMgr.abandon(); | 265 fDrawingMgr.abandon(); |
266 } | 266 } |
OLD | NEW |