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" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 /////////////////////////////////////////////////////////////////////////////// | 227 /////////////////////////////////////////////////////////////////////////////// |
228 | 228 |
229 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } | 229 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } |
230 | 230 |
231 /////////////////////////////////////////////////////////////////////////////// | 231 /////////////////////////////////////////////////////////////////////////////// |
232 | 232 |
233 #define ASSERT_SINGLE_OWNER \ | 233 #define ASSERT_SINGLE_OWNER \ |
234 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) | 234 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) |
235 #define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->wasAbandon
ed()) { return; } | 235 #define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->wasAbandon
ed()) { return; } |
236 | 236 |
237 void GrDrawContextPriv::testingOnly_drawBatch(const GrPipelineBuilder& pipelineB
uilder, | 237 void GrDrawContextPriv::testingOnly_drawBatch(const GrPaint& paint, |
238 GrDrawBatch* batch, | 238 GrDrawBatch* batch, |
239 const GrClip* clip) { | 239 const GrUserStencilSettings* uss, |
| 240 bool snapToCenters) { |
240 ASSERT_SINGLE_OWNER | 241 ASSERT_SINGLE_OWNER |
241 RETURN_IF_ABANDONED | 242 RETURN_IF_ABANDONED |
242 SkDEBUGCODE(fDrawContext->validate();) | 243 SkDEBUGCODE(fDrawContext->validate();) |
243 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testing
Only_drawBatch"); | 244 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testing
Only_drawBatch"); |
244 | 245 |
245 if (clip) { | 246 GrPipelineBuilder pipelineBuilder(paint, fDrawContext->mustUseHWAA(paint)); |
246 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext,
*clip, batch); | 247 if (uss) { |
247 } else { | 248 pipelineBuilder.setUserStencil(uss); |
248 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext,
GrNoClip(), batch); | |
249 } | 249 } |
| 250 if (snapToCenters) { |
| 251 pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_
Flag, true); |
| 252 } |
| 253 |
| 254 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, GrNo
Clip(), batch); |
250 } | 255 } |
251 | 256 |
252 #undef ASSERT_SINGLE_OWNER | 257 #undef ASSERT_SINGLE_OWNER |
253 #undef RETURN_IF_ABANDONED | 258 #undef RETURN_IF_ABANDONED |
254 | 259 |
255 /////////////////////////////////////////////////////////////////////////////// | 260 /////////////////////////////////////////////////////////////////////////////// |
256 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. | 261 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. |
257 //// | 262 //// |
258 | 263 |
259 #include "GrGpu.h" | 264 #include "GrGpu.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 SkASSERT(nullptr == fGpu); | 398 SkASSERT(nullptr == fGpu); |
394 fGpu = new MockGpu(this, options); | 399 fGpu = new MockGpu(this, options); |
395 SkASSERT(fGpu); | 400 SkASSERT(fGpu); |
396 this->initCommon(options); | 401 this->initCommon(options); |
397 | 402 |
398 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 403 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
399 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 404 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
400 // resources in the buffer pools. | 405 // resources in the buffer pools. |
401 fDrawingManager->abandon(); | 406 fDrawingManager->abandon(); |
402 } | 407 } |
OLD | NEW |