OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTest.h" | 8 #include "GrTest.h" |
9 | 9 |
10 #include "GrBatchAtlas.h" | 10 #include "GrBatchAtlas.h" |
11 #include "GrContextOptions.h" | 11 #include "GrContextOptions.h" |
12 #include "GrDrawContext.h" | 12 #include "GrDrawContextPriv.h" |
13 #include "GrDrawingManager.h" | 13 #include "GrDrawingManager.h" |
14 #include "GrGpuResourceCacheAccess.h" | 14 #include "GrGpuResourceCacheAccess.h" |
15 #include "GrResourceCache.h" | 15 #include "GrResourceCache.h" |
16 | 16 |
17 #include "SkGpuDevice.h" | 17 #include "SkGpuDevice.h" |
18 #include "SkGrPriv.h" | 18 #include "SkGrPriv.h" |
19 #include "SkString.h" | 19 #include "SkString.h" |
20 | 20 |
21 #include "text/GrBatchFontCache.h" | 21 #include "text/GrBatchFontCache.h" |
22 #include "text/GrTextBlobCache.h" | 22 #include "text/GrTextBlobCache.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 #endif | 252 #endif |
253 | 253 |
254 /////////////////////////////////////////////////////////////////////////////// | 254 /////////////////////////////////////////////////////////////////////////////// |
255 | 255 |
256 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } | 256 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } |
257 | 257 |
258 /////////////////////////////////////////////////////////////////////////////// | 258 /////////////////////////////////////////////////////////////////////////////// |
259 | 259 |
260 #define ASSERT_SINGLE_OWNER \ | 260 #define ASSERT_SINGLE_OWNER \ |
261 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) | 261 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) |
262 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } | 262 #define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->abandoned(
)) { return; } |
263 | 263 |
264 void GrDrawContext::internal_drawBatch(const GrPipelineBuilder& pipelineBuilder, | 264 void GrDrawContextPriv::testingOnly_drawBatch(const GrPipelineBuilder& pipelineB
uilder, |
265 GrDrawBatch* batch) { | 265 GrDrawBatch* batch) { |
266 ASSERT_SINGLE_OWNER | 266 ASSERT_SINGLE_OWNER |
267 RETURN_IF_ABANDONED | 267 RETURN_IF_ABANDONED |
268 SkDEBUGCODE(this->validate();) | 268 SkDEBUGCODE(fDrawContext->validate();) |
269 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::internal_drawBatch"); | 269 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testing
Only_drawBatch"); |
270 | 270 |
271 this->getDrawTarget()->drawBatch(pipelineBuilder, batch); | 271 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, batch); |
272 } | 272 } |
273 | 273 |
274 #undef ASSERT_SINGLE_OWNER | 274 #undef ASSERT_SINGLE_OWNER |
275 #undef RETURN_IF_ABANDONED | 275 #undef RETURN_IF_ABANDONED |
276 | 276 |
277 /////////////////////////////////////////////////////////////////////////////// | 277 /////////////////////////////////////////////////////////////////////////////// |
278 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. | 278 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. |
279 //// | 279 //// |
280 | 280 |
281 #include "GrGpu.h" | 281 #include "GrGpu.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 SkASSERT(nullptr == fGpu); | 416 SkASSERT(nullptr == fGpu); |
417 fGpu = new MockGpu(this, options); | 417 fGpu = new MockGpu(this, options); |
418 SkASSERT(fGpu); | 418 SkASSERT(fGpu); |
419 this->initCommon(options); | 419 this->initCommon(options); |
420 | 420 |
421 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 421 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
422 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 422 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
423 // resources in the buffer pools. | 423 // resources in the buffer pools. |
424 fDrawingManager->abandon(); | 424 fDrawingManager->abandon(); |
425 } | 425 } |
OLD | NEW |