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; | 17 class CSSValue; |
18 class Element; | 18 class Element; |
19 | 19 |
20 class CanvasRenderingContext2DState final : public NoBaseWillBeGarbageCollectedF
inalized<CanvasRenderingContext2DState>, public CSSFontSelectorClient { | 20 class CanvasRenderingContext2DState final : public NoBaseWillBeGarbageCollectedF
inalized<CanvasRenderingContext2DState>, public CSSFontSelectorClient { |
21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2DState); | 21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2DState); |
22 public: | 22 public: |
23 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2DState> create() | 23 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2DState> create() |
24 { | 24 { |
25 return adoptPtrWillBeNoop(new CanvasRenderingContext2DState); | 25 return adoptPtrWillBeNoop(new CanvasRenderingContext2DState); |
26 } | 26 } |
27 | 27 |
28 virtual ~CanvasRenderingContext2DState(); | 28 ~CanvasRenderingContext2DState() override; |
29 | 29 |
30 DECLARE_VIRTUAL_TRACE(); | 30 DECLARE_VIRTUAL_TRACE(); |
31 | 31 |
32 enum ClipListCopyMode { | 32 enum ClipListCopyMode { |
33 CopyClipList, | 33 CopyClipList, |
34 DontCopyClipList | 34 DontCopyClipList |
35 }; | 35 }; |
36 | 36 |
37 enum PaintType { | 37 enum PaintType { |
38 FillPaintType, | 38 FillPaintType, |
39 StrokePaintType, | 39 StrokePaintType, |
40 ImagePaintType, | 40 ImagePaintType, |
41 }; | 41 }; |
42 | 42 |
43 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2DState> create(const Ca
nvasRenderingContext2DState& other, ClipListCopyMode mode) | 43 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2DState> create(const Ca
nvasRenderingContext2DState& other, ClipListCopyMode mode) |
44 { | 44 { |
45 return adoptPtrWillBeNoop(new CanvasRenderingContext2DState(other, mode)
); | 45 return adoptPtrWillBeNoop(new CanvasRenderingContext2DState(other, mode)
); |
46 } | 46 } |
47 CanvasRenderingContext2DState& operator=(const CanvasRenderingContext2DState
&); | 47 CanvasRenderingContext2DState& operator=(const CanvasRenderingContext2DState
&); |
48 | 48 |
49 // CSSFontSelectorClient implementation | 49 // CSSFontSelectorClient implementation |
50 virtual void fontsNeedUpdate(CSSFontSelector*) override; | 50 void fontsNeedUpdate(CSSFontSelector*) override; |
51 | 51 |
52 bool hasUnrealizedSaves() const { return m_unrealizedSaveCount; } | 52 bool hasUnrealizedSaves() const { return m_unrealizedSaveCount; } |
53 void save() { ++m_unrealizedSaveCount; } | 53 void save() { ++m_unrealizedSaveCount; } |
54 void restore() { --m_unrealizedSaveCount; } | 54 void restore() { --m_unrealizedSaveCount; } |
55 void resetUnrealizedSaveCount() { m_unrealizedSaveCount = 0; } | 55 void resetUnrealizedSaveCount() { m_unrealizedSaveCount = 0; } |
56 | 56 |
57 void setLineDash(const Vector<float>&); | 57 void setLineDash(const Vector<float>&); |
58 const Vector<float>& lineDash() const { return m_lineDash; } | 58 const Vector<float>& lineDash() const { return m_lineDash; } |
59 | 59 |
60 void setShouldAntialias(bool); | 60 void setShouldAntialias(bool); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 mutable bool m_fillStyleDirty : 1; | 215 mutable bool m_fillStyleDirty : 1; |
216 mutable bool m_strokeStyleDirty : 1; | 216 mutable bool m_strokeStyleDirty : 1; |
217 mutable bool m_lineDashDirty : 1; | 217 mutable bool m_lineDashDirty : 1; |
218 | 218 |
219 ClipList m_clipList; | 219 ClipList m_clipList; |
220 }; | 220 }; |
221 | 221 |
222 } // blink | 222 } // blink |
223 | 223 |
224 #endif | 224 #endif |
OLD | NEW |