OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrBatchTest.h" | 8 #include "GrBatchTest.h" |
9 #include "GrColor.h" | 9 #include "GrColor.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
11 #include "GrDrawContextPriv.h" | 11 #include "GrDrawContextPriv.h" |
12 #include "GrDrawingManager.h" | 12 #include "GrDrawingManager.h" |
13 #include "GrGpuResourcePriv.h" | 13 #include "GrGpuResourcePriv.h" |
14 #include "GrOvalRenderer.h" | 14 #include "GrOvalRenderer.h" |
15 #include "GrPathRenderer.h" | 15 #include "GrPathRenderer.h" |
16 #include "GrPipelineBuilder.h" | 16 #include "GrPipelineBuilder.h" |
17 #include "GrRectRenderer.h" | |
17 #include "GrRenderTarget.h" | 18 #include "GrRenderTarget.h" |
18 #include "GrRenderTargetPriv.h" | 19 #include "GrRenderTargetPriv.h" |
19 #include "GrResourceProvider.h" | 20 #include "GrResourceProvider.h" |
20 #include "SkSurfacePriv.h" | 21 #include "SkSurfacePriv.h" |
21 | 22 |
22 #include "batches/GrBatch.h" | 23 #include "batches/GrBatch.h" |
23 #include "batches/GrClearBatch.h" | 24 #include "batches/GrClearBatch.h" |
24 #include "batches/GrDrawAtlasBatch.h" | 25 #include "batches/GrDrawAtlasBatch.h" |
25 #include "batches/GrDrawVerticesBatch.h" | 26 #include "batches/GrDrawVerticesBatch.h" |
26 #include "batches/GrRectBatchFactory.h" | 27 #include "batches/GrRectBatchFactory.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 return true; | 384 return true; |
384 } | 385 } |
385 } | 386 } |
386 | 387 |
387 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { | 388 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { |
388 // The fill path can handle rotation but not skew. | 389 // The fill path can handle rotation but not skew. |
389 if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) { | 390 if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) { |
390 SkRect devBoundRect; | 391 SkRect devBoundRect; |
391 viewMatrix.mapRect(&devBoundRect, croppedRect); | 392 viewMatrix.mapRect(&devBoundRect, croppedRect); |
392 | 393 |
393 batch.reset(GrRectBatchFactory::CreateAAFill(paint.getColor(), viewM atrix, | 394 if (!paint.usesDistanceVectorField()) { |
394 croppedRect, devBoundRe ct)); | 395 batch.reset(GrRectBatchFactory::CreateAAFill(paint.getColor(), v iewMatrix, |
396 croppedRect, devBou ndRect)); | |
397 } else { | |
398 batch.reset(GrRectRenderer::CreateAnalyticRectBatch(paint.getCol or(), viewMatrix, | |
egdaniel
2016/08/12 17:37:06
Why not put the decision on which batch to draw in
dvonbeck
2016/08/12 18:29:48
Done.
| |
399 rect, croppe dRect, | |
400 devBoundRect )); | |
401 } | |
402 | |
395 if (batch) { | 403 if (batch) { |
396 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 404 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
397 if (ss) { | 405 if (ss) { |
398 pipelineBuilder.setUserStencil(ss); | 406 pipelineBuilder.setUserStencil(ss); |
399 } | 407 } |
400 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, ba tch); | 408 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, ba tch); |
401 return true; | 409 return true; |
402 } | 410 } |
403 } | 411 } |
404 } else { | 412 } else { |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1303 | 1311 |
1304 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, | 1312 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, |
1305 GrDrawBatch* batch) { | 1313 GrDrawBatch* batch) { |
1306 ASSERT_SINGLE_OWNER | 1314 ASSERT_SINGLE_OWNER |
1307 RETURN_IF_ABANDONED | 1315 RETURN_IF_ABANDONED |
1308 SkDEBUGCODE(this->validate();) | 1316 SkDEBUGCODE(this->validate();) |
1309 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1317 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1310 | 1318 |
1311 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1319 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1312 } | 1320 } |
OLD | NEW |