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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // SkPaint objects that reflect the current state. If the length of the | 61 // SkPaint objects that reflect the current state. If the length of the |
62 // path to be stroked is known, pass it in for correct dash or dot placement
. | 62 // path to be stroked is known, pass it in for correct dash or dot placement
. |
63 const SkPaint& strokePaint(int strokedPathLength = 0) const; | 63 const SkPaint& strokePaint(int strokedPathLength = 0) const; |
64 const SkPaint& fillPaint() const; | 64 const SkPaint& fillPaint() const; |
65 | 65 |
66 uint16_t saveCount() const { return m_saveCount; } | 66 uint16_t saveCount() const { return m_saveCount; } |
67 void incrementSaveCount() { ++m_saveCount; } | 67 void incrementSaveCount() { ++m_saveCount; } |
68 void decrementSaveCount() { --m_saveCount; } | 68 void decrementSaveCount() { --m_saveCount; } |
69 | 69 |
70 // Stroke data | 70 // Stroke data |
71 const StrokeData& strokeData() const { return m_strokeData; } | 71 Color strokeColor() const { return m_strokeColor; } |
72 | 72 SkColor effectiveStrokeColor() const { return applyAlpha(m_strokeColor.rgb()
); } |
73 void setStrokeStyle(StrokeStyle); | |
74 | |
75 void setStrokeThickness(float); | |
76 | |
77 SkColor effectiveStrokeColor() const { return applyAlpha(m_strokeData.color(
).rgb()); } | |
78 void setStrokeColor(const Color&); | 73 void setStrokeColor(const Color&); |
79 | 74 |
| 75 Gradient* strokeGradient() const { return m_strokeGradient.get(); } |
80 void setStrokeGradient(const PassRefPtr<Gradient>); | 76 void setStrokeGradient(const PassRefPtr<Gradient>); |
81 void clearStrokeGradient(); | 77 void clearStrokeGradient(); |
82 | 78 |
| 79 Pattern* strokePattern() const { return m_strokePattern.get(); } |
83 void setStrokePattern(const PassRefPtr<Pattern>); | 80 void setStrokePattern(const PassRefPtr<Pattern>); |
84 void clearStrokePattern(); | 81 void clearStrokePattern(); |
85 | 82 |
| 83 const StrokeData& strokeData() const { return m_strokeData; } |
| 84 void setStrokeStyle(StrokeStyle); |
| 85 void setStrokeThickness(float); |
86 void setLineCap(LineCap); | 86 void setLineCap(LineCap); |
87 | |
88 void setLineJoin(LineJoin); | 87 void setLineJoin(LineJoin); |
89 | |
90 void setMiterLimit(float); | 88 void setMiterLimit(float); |
91 | |
92 void setLineDash(const DashArray&, float); | 89 void setLineDash(const DashArray&, float); |
93 | 90 |
94 // Fill data | 91 // Fill data |
95 Color fillColor() const { return m_fillColor; } | 92 Color fillColor() const { return m_fillColor; } |
96 SkColor effectiveFillColor() const { return applyAlpha(m_fillColor.rgb()); } | 93 SkColor effectiveFillColor() const { return applyAlpha(m_fillColor.rgb()); } |
97 void setFillColor(const Color&); | 94 void setFillColor(const Color&); |
98 | 95 |
99 Gradient* fillGradient() const { return m_fillGradient.get(); } | 96 Gradient* fillGradient() const { return m_fillGradient.get(); } |
100 void setFillGradient(const PassRefPtr<Gradient>); | 97 void setFillGradient(const PassRefPtr<Gradient>); |
101 void clearFillGradient(); | 98 void clearFillGradient(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 int a = SkAlphaMul(SkColorGetA(c), m_alpha); | 148 int a = SkAlphaMul(SkColorGetA(c), m_alpha); |
152 return (c & 0x00FFFFFF) | (a << 24); | 149 return (c & 0x00FFFFFF) | (a << 24); |
153 } | 150 } |
154 | 151 |
155 // These are mutbale to enable gradient updates when the paints are fetched
for use. | 152 // These are mutbale to enable gradient updates when the paints are fetched
for use. |
156 mutable SkPaint m_strokePaint; | 153 mutable SkPaint m_strokePaint; |
157 mutable SkPaint m_fillPaint; | 154 mutable SkPaint m_fillPaint; |
158 | 155 |
159 StrokeData m_strokeData; | 156 StrokeData m_strokeData; |
160 | 157 |
| 158 Color m_strokeColor; |
| 159 RefPtr<Gradient> m_strokeGradient; |
| 160 RefPtr<Pattern> m_strokePattern; |
| 161 |
161 Color m_fillColor; | 162 Color m_fillColor; |
162 WindRule m_fillRule; | 163 WindRule m_fillRule; |
163 RefPtr<Gradient> m_fillGradient; | 164 RefPtr<Gradient> m_fillGradient; |
164 RefPtr<Pattern> m_fillPattern; | 165 RefPtr<Pattern> m_fillPattern; |
165 | 166 |
166 RefPtr<SkDrawLooper> m_looper; | 167 RefPtr<SkDrawLooper> m_looper; |
167 | 168 |
168 TextDrawingModeFlags m_textDrawingMode; | 169 TextDrawingModeFlags m_textDrawingMode; |
169 | 170 |
170 int m_alpha; | 171 int m_alpha; |
171 RefPtr<SkColorFilter> m_colorFilter; | 172 RefPtr<SkColorFilter> m_colorFilter; |
172 | 173 |
173 CompositeOperator m_compositeOperator; | 174 CompositeOperator m_compositeOperator; |
174 WebBlendMode m_blendMode; | 175 WebBlendMode m_blendMode; |
175 | 176 |
176 InterpolationQuality m_interpolationQuality; | 177 InterpolationQuality m_interpolationQuality; |
177 | 178 |
178 uint16_t m_saveCount; | 179 uint16_t m_saveCount; |
179 | 180 |
180 bool m_shouldAntialias : 1; | 181 bool m_shouldAntialias : 1; |
181 bool m_shouldClampToSourceRect : 1; | 182 bool m_shouldClampToSourceRect : 1; |
182 }; | 183 }; |
183 | 184 |
184 } // namespace blink | 185 } // namespace blink |
185 | 186 |
186 #endif // GraphicsContextState_h | 187 #endif // GraphicsContextState_h |
OLD | NEW |