| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 : m_style(SolidStroke) | 49 : m_style(SolidStroke) |
| 50 , m_thickness(0) | 50 , m_thickness(0) |
| 51 , m_color(Color::black) | 51 , m_color(Color::black) |
| 52 , m_lineCap(SkPaint::kDefault_Cap) | 52 , m_lineCap(SkPaint::kDefault_Cap) |
| 53 , m_lineJoin(SkPaint::kDefault_Join) | 53 , m_lineJoin(SkPaint::kDefault_Join) |
| 54 , m_miterLimit(4) | 54 , m_miterLimit(4) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 StrokeStyle style() const { return m_style; } | 58 StrokeStyle style() const { return m_style; } |
| 59 void setStyle(const StrokeStyle style) { m_style = style; } | 59 void setStyle(StrokeStyle style) { m_style = style; } |
| 60 | 60 |
| 61 float thickness() const { return m_thickness; } | 61 float thickness() const { return m_thickness; } |
| 62 void setThickness(const float thickness) { m_thickness = thickness; } | 62 void setThickness(float thickness) { m_thickness = thickness; } |
| 63 | 63 |
| 64 Color color() const { return m_color; } | 64 Color color() const { return m_color; } |
| 65 void setColor(const Color& color) { m_color = color; } | 65 void setColor(const Color& color) { m_color = color; } |
| 66 | 66 |
| 67 Gradient* gradient() const { return m_gradient.get(); } | 67 Gradient* gradient() const { return m_gradient.get(); } |
| 68 void setGradient(const PassRefPtr<Gradient> gradient) { m_gradient = gradien
t; } | 68 void setGradient(const PassRefPtr<Gradient> gradient) { m_gradient = gradien
t; } |
| 69 void clearGradient() { m_gradient.clear(); } | 69 void clearGradient() { m_gradient.clear(); } |
| 70 | 70 |
| 71 Pattern* pattern() const { return m_pattern.get(); } | 71 Pattern* pattern() const { return m_pattern.get(); } |
| 72 void setPattern(const PassRefPtr<Pattern> pattern) { m_pattern = pattern; } | 72 void setPattern(const PassRefPtr<Pattern> pattern) { m_pattern = pattern; } |
| 73 void clearPattern() { m_pattern.clear(); } | 73 void clearPattern() { m_pattern.clear(); } |
| 74 | 74 |
| 75 LineCap lineCap() const { return (LineCap)m_lineCap; } | 75 LineCap lineCap() const { return (LineCap)m_lineCap; } |
| 76 void setLineCap(const LineCap cap) { m_lineCap = (SkPaint::Cap)cap; } | 76 void setLineCap(LineCap cap) { m_lineCap = (SkPaint::Cap)cap; } |
| 77 | 77 |
| 78 LineJoin lineJoin() const { return (LineJoin)m_lineJoin; } | 78 LineJoin lineJoin() const { return (LineJoin)m_lineJoin; } |
| 79 void setLineJoin(const LineJoin join) { m_lineJoin = (SkPaint::Join)join; } | 79 void setLineJoin(LineJoin join) { m_lineJoin = (SkPaint::Join)join; } |
| 80 | 80 |
| 81 float miterLimit() const { return m_miterLimit; } | 81 float miterLimit() const { return m_miterLimit; } |
| 82 void setMiterLimit(const float miterLimit) { m_miterLimit = miterLimit; } | 82 void setMiterLimit(float miterLimit) { m_miterLimit = miterLimit; } |
| 83 | 83 |
| 84 void setLineDash(const DashArray&, const float); | 84 void setLineDash(const DashArray&, float); |
| 85 | 85 |
| 86 // Sets everything on the paint except the pattern, gradient and color. | 86 // Sets everything on the paint except the pattern, gradient and color. |
| 87 // GraphicsContext::setupShader does that. Returns a float representing the | 87 // GraphicsContext::setupShader does that. If a non-zero length is provided,
the |
| 88 // effective width of the pen. If a non-zero length is provided, the | |
| 89 // number of dashes/dots on a dashed/dotted line will be adjusted to | 88 // number of dashes/dots on a dashed/dotted line will be adjusted to |
| 90 // start and end that length with a dash/dot. | 89 // start and end that length with a dash/dot. |
| 91 float setupPaint(SkPaint*, int length = 0) const; | 90 void setupPaint(SkPaint*, int length = 0) const; |
| 91 |
| 92 // Setup any DashPathEffect on the paint. If a non-zero length is provided, |
| 93 // and no line dash has been set, the number of dashes/dots on a dashed/dott
ed |
| 94 // line will be adjusted to start and end that length with a dash/dot. |
| 95 void setupPaintDashPathEffect(SkPaint*, int) const; |
| 92 | 96 |
| 93 private: | 97 private: |
| 94 StrokeStyle m_style; | 98 StrokeStyle m_style; |
| 95 float m_thickness; | 99 float m_thickness; |
| 96 Color m_color; | 100 Color m_color; |
| 97 RefPtr<Gradient> m_gradient; | 101 RefPtr<Gradient> m_gradient; |
| 98 RefPtr<Pattern> m_pattern; | 102 RefPtr<Pattern> m_pattern; |
| 99 SkPaint::Cap m_lineCap; | 103 SkPaint::Cap m_lineCap; |
| 100 SkPaint::Join m_lineJoin; | 104 SkPaint::Join m_lineJoin; |
| 101 float m_miterLimit; | 105 float m_miterLimit; |
| 102 RefPtr<SkDashPathEffect> m_dash; | 106 RefPtr<SkDashPathEffect> m_dash; |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 } // namespace WebCore | 109 } // namespace WebCore |
| 106 | 110 |
| 107 #endif // StrokeData_h | 111 #endif // StrokeData_h |
| OLD | NEW |