OLD | NEW |
1 // Copyright (C) 2013 Google Inc. All rights reserved. | 1 // Copyright (C) 2013 Google Inc. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following disclaimer | 10 // copyright notice, this list of conditions and the following disclaimer |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 void StrokeData::setupPaintDashPathEffect(SkPaint* paint, int length) const { | 69 void StrokeData::setupPaintDashPathEffect(SkPaint* paint, int length) const { |
70 float width = m_thickness; | 70 float width = m_thickness; |
71 if (m_dash) { | 71 if (m_dash) { |
72 paint->setPathEffect(m_dash); | 72 paint->setPathEffect(m_dash); |
73 } else { | 73 } else { |
74 switch (m_style) { | 74 switch (m_style) { |
75 case NoStroke: | 75 case NoStroke: |
76 case SolidStroke: | 76 case SolidStroke: |
77 case DoubleStroke: | 77 case DoubleStroke: |
78 case WavyStroke: // FIXME: https://code.google.com/p/chromium/issues/deta
il?id=229574 | 78 case WavyStroke: // FIXME: https://crbug.com/229574 |
79 paint->setPathEffect(0); | 79 paint->setPathEffect(0); |
80 return; | 80 return; |
81 case DashedStroke: | 81 case DashedStroke: |
82 width = dashRatio * width; | 82 width = dashRatio * width; |
83 // Fall through. | 83 // Fall through. |
84 case DottedStroke: | 84 case DottedStroke: |
85 // Truncate the width, since we don't want fuzzy dots or dashes. | 85 // Truncate the width, since we don't want fuzzy dots or dashes. |
86 int dashLength = static_cast<int>(width); | 86 int dashLength = static_cast<int>(width); |
87 // Subtract off the endcaps, since they're rendered separately. | 87 // Subtract off the endcaps, since they're rendered separately. |
88 int distance = length - 2 * static_cast<int>(m_thickness); | 88 int distance = length - 2 * static_cast<int>(m_thickness); |
(...skipping 13 matching lines...) Expand all Loading... |
102 } | 102 } |
103 SkScalar dashLengthSk = SkIntToScalar(dashLength); | 103 SkScalar dashLengthSk = SkIntToScalar(dashLength); |
104 SkScalar intervals[2] = {dashLengthSk, dashLengthSk}; | 104 SkScalar intervals[2] = {dashLengthSk, dashLengthSk}; |
105 paint->setPathEffect( | 105 paint->setPathEffect( |
106 SkDashPathEffect::Make(intervals, 2, SkIntToScalar(phase))); | 106 SkDashPathEffect::Make(intervals, 2, SkIntToScalar(phase))); |
107 } | 107 } |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 } // namespace blink | 111 } // namespace blink |
OLD | NEW |