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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // If a non-zero length is provided, the number of dashes/dots on a | 75 // If a non-zero length is provided, the number of dashes/dots on a |
76 // dashed/dotted line will be adjusted to start and end that length with a | 76 // dashed/dotted line will be adjusted to start and end that length with a |
77 // dash/dot. | 77 // dash/dot. |
78 void setupPaint(PaintFlags*, int length = 0) const; | 78 void setupPaint(PaintFlags*, int length = 0) const; |
79 | 79 |
80 // Setup any DashPathEffect on the paint. If a non-zero length is provided, | 80 // Setup any DashPathEffect on the paint. If a non-zero length is provided, |
81 // and no line dash has been set, the number of dashes/dots on a dashed/dotted | 81 // and no line dash has been set, the number of dashes/dots on a dashed/dotted |
82 // line will be adjusted to start and end that length with a dash/dot. | 82 // line will be adjusted to start and end that length with a dash/dot. |
83 void setupPaintDashPathEffect(PaintFlags*, int) const; | 83 void setupPaintDashPathEffect(PaintFlags*, int) const; |
84 | 84 |
| 85 // Determine whether a stroked line should be drawn using dashes. In practice, |
| 86 // we draw dashes when a dashed stroke is specified or when a dotted stroke |
| 87 // is specified but the line width is too small to draw circles. |
| 88 static bool strokeIsDashed(float width, StrokeStyle); |
| 89 |
85 private: | 90 private: |
86 StrokeStyle m_style; | 91 StrokeStyle m_style; |
87 float m_thickness; | 92 float m_thickness; |
88 PaintFlags::Cap m_lineCap; | 93 PaintFlags::Cap m_lineCap; |
89 PaintFlags::Join m_lineJoin; | 94 PaintFlags::Join m_lineJoin; |
90 float m_miterLimit; | 95 float m_miterLimit; |
91 sk_sp<SkPathEffect> m_dash; | 96 sk_sp<SkPathEffect> m_dash; |
92 }; | 97 }; |
93 | 98 |
94 } // namespace blink | 99 } // namespace blink |
95 | 100 |
96 #endif // StrokeData_h | 101 #endif // StrokeData_h |
OLD | NEW |