OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CanvasRenderingContext2DState_h | 5 #ifndef CanvasRenderingContext2DState_h |
6 #define CanvasRenderingContext2DState_h | 6 #define CanvasRenderingContext2DState_h |
7 | 7 |
8 #include "core/css/CSSFontSelectorClient.h" | 8 #include "core/css/CSSFontSelectorClient.h" |
9 #include "core/html/canvas/ClipList.h" | 9 #include "core/html/canvas/ClipList.h" |
10 #include "platform/fonts/Font.h" | 10 #include "platform/fonts/Font.h" |
11 #include "platform/transforms/AffineTransform.h" | 11 #include "platform/transforms/AffineTransform.h" |
12 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class CanvasStyle; | 16 class CanvasStyle; |
| 17 class CSSValue; |
| 18 class Element; |
17 | 19 |
18 class CanvasRenderingContext2DState final : public NoBaseWillBeGarbageCollectedF
inalized<CanvasRenderingContext2DState>, public CSSFontSelectorClient { | 20 class CanvasRenderingContext2DState final : public NoBaseWillBeGarbageCollectedF
inalized<CanvasRenderingContext2DState>, public CSSFontSelectorClient { |
19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2DState); | 21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2DState); |
20 public: | 22 public: |
21 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2DState> create() | 23 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2DState> create() |
22 { | 24 { |
23 return adoptPtrWillBeNoop(new CanvasRenderingContext2DState); | 25 return adoptPtrWillBeNoop(new CanvasRenderingContext2DState); |
24 } | 26 } |
25 | 27 |
26 virtual ~CanvasRenderingContext2DState(); | 28 virtual ~CanvasRenderingContext2DState(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 bool hasClip() const { return m_hasClip; } | 73 bool hasClip() const { return m_hasClip; } |
72 bool hasComplexClip() const { return m_hasComplexClip; } | 74 bool hasComplexClip() const { return m_hasComplexClip; } |
73 void playbackClips(SkCanvas* canvas) const { m_clipList.playback(canvas); } | 75 void playbackClips(SkCanvas* canvas) const { m_clipList.playback(canvas); } |
74 | 76 |
75 void setFont(const Font&, CSSFontSelector*); | 77 void setFont(const Font&, CSSFontSelector*); |
76 const Font& font() const; | 78 const Font& font() const; |
77 bool hasRealizedFont() const { return m_realizedFont; } | 79 bool hasRealizedFont() const { return m_realizedFont; } |
78 void setUnparsedFont(const String& font) { m_unparsedFont = font; } | 80 void setUnparsedFont(const String& font) { m_unparsedFont = font; } |
79 const String& unparsedFont() const { return m_unparsedFont; } | 81 const String& unparsedFont() const { return m_unparsedFont; } |
80 | 82 |
| 83 void setFilter(PassRefPtrWillBeRawPtr<CSSValue>); |
| 84 void setUnparsedFilter(const String& filterString) { m_unparsedFilter = filt
erString; } |
| 85 const String& unparsedFilter() const { return m_unparsedFilter; } |
| 86 SkImageFilter* getFilter(Element*, const Font&) const; |
| 87 bool hasFilter() const { return m_filterValue; } |
| 88 |
81 void setStrokeStyle(PassRefPtrWillBeRawPtr<CanvasStyle>); | 89 void setStrokeStyle(PassRefPtrWillBeRawPtr<CanvasStyle>); |
82 CanvasStyle* strokeStyle() const { return m_strokeStyle.get(); } | 90 CanvasStyle* strokeStyle() const { return m_strokeStyle.get(); } |
83 | 91 |
84 void setFillStyle(PassRefPtrWillBeRawPtr<CanvasStyle>); | 92 void setFillStyle(PassRefPtrWillBeRawPtr<CanvasStyle>); |
85 CanvasStyle* fillStyle() const { return m_fillStyle.get(); } | 93 CanvasStyle* fillStyle() const { return m_fillStyle.get(); } |
86 | 94 |
87 CanvasStyle* style(PaintType) const; | 95 CanvasStyle* style(PaintType) const; |
88 | 96 |
89 enum Direction { | 97 enum Direction { |
90 DirectionInherit, | 98 DirectionInherit, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 mutable RefPtr<SkImageFilter> m_shadowAndForegroundImageFilter; | 192 mutable RefPtr<SkImageFilter> m_shadowAndForegroundImageFilter; |
185 | 193 |
186 float m_globalAlpha; | 194 float m_globalAlpha; |
187 AffineTransform m_transform; | 195 AffineTransform m_transform; |
188 Vector<float> m_lineDash; | 196 Vector<float> m_lineDash; |
189 float m_lineDashOffset; | 197 float m_lineDashOffset; |
190 | 198 |
191 String m_unparsedFont; | 199 String m_unparsedFont; |
192 Font m_font; | 200 Font m_font; |
193 | 201 |
| 202 String m_unparsedFilter; |
| 203 RefPtrWillBeRawPtr<CSSValue> m_filterValue; |
| 204 mutable RefPtr<SkImageFilter> m_resolvedFilter; |
| 205 |
194 // Text state. | 206 // Text state. |
195 TextAlign m_textAlign; | 207 TextAlign m_textAlign; |
196 TextBaseline m_textBaseline; | 208 TextBaseline m_textBaseline; |
197 Direction m_direction; | 209 Direction m_direction; |
198 | 210 |
199 bool m_realizedFont : 1; | 211 bool m_realizedFont : 1; |
200 bool m_isTransformInvertible : 1; | 212 bool m_isTransformInvertible : 1; |
201 bool m_hasClip : 1; | 213 bool m_hasClip : 1; |
202 bool m_hasComplexClip : 1; | 214 bool m_hasComplexClip : 1; |
203 mutable bool m_fillStyleDirty : 1; | 215 mutable bool m_fillStyleDirty : 1; |
204 mutable bool m_strokeStyleDirty : 1; | 216 mutable bool m_strokeStyleDirty : 1; |
205 mutable bool m_lineDashDirty : 1; | 217 mutable bool m_lineDashDirty : 1; |
206 | 218 |
207 ClipList m_clipList; | 219 ClipList m_clipList; |
208 }; | 220 }; |
209 | 221 |
210 } // blink | 222 } // blink |
211 | 223 |
212 #endif | 224 #endif |
OLD | NEW |