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 "modules/canvas2d/ClipList.h" | 9 #include "modules/canvas2d/ClipList.h" |
10 #include "platform/fonts/Font.h" | 10 #include "platform/fonts/Font.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 CanvasRenderingContext2DState& operator=(const CanvasRenderingContext2DState
&); | 48 CanvasRenderingContext2DState& operator=(const CanvasRenderingContext2DState
&); |
49 | 49 |
50 // CSSFontSelectorClient implementation | 50 // CSSFontSelectorClient implementation |
51 void fontsNeedUpdate(CSSFontSelector*) override; | 51 void fontsNeedUpdate(CSSFontSelector*) override; |
52 | 52 |
53 bool hasUnrealizedSaves() const { return m_unrealizedSaveCount; } | 53 bool hasUnrealizedSaves() const { return m_unrealizedSaveCount; } |
54 void save() { ++m_unrealizedSaveCount; } | 54 void save() { ++m_unrealizedSaveCount; } |
55 void restore() { --m_unrealizedSaveCount; } | 55 void restore() { --m_unrealizedSaveCount; } |
56 void resetUnrealizedSaveCount() { m_unrealizedSaveCount = 0; } | 56 void resetUnrealizedSaveCount() { m_unrealizedSaveCount = 0; } |
57 | 57 |
58 void setLineDash(const Vector<float>&); | 58 void setLineDash(const Vector<double>&); |
59 const Vector<float>& lineDash() const { return m_lineDash; } | 59 const Vector<double>& lineDash() const { return m_lineDash; } |
60 | 60 |
61 void setShouldAntialias(bool); | 61 void setShouldAntialias(bool); |
62 bool shouldAntialias() const; | 62 bool shouldAntialias() const; |
63 | 63 |
64 void setLineDashOffset(float); | 64 void setLineDashOffset(double); |
65 float lineDashOffset() const { return m_lineDashOffset; } | 65 double lineDashOffset() const { return m_lineDashOffset; } |
66 | 66 |
67 // setTransform returns true iff transform is invertible; | 67 // setTransform returns true iff transform is invertible; |
68 void setTransform(const AffineTransform&); | 68 void setTransform(const AffineTransform&); |
69 void resetTransform(); | 69 void resetTransform(); |
70 AffineTransform transform() const { return m_transform; } | 70 AffineTransform transform() const { return m_transform; } |
71 bool isTransformInvertible() const { return m_isTransformInvertible; } | 71 bool isTransformInvertible() const { return m_isTransformInvertible; } |
72 | 72 |
73 void clipPath(const SkPath&, AntiAliasingMode); | 73 void clipPath(const SkPath&, AntiAliasingMode); |
74 bool hasClip() const { return m_hasClip; } | 74 bool hasClip() const { return m_hasClip; } |
75 bool hasComplexClip() const { return m_hasComplexClip; } | 75 bool hasComplexClip() const { return m_hasComplexClip; } |
(...skipping 27 matching lines...) Expand all Loading... |
103 | 103 |
104 void setDirection(Direction direction) { m_direction = direction; } | 104 void setDirection(Direction direction) { m_direction = direction; } |
105 Direction direction() const { return m_direction; } | 105 Direction direction() const { return m_direction; } |
106 | 106 |
107 void setTextAlign(TextAlign align) { m_textAlign = align; } | 107 void setTextAlign(TextAlign align) { m_textAlign = align; } |
108 TextAlign textAlign() const { return m_textAlign; } | 108 TextAlign textAlign() const { return m_textAlign; } |
109 | 109 |
110 void setTextBaseline(TextBaseline baseline) { m_textBaseline = baseline; } | 110 void setTextBaseline(TextBaseline baseline) { m_textBaseline = baseline; } |
111 TextBaseline textBaseline() const { return m_textBaseline; } | 111 TextBaseline textBaseline() const { return m_textBaseline; } |
112 | 112 |
113 void setLineWidth(float lineWidth) { m_strokePaint.setStrokeWidth(lineWidth)
; } | 113 void setLineWidth(double lineWidth) { m_strokePaint.setStrokeWidth(lineWidth
); } |
114 float lineWidth() const { return m_strokePaint.getStrokeWidth(); } | 114 double lineWidth() const { return m_strokePaint.getStrokeWidth(); } |
115 | 115 |
116 void setLineCap(LineCap lineCap) { m_strokePaint.setStrokeCap(static_cast<Sk
Paint::Cap>(lineCap)); } | 116 void setLineCap(LineCap lineCap) { m_strokePaint.setStrokeCap(static_cast<Sk
Paint::Cap>(lineCap)); } |
117 LineCap lineCap() const { return static_cast<LineCap>(m_strokePaint.getStrok
eCap()); } | 117 LineCap lineCap() const { return static_cast<LineCap>(m_strokePaint.getStrok
eCap()); } |
118 | 118 |
119 void setLineJoin(LineJoin lineJoin) { m_strokePaint.setStrokeJoin(static_cas
t<SkPaint::Join>(lineJoin)); } | 119 void setLineJoin(LineJoin lineJoin) { m_strokePaint.setStrokeJoin(static_cas
t<SkPaint::Join>(lineJoin)); } |
120 LineJoin lineJoin() const { return static_cast<LineJoin>(m_strokePaint.getSt
rokeJoin()); } | 120 LineJoin lineJoin() const { return static_cast<LineJoin>(m_strokePaint.getSt
rokeJoin()); } |
121 | 121 |
122 void setMiterLimit(float miterLimit) { m_strokePaint.setStrokeMiter(miterLim
it); } | 122 void setMiterLimit(double miterLimit) { m_strokePaint.setStrokeMiter(miterLi
mit); } |
123 float miterLimit() const { return m_strokePaint.getStrokeMiter(); } | 123 double miterLimit() const { return m_strokePaint.getStrokeMiter(); } |
124 | 124 |
125 void setShadowOffsetX(float); | 125 void setShadowOffsetX(double); |
126 void setShadowOffsetY(float); | 126 void setShadowOffsetY(double); |
127 const FloatSize& shadowOffset() const { return m_shadowOffset; } | 127 const FloatSize& shadowOffset() const { return m_shadowOffset; } |
128 | 128 |
129 void setShadowBlur(float); | 129 void setShadowBlur(double); |
130 float shadowBlur() const { return m_shadowBlur; } | 130 double shadowBlur() const { return m_shadowBlur; } |
131 | 131 |
132 void setShadowColor(SkColor); | 132 void setShadowColor(SkColor); |
133 SkColor shadowColor() const { return m_shadowColor; } | 133 SkColor shadowColor() const { return m_shadowColor; } |
134 | 134 |
135 void setGlobalAlpha(float); | 135 void setGlobalAlpha(double); |
136 float globalAlpha() const { return m_globalAlpha; } | 136 double globalAlpha() const { return m_globalAlpha; } |
137 | 137 |
138 void setGlobalComposite(SkXfermode::Mode); | 138 void setGlobalComposite(SkXfermode::Mode); |
139 SkXfermode::Mode globalComposite() const; | 139 SkXfermode::Mode globalComposite() const; |
140 | 140 |
141 void setImageSmoothingEnabled(bool); | 141 void setImageSmoothingEnabled(bool); |
142 bool imageSmoothingEnabled() const; | 142 bool imageSmoothingEnabled() const; |
143 void setImageSmoothingQuality(const String&); | 143 void setImageSmoothingQuality(const String&); |
144 String imageSmoothingQuality() const; | 144 String imageSmoothingQuality() const; |
145 | 145 |
146 void setUnparsedStrokeColor(const String& color) { m_unparsedStrokeColor = c
olor; } | 146 void setUnparsedStrokeColor(const String& color) { m_unparsedStrokeColor = c
olor; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 String m_unparsedStrokeColor; | 181 String m_unparsedStrokeColor; |
182 String m_unparsedFillColor; | 182 String m_unparsedFillColor; |
183 PersistentWillBeMember<CanvasStyle> m_strokeStyle; | 183 PersistentWillBeMember<CanvasStyle> m_strokeStyle; |
184 PersistentWillBeMember<CanvasStyle> m_fillStyle; | 184 PersistentWillBeMember<CanvasStyle> m_fillStyle; |
185 | 185 |
186 mutable SkPaint m_strokePaint; | 186 mutable SkPaint m_strokePaint; |
187 mutable SkPaint m_fillPaint; | 187 mutable SkPaint m_fillPaint; |
188 mutable SkPaint m_imagePaint; | 188 mutable SkPaint m_imagePaint; |
189 | 189 |
190 FloatSize m_shadowOffset; | 190 FloatSize m_shadowOffset; |
191 float m_shadowBlur; | 191 double m_shadowBlur; |
192 SkColor m_shadowColor; | 192 SkColor m_shadowColor; |
193 mutable RefPtr<SkDrawLooper> m_emptyDrawLooper; | 193 mutable RefPtr<SkDrawLooper> m_emptyDrawLooper; |
194 mutable RefPtr<SkDrawLooper> m_shadowOnlyDrawLooper; | 194 mutable RefPtr<SkDrawLooper> m_shadowOnlyDrawLooper; |
195 mutable RefPtr<SkDrawLooper> m_shadowAndForegroundDrawLooper; | 195 mutable RefPtr<SkDrawLooper> m_shadowAndForegroundDrawLooper; |
196 mutable RefPtr<SkImageFilter> m_shadowOnlyImageFilter; | 196 mutable RefPtr<SkImageFilter> m_shadowOnlyImageFilter; |
197 mutable RefPtr<SkImageFilter> m_shadowAndForegroundImageFilter; | 197 mutable RefPtr<SkImageFilter> m_shadowAndForegroundImageFilter; |
198 | 198 |
199 float m_globalAlpha; | 199 double m_globalAlpha; |
200 AffineTransform m_transform; | 200 AffineTransform m_transform; |
201 Vector<float> m_lineDash; | 201 Vector<double> m_lineDash; |
202 float m_lineDashOffset; | 202 double m_lineDashOffset; |
203 | 203 |
204 String m_unparsedFont; | 204 String m_unparsedFont; |
205 Font m_font; | 205 Font m_font; |
206 | 206 |
207 String m_unparsedFilter; | 207 String m_unparsedFilter; |
208 RefPtrWillBeMember<CSSValue> m_filterValue; | 208 RefPtrWillBeMember<CSSValue> m_filterValue; |
209 mutable RefPtr<SkImageFilter> m_resolvedFilter; | 209 mutable RefPtr<SkImageFilter> m_resolvedFilter; |
210 | 210 |
211 // Text state. | 211 // Text state. |
212 TextAlign m_textAlign; | 212 TextAlign m_textAlign; |
(...skipping 10 matching lines...) Expand all Loading... |
223 | 223 |
224 bool m_imageSmoothingEnabled; | 224 bool m_imageSmoothingEnabled; |
225 SkFilterQuality m_imageSmoothingQuality; | 225 SkFilterQuality m_imageSmoothingQuality; |
226 | 226 |
227 ClipList m_clipList; | 227 ClipList m_clipList; |
228 }; | 228 }; |
229 | 229 |
230 } // blink | 230 } // blink |
231 | 231 |
232 #endif | 232 #endif |
OLD | NEW |