| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDashingEffect.h" | 8 #include "GrDashingEffect.h" |
| 9 | 9 |
| 10 #include "../GrAARectRenderer.h" | 10 #include "../GrAARectRenderer.h" |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 fColor = local.fColor; | 617 fColor = local.fColor; |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& processor, | 621 void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& processor, |
| 622 const GrBatchTracker& bt, | 622 const GrBatchTracker& bt, |
| 623 const GrGLCaps&, | 623 const GrGLCaps&, |
| 624 GrProcessorKeyBuilder* b) { | 624 GrProcessorKeyBuilder* b) { |
| 625 const DashingCircleBatchTracker& local = bt.cast<DashingCircleBatchTracker>(
); | 625 const DashingCircleBatchTracker& local = bt.cast<DashingCircleBatchTracker>(
); |
| 626 const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>(); | 626 const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>(); |
| 627 b->add32(local.fUsesLocalCoords && processor.localMatrix().hasPerspective())
; |
| 627 b->add32(dce.getEdgeType() << 16 | local.fInputColorType); | 628 b->add32(dce.getEdgeType() << 16 | local.fInputColorType); |
| 628 } | 629 } |
| 629 | 630 |
| 630 ////////////////////////////////////////////////////////////////////////////// | 631 ////////////////////////////////////////////////////////////////////////////// |
| 631 | 632 |
| 632 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, | 633 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, |
| 633 GrPrimitiveEdgeType edgeType, | 634 GrPrimitiveEdgeType edgeType, |
| 634 const DashInfo& info, | 635 const DashInfo& info, |
| 635 SkScalar radius) { | 636 SkScalar radius) { |
| 636 if (info.fCount != 2 || info.fIntervals[0] != 0) { | 637 if (info.fCount != 2 || info.fIntervals[0] != 0) { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 fColor = local.fColor; | 907 fColor = local.fColor; |
| 907 } | 908 } |
| 908 } | 909 } |
| 909 | 910 |
| 910 void GLDashingLineEffect::GenKey(const GrGeometryProcessor& processor, | 911 void GLDashingLineEffect::GenKey(const GrGeometryProcessor& processor, |
| 911 const GrBatchTracker& bt, | 912 const GrBatchTracker& bt, |
| 912 const GrGLCaps&, | 913 const GrGLCaps&, |
| 913 GrProcessorKeyBuilder* b) { | 914 GrProcessorKeyBuilder* b) { |
| 914 const DashingLineBatchTracker& local = bt.cast<DashingLineBatchTracker>(); | 915 const DashingLineBatchTracker& local = bt.cast<DashingLineBatchTracker>(); |
| 915 const DashingLineEffect& de = processor.cast<DashingLineEffect>(); | 916 const DashingLineEffect& de = processor.cast<DashingLineEffect>(); |
| 917 b->add32(local.fUsesLocalCoords && processor.localMatrix().hasPerspective())
; |
| 916 b->add32(de.getEdgeType() << 16 | local.fInputColorType); | 918 b->add32(de.getEdgeType() << 16 | local.fInputColorType); |
| 917 } | 919 } |
| 918 | 920 |
| 919 ////////////////////////////////////////////////////////////////////////////// | 921 ////////////////////////////////////////////////////////////////////////////// |
| 920 | 922 |
| 921 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, | 923 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, |
| 922 GrPrimitiveEdgeType edgeType, | 924 GrPrimitiveEdgeType edgeType, |
| 923 const DashInfo& info, | 925 const DashInfo& info, |
| 924 SkScalar strokeWidth) { | 926 SkScalar strokeWidth) { |
| 925 if (info.fCount != 2) { | 927 if (info.fCount != 2) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 switch (cap) { | 1017 switch (cap) { |
| 1016 case GrDashingEffect::kRound_DashCap: | 1018 case GrDashingEffect::kRound_DashCap: |
| 1017 return DashingCircleEffect::Create(color, edgeType, info, SkScalarHa
lf(strokeWidth)); | 1019 return DashingCircleEffect::Create(color, edgeType, info, SkScalarHa
lf(strokeWidth)); |
| 1018 case GrDashingEffect::kNonRound_DashCap: | 1020 case GrDashingEffect::kNonRound_DashCap: |
| 1019 return DashingLineEffect::Create(color, edgeType, info, strokeWidth)
; | 1021 return DashingLineEffect::Create(color, edgeType, info, strokeWidth)
; |
| 1020 default: | 1022 default: |
| 1021 SkFAIL("Unexpected dashed cap."); | 1023 SkFAIL("Unexpected dashed cap."); |
| 1022 } | 1024 } |
| 1023 return NULL; | 1025 return NULL; |
| 1024 } | 1026 } |
| OLD | NEW |