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 15 matching lines...) Expand all Loading... |
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 GraphicsContextState_h | 29 #ifndef GraphicsContextState_h |
30 #define GraphicsContextState_h | 30 #define GraphicsContextState_h |
31 | 31 |
32 #include "platform/graphics/DrawLooperBuilder.h" | 32 #include "platform/graphics/DrawLooperBuilder.h" |
33 #include "platform/graphics/Gradient.h" | 33 #include "platform/graphics/Gradient.h" |
34 #include "platform/graphics/GraphicsTypes.h" | 34 #include "platform/graphics/GraphicsTypes.h" |
35 #include "platform/graphics/Path.h" | 35 #include "platform/graphics/Path.h" |
36 #include "platform/graphics/Pattern.h" | |
37 #include "platform/graphics/StrokeData.h" | 36 #include "platform/graphics/StrokeData.h" |
38 #include "platform/graphics/skia/SkiaUtils.h" | 37 #include "platform/graphics/skia/SkiaUtils.h" |
39 #include "third_party/skia/include/core/SkColorFilter.h" | 38 #include "third_party/skia/include/core/SkColorFilter.h" |
40 #include "third_party/skia/include/core/SkPaint.h" | 39 #include "third_party/skia/include/core/SkPaint.h" |
41 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
42 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
43 | 42 |
44 namespace blink { | 43 namespace blink { |
45 | 44 |
46 // Encapsulates the state information we store for each pushed graphics state. | 45 // Encapsulates the state information we store for each pushed graphics state. |
(...skipping 21 matching lines...) Expand all Loading... |
68 void incrementSaveCount() { ++m_saveCount; } | 67 void incrementSaveCount() { ++m_saveCount; } |
69 void decrementSaveCount() { --m_saveCount; } | 68 void decrementSaveCount() { --m_saveCount; } |
70 | 69 |
71 // Stroke data | 70 // Stroke data |
72 Color strokeColor() const { return m_strokeColor; } | 71 Color strokeColor() const { return m_strokeColor; } |
73 void setStrokeColor(const Color&); | 72 void setStrokeColor(const Color&); |
74 | 73 |
75 Gradient* strokeGradient() const { return m_strokeGradient.get(); } | 74 Gradient* strokeGradient() const { return m_strokeGradient.get(); } |
76 void setStrokeGradient(const PassRefPtr<Gradient>, float); | 75 void setStrokeGradient(const PassRefPtr<Gradient>, float); |
77 | 76 |
78 Pattern* strokePattern() const { return m_strokePattern.get(); } | |
79 void setStrokePattern(const PassRefPtr<Pattern>, float); | |
80 | |
81 const StrokeData& strokeData() const { return m_strokeData; } | 77 const StrokeData& strokeData() const { return m_strokeData; } |
82 void setStrokeStyle(StrokeStyle); | 78 void setStrokeStyle(StrokeStyle); |
83 void setStrokeThickness(float); | 79 void setStrokeThickness(float); |
84 void setLineCap(LineCap); | 80 void setLineCap(LineCap); |
85 void setLineJoin(LineJoin); | 81 void setLineJoin(LineJoin); |
86 void setMiterLimit(float); | 82 void setMiterLimit(float); |
87 void setLineDash(const DashArray&, float); | 83 void setLineDash(const DashArray&, float); |
88 | 84 |
89 // Fill data | 85 // Fill data |
90 Color fillColor() const { return m_fillColor; } | 86 Color fillColor() const { return m_fillColor; } |
91 void setFillColor(const Color&); | 87 void setFillColor(const Color&); |
92 | 88 |
93 Gradient* fillGradient() const { return m_fillGradient.get(); } | 89 Gradient* fillGradient() const { return m_fillGradient.get(); } |
94 void setFillGradient(const PassRefPtr<Gradient>, float); | 90 void setFillGradient(const PassRefPtr<Gradient>, float); |
95 | 91 |
96 Pattern* fillPattern() const { return m_fillPattern.get(); } | |
97 void setFillPattern(const PassRefPtr<Pattern>, float); | |
98 | |
99 // Shadow. (This will need tweaking if we use draw loopers for other things.
) | 92 // Shadow. (This will need tweaking if we use draw loopers for other things.
) |
100 SkDrawLooper* drawLooper() const { return m_looper.get(); } | 93 SkDrawLooper* drawLooper() const { return m_looper.get(); } |
101 void setDrawLooper(PassRefPtr<SkDrawLooper>); | 94 void setDrawLooper(PassRefPtr<SkDrawLooper>); |
102 void clearDrawLooper(); | 95 void clearDrawLooper(); |
103 | 96 |
104 // Text. (See TextModeFill & friends.) | 97 // Text. (See TextModeFill & friends.) |
105 TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; } | 98 TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; } |
106 void setTextDrawingMode(TextDrawingModeFlags mode) { m_textDrawingMode = mod
e; } | 99 void setTextDrawingMode(TextDrawingModeFlags mode) { m_textDrawingMode = mod
e; } |
107 | 100 |
108 SkColorFilter* colorFilter() const { return m_colorFilter.get(); } | 101 SkColorFilter* colorFilter() const { return m_colorFilter.get(); } |
(...skipping 12 matching lines...) Expand all Loading... |
121 GraphicsContextState& operator=(const GraphicsContextState&); | 114 GraphicsContextState& operator=(const GraphicsContextState&); |
122 | 115 |
123 // These are mutbale to enable gradient updates when the paints are fetched
for use. | 116 // These are mutbale to enable gradient updates when the paints are fetched
for use. |
124 mutable SkPaint m_strokePaint; | 117 mutable SkPaint m_strokePaint; |
125 mutable SkPaint m_fillPaint; | 118 mutable SkPaint m_fillPaint; |
126 | 119 |
127 StrokeData m_strokeData; | 120 StrokeData m_strokeData; |
128 | 121 |
129 Color m_strokeColor; | 122 Color m_strokeColor; |
130 RefPtr<Gradient> m_strokeGradient; | 123 RefPtr<Gradient> m_strokeGradient; |
131 RefPtr<Pattern> m_strokePattern; | |
132 | 124 |
133 Color m_fillColor; | 125 Color m_fillColor; |
134 RefPtr<Gradient> m_fillGradient; | 126 RefPtr<Gradient> m_fillGradient; |
135 RefPtr<Pattern> m_fillPattern; | |
136 | 127 |
137 RefPtr<SkDrawLooper> m_looper; | 128 RefPtr<SkDrawLooper> m_looper; |
138 | 129 |
139 TextDrawingModeFlags m_textDrawingMode; | 130 TextDrawingModeFlags m_textDrawingMode; |
140 | 131 |
141 RefPtr<SkColorFilter> m_colorFilter; | 132 RefPtr<SkColorFilter> m_colorFilter; |
142 | 133 |
143 InterpolationQuality m_interpolationQuality; | 134 InterpolationQuality m_interpolationQuality; |
144 | 135 |
145 uint16_t m_saveCount; | 136 uint16_t m_saveCount; |
146 | 137 |
147 bool m_shouldAntialias : 1; | 138 bool m_shouldAntialias : 1; |
148 }; | 139 }; |
149 | 140 |
150 } // namespace blink | 141 } // namespace blink |
151 | 142 |
152 #endif // GraphicsContextState_h | 143 #endif // GraphicsContextState_h |
OLD | NEW |