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" |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 return; | 990 return; |
991 } | 991 } |
992 } | 992 } |
993 | 993 |
994 SkPath path; | 994 SkPath path; |
995 path.setIsVolatile(true); | 995 path.setIsVolatile(true); |
996 path.addOval(oval); | 996 path.addOval(oval); |
997 this->internalDrawPath(clip, paint, viewMatrix, path, style); | 997 this->internalDrawPath(clip, paint, viewMatrix, path, style); |
998 } | 998 } |
999 | 999 |
| 1000 void GrDrawContext::drawArc(const GrClip& clip, |
| 1001 const GrPaint& paint, |
| 1002 const SkMatrix& viewMatrix, |
| 1003 const SkRect& oval, |
| 1004 SkScalar startAngle, |
| 1005 SkScalar sweepAngle, |
| 1006 bool useCenter, |
| 1007 const GrStyle& style) { |
| 1008 bool useHWAA; |
| 1009 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { |
| 1010 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); |
| 1011 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateArcBatch(paint.get
Color(), |
| 1012 viewMatri
x, |
| 1013 oval, |
| 1014 startAngl
e, |
| 1015 sweepAngl
e, |
| 1016 useCenter
, |
| 1017 style, |
| 1018 shaderCap
s)); |
| 1019 if (batch) { |
| 1020 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
| 1021 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
| 1022 return; |
| 1023 } |
| 1024 } |
| 1025 SkPath path; |
| 1026 path.setIsVolatile(true); |
| 1027 if (useCenter) { |
| 1028 path.moveTo(oval.centerX(), oval.centerY()); |
| 1029 } |
| 1030 path.arcTo(oval, startAngle, sweepAngle, !useCenter); |
| 1031 if (useCenter) { |
| 1032 path.close(); |
| 1033 } |
| 1034 this->internalDrawPath(clip, paint, viewMatrix, path, style); |
| 1035 return; |
| 1036 } |
| 1037 |
1000 void GrDrawContext::drawImageLattice(const GrClip& clip, | 1038 void GrDrawContext::drawImageLattice(const GrClip& clip, |
1001 const GrPaint& paint, | 1039 const GrPaint& paint, |
1002 const SkMatrix& viewMatrix, | 1040 const SkMatrix& viewMatrix, |
1003 int imageWidth, | 1041 int imageWidth, |
1004 int imageHeight, | 1042 int imageHeight, |
1005 std::unique_ptr<SkLatticeIter> iter, | 1043 std::unique_ptr<SkLatticeIter> iter, |
1006 const SkRect& dst) { | 1044 const SkRect& dst) { |
1007 ASSERT_SINGLE_OWNER | 1045 ASSERT_SINGLE_OWNER |
1008 RETURN_IF_ABANDONED | 1046 RETURN_IF_ABANDONED |
1009 SkDEBUGCODE(this->validate();) | 1047 SkDEBUGCODE(this->validate();) |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 | 1345 |
1308 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1346 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
1309 GrDrawBatch* batch) { | 1347 GrDrawBatch* batch) { |
1310 ASSERT_SINGLE_OWNER | 1348 ASSERT_SINGLE_OWNER |
1311 RETURN_IF_ABANDONED | 1349 RETURN_IF_ABANDONED |
1312 SkDEBUGCODE(this->validate();) | 1350 SkDEBUGCODE(this->validate();) |
1313 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1351 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1314 | 1352 |
1315 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1353 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1316 } | 1354 } |
OLD | NEW |