| 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 11 matching lines...) Expand all Loading... |
| 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 #ifndef StrokeData_h | 29 #ifndef StrokeData_h |
| 30 #define StrokeData_h | 30 #define StrokeData_h |
| 31 | 31 |
| 32 #include "core/platform/graphics/Color.h" |
| 32 #include "core/platform/graphics/DashArray.h" | 33 #include "core/platform/graphics/DashArray.h" |
| 33 #include "core/platform/graphics/Gradient.h" | |
| 34 #include "core/platform/graphics/GraphicsTypes.h" | 34 #include "core/platform/graphics/GraphicsTypes.h" |
| 35 #include "core/platform/graphics/Pattern.h" | 35 #include "third_party/skia/include/core/SkPaint.h" |
| 36 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefPtr.h" |
| 36 | 38 |
| 37 #include "third_party/skia/include/core/SkColorPriv.h" | 39 class SkDashPathEffect; |
| 38 #include "third_party/skia/include/effects/SkDashPathEffect.h" | |
| 39 | |
| 40 #include "wtf/PassOwnPtr.h" | |
| 41 | 40 |
| 42 namespace WebCore { | 41 namespace WebCore { |
| 43 | 42 |
| 43 class Gradient; |
| 44 class Pattern; |
| 45 |
| 44 // Encapsulates stroke painting information. | 46 // Encapsulates stroke painting information. |
| 45 // It is pulled out of GraphicsContextState to enable other methods to use it. | 47 // It is pulled out of GraphicsContextState to enable other methods to use it. |
| 46 class StrokeData { | 48 class StrokeData { |
| 47 public: | 49 public: |
| 48 StrokeData() | 50 StrokeData(); |
| 49 : m_style(SolidStroke) | 51 StrokeData(const StrokeData& other); |
| 50 , m_thickness(0) | 52 ~StrokeData(); |
| 51 , m_color(Color::black) | |
| 52 , m_lineCap(SkPaint::kDefault_Cap) | |
| 53 , m_lineJoin(SkPaint::kDefault_Join) | |
| 54 , m_miterLimit(4) | |
| 55 , m_dash(0) | |
| 56 { | |
| 57 } | |
| 58 | |
| 59 StrokeData(const StrokeData& other) | |
| 60 : m_style(other.m_style) | |
| 61 , m_thickness(other.m_thickness) | |
| 62 , m_color(other.m_color) | |
| 63 , m_gradient(other.m_gradient) | |
| 64 , m_pattern(other.m_pattern) | |
| 65 , m_lineCap(other.m_lineCap) | |
| 66 , m_lineJoin(other.m_lineJoin) | |
| 67 , m_miterLimit(other.m_miterLimit) | |
| 68 , m_dash(other.m_dash) | |
| 69 { | |
| 70 SkSafeRef(m_dash); | |
| 71 } | |
| 72 | |
| 73 ~StrokeData() | |
| 74 { | |
| 75 SkSafeUnref(m_dash); | |
| 76 } | |
| 77 | 53 |
| 78 StrokeStyle style() const { return m_style; } | 54 StrokeStyle style() const { return m_style; } |
| 79 void setStyle(const StrokeStyle style) { m_style = style; } | 55 void setStyle(const StrokeStyle style) { m_style = style; } |
| 80 | 56 |
| 81 float thickness() const { return m_thickness; } | 57 float thickness() const { return m_thickness; } |
| 82 void setThickness(const float thickness) { m_thickness = thickness; } | 58 void setThickness(const float thickness) { m_thickness = thickness; } |
| 83 | 59 |
| 84 Color color() const { return m_color; } | 60 Color color() const { return m_color; } |
| 85 void setColor(const Color& color) { m_color = color; } | 61 void setColor(const Color&); |
| 86 | 62 |
| 87 Gradient* gradient() const { return m_gradient.get(); } | 63 Gradient* gradient() const { return m_gradient.get(); } |
| 88 void setGradient(const PassRefPtr<Gradient> gradient) { m_gradient = gradien
t; } | 64 void setGradient(PassRefPtr<Gradient>); |
| 89 void clearGradient() { m_gradient.clear(); } | |
| 90 | 65 |
| 91 Pattern* pattern() const { return m_pattern.get(); } | 66 Pattern* pattern() const { return m_pattern.get(); } |
| 92 void setPattern(const PassRefPtr<Pattern> pattern) { m_pattern = pattern; } | 67 void setPattern(PassRefPtr<Pattern>); |
| 93 void clearPattern() { m_pattern.clear(); } | |
| 94 | 68 |
| 95 LineCap lineCap() const { return (LineCap)m_lineCap; } | 69 LineCap lineCap() const { return (LineCap)m_lineCap; } |
| 96 void setLineCap(const LineCap cap) { m_lineCap = (SkPaint::Cap)cap; } | 70 void setLineCap(const LineCap cap) { m_lineCap = (SkPaint::Cap)cap; } |
| 97 | 71 |
| 98 LineJoin lineJoin() const { return (LineJoin)m_lineJoin; } | 72 LineJoin lineJoin() const { return (LineJoin)m_lineJoin; } |
| 99 void setLineJoin(const LineJoin join) { m_lineJoin = (SkPaint::Join)join; } | 73 void setLineJoin(const LineJoin join) { m_lineJoin = (SkPaint::Join)join; } |
| 100 | 74 |
| 101 float miterLimit() const { return m_miterLimit; } | 75 float miterLimit() const { return m_miterLimit; } |
| 102 void setMiterLimit(const float miterLimit) { m_miterLimit = miterLimit; } | 76 void setMiterLimit(const float miterLimit) { m_miterLimit = miterLimit; } |
| 103 | 77 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 118 RefPtr<Pattern> m_pattern; | 92 RefPtr<Pattern> m_pattern; |
| 119 SkPaint::Cap m_lineCap; | 93 SkPaint::Cap m_lineCap; |
| 120 SkPaint::Join m_lineJoin; | 94 SkPaint::Join m_lineJoin; |
| 121 float m_miterLimit; | 95 float m_miterLimit; |
| 122 SkDashPathEffect* m_dash; | 96 SkDashPathEffect* m_dash; |
| 123 }; | 97 }; |
| 124 | 98 |
| 125 } // namespace WebCore | 99 } // namespace WebCore |
| 126 | 100 |
| 127 #endif // StrokeData_h | 101 #endif // StrokeData_h |
| OLD | NEW |