OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 }; | 79 }; |
80 | 80 |
81 ~CanvasRenderingContext2D() override; | 81 ~CanvasRenderingContext2D() override; |
82 | 82 |
83 void strokeStyle(StringOrCanvasGradientOrCanvasPattern&) const; | 83 void strokeStyle(StringOrCanvasGradientOrCanvasPattern&) const; |
84 void setStrokeStyle(const StringOrCanvasGradientOrCanvasPattern&); | 84 void setStrokeStyle(const StringOrCanvasGradientOrCanvasPattern&); |
85 | 85 |
86 void fillStyle(StringOrCanvasGradientOrCanvasPattern&) const; | 86 void fillStyle(StringOrCanvasGradientOrCanvasPattern&) const; |
87 void setFillStyle(const StringOrCanvasGradientOrCanvasPattern&); | 87 void setFillStyle(const StringOrCanvasGradientOrCanvasPattern&); |
88 | 88 |
89 float lineWidth() const; | 89 double lineWidth() const; |
90 void setLineWidth(float); | 90 void setLineWidth(double); |
91 | 91 |
92 String lineCap() const; | 92 String lineCap() const; |
93 void setLineCap(const String&); | 93 void setLineCap(const String&); |
94 | 94 |
95 String lineJoin() const; | 95 String lineJoin() const; |
96 void setLineJoin(const String&); | 96 void setLineJoin(const String&); |
97 | 97 |
98 float miterLimit() const; | 98 double miterLimit() const; |
99 void setMiterLimit(float); | 99 void setMiterLimit(double); |
100 | 100 |
101 const Vector<float>& getLineDash() const; | 101 const Vector<float>& getLineDash() const; |
102 void setLineDash(const Vector<float>&); | 102 void setLineDash(const Vector<float>&); |
103 | 103 |
xidachen
2015/11/19 18:55:32
These two lines are left out on purpose. The reaso
| |
104 float lineDashOffset() const; | 104 double lineDashOffset() const; |
105 void setLineDashOffset(float); | 105 void setLineDashOffset(double); |
106 | 106 |
107 float shadowOffsetX() const; | 107 double shadowOffsetX() const; |
108 void setShadowOffsetX(float); | 108 void setShadowOffsetX(double); |
109 | 109 |
110 float shadowOffsetY() const; | 110 double shadowOffsetY() const; |
111 void setShadowOffsetY(float); | 111 void setShadowOffsetY(double); |
112 | 112 |
113 float shadowBlur() const; | 113 double shadowBlur() const; |
114 void setShadowBlur(float); | 114 void setShadowBlur(double); |
115 | 115 |
116 String shadowColor() const; | 116 String shadowColor() const; |
117 void setShadowColor(const String&); | 117 void setShadowColor(const String&); |
118 | 118 |
119 float globalAlpha() const; | 119 double globalAlpha() const; |
120 void setGlobalAlpha(float); | 120 void setGlobalAlpha(double); |
121 | 121 |
122 bool isContextLost() const override; | 122 bool isContextLost() const override; |
123 | 123 |
124 bool shouldAntialias() const; | 124 bool shouldAntialias() const; |
125 void setShouldAntialias(bool) override; | 125 void setShouldAntialias(bool) override; |
126 | 126 |
127 String globalCompositeOperation() const; | 127 String globalCompositeOperation() const; |
128 void setGlobalCompositeOperation(const String&); | 128 void setGlobalCompositeOperation(const String&); |
129 | 129 |
130 String filter() const; | 130 String filter() const; |
131 void setFilter(const String&); | 131 void setFilter(const String&); |
132 | 132 |
133 void save(); | 133 void save(); |
134 void restore(); | 134 void restore(); |
135 | 135 |
136 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> currentTransform() const; | 136 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> currentTransform() const; |
137 void setCurrentTransform(PassRefPtrWillBeRawPtr<SVGMatrixTearOff>); | 137 void setCurrentTransform(PassRefPtrWillBeRawPtr<SVGMatrixTearOff>); |
138 | 138 |
139 void scale(float sx, float sy); | 139 void scale(double sx, double sy); |
140 void rotate(float angleInRadians); | 140 void rotate(double angleInRadians); |
141 void translate(float tx, float ty); | 141 void translate(double tx, double ty); |
142 void transform(float m11, float m12, float m21, float m22, float dx, float d y); | 142 void transform(double m11, double m12, double m21, double m22, double dx, do uble dy); |
143 void setTransform(float m11, float m12, float m21, float m22, float dx, floa t dy); | 143 void setTransform(double m11, double m12, double m21, double m22, double dx, double dy); |
144 void resetTransform(); | 144 void resetTransform(); |
145 | 145 |
146 void beginPath(); | 146 void beginPath(); |
147 | 147 |
148 void fill(const String& winding = "nonzero"); | 148 void fill(const String& winding = "nonzero"); |
149 void fill(Path2D*, const String& winding = "nonzero"); | 149 void fill(Path2D*, const String& winding = "nonzero"); |
150 void stroke(); | 150 void stroke(); |
151 void stroke(Path2D*); | 151 void stroke(Path2D*); |
152 void clip(const String& winding = "nonzero"); | 152 void clip(const String& winding = "nonzero"); |
153 void clip(Path2D*, const String& winding = "nonzero"); | 153 void clip(Path2D*, const String& winding = "nonzero"); |
154 | 154 |
155 bool isPointInPath(const float x, const float y, const String& winding = "no nzero"); | 155 bool isPointInPath(const double x, const double y, const String& winding = " nonzero"); |
156 bool isPointInPath(Path2D*, const float x, const float y, const String& wind ing = "nonzero"); | 156 bool isPointInPath(Path2D*, const double x, const double y, const String& wi nding = "nonzero"); |
157 bool isPointInStroke(const float x, const float y); | 157 bool isPointInStroke(const double x, const double y); |
158 bool isPointInStroke(Path2D*, const float x, const float y); | 158 bool isPointInStroke(Path2D*, const double x, const double y); |
159 | 159 |
160 void scrollPathIntoView(); | 160 void scrollPathIntoView(); |
161 void scrollPathIntoView(Path2D*); | 161 void scrollPathIntoView(Path2D*); |
162 | 162 |
163 void clearRect(float x, float y, float width, float height) override; | 163 void clearRect(double x, double y, double width, double height) override; |
164 void fillRect(float x, float y, float width, float height); | 164 void fillRect(double x, double y, double width, double height); |
165 void strokeRect(float x, float y, float width, float height); | 165 void strokeRect(double x, double y, double width, double height); |
166 | 166 |
167 void drawImage(const CanvasImageSourceUnion&, float x, float y, ExceptionSta te&); | 167 void drawImage(const CanvasImageSourceUnion&, double x, double y, ExceptionS tate&); |
168 void drawImage(const CanvasImageSourceUnion&, float x, float y, float width, float height, ExceptionState&); | 168 void drawImage(const CanvasImageSourceUnion&, double x, double y, double wid th, double height, ExceptionState&); |
169 void drawImage(const CanvasImageSourceUnion&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&); | 169 void drawImage(const CanvasImageSourceUnion&, double sx, double sy, double s w, double sh, double dx, double dy, double dw, double dh, ExceptionState&); |
170 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&); | 170 void drawImage(CanvasImageSource*, double sx, double sy, double sw, double s h, double dx, double dy, double dw, double dh, ExceptionState&); |
171 | 171 |
172 CanvasGradient* createLinearGradient(float x0, float y0, float x1, float y1) ; | 172 CanvasGradient* createLinearGradient(double x0, double y0, double x1, double y1); |
173 CanvasGradient* createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState&); | 173 CanvasGradient* createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1, ExceptionState&); |
174 CanvasPattern* createPattern(const CanvasImageSourceUnion&, const String& re petitionType, ExceptionState&); | 174 CanvasPattern* createPattern(const CanvasImageSourceUnion&, const String& re petitionType, ExceptionState&); |
175 | 175 |
176 ImageData* createImageData(ImageData*) const; | 176 ImageData* createImageData(ImageData*) const; |
177 ImageData* createImageData(float width, float height, ExceptionState&) const ; | 177 ImageData* createImageData(double width, double height, ExceptionState&) con st; |
178 ImageData* getImageData(float sx, float sy, float sw, float sh, ExceptionSta te&) const; | 178 ImageData* getImageData(double sx, double sy, double sw, double sh, Exceptio nState&) const; |
179 void putImageData(ImageData*, float dx, float dy, ExceptionState&); | 179 void putImageData(ImageData*, double dx, double dy, ExceptionState&); |
180 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&); | 180 void putImageData(ImageData*, double dx, double dy, double dirtyX, double di rtyY, double dirtyWidth, double dirtyHeight, ExceptionState&); |
181 | 181 |
182 void reset() override; | 182 void reset() override; |
183 | 183 |
184 String font() const; | 184 String font() const; |
185 void setFont(const String&) override; | 185 void setFont(const String&) override; |
186 | 186 |
187 String textAlign() const; | 187 String textAlign() const; |
188 void setTextAlign(const String&); | 188 void setTextAlign(const String&); |
189 | 189 |
190 String textBaseline() const; | 190 String textBaseline() const; |
191 void setTextBaseline(const String&); | 191 void setTextBaseline(const String&); |
192 | 192 |
193 String direction() const; | 193 String direction() const; |
194 void setDirection(const String&); | 194 void setDirection(const String&); |
195 | 195 |
196 void fillText(const String& text, float x, float y); | 196 void fillText(const String& text, double x, double y); |
197 void fillText(const String& text, float x, float y, float maxWidth); | 197 void fillText(const String& text, double x, double y, double maxWidth); |
198 void strokeText(const String& text, float x, float y); | 198 void strokeText(const String& text, double x, double y); |
199 void strokeText(const String& text, float x, float y, float maxWidth); | 199 void strokeText(const String& text, double x, double y, double maxWidth); |
200 TextMetrics* measureText(const String& text); | 200 TextMetrics* measureText(const String& text); |
201 | 201 |
202 bool imageSmoothingEnabled() const; | 202 bool imageSmoothingEnabled() const; |
203 void setImageSmoothingEnabled(bool); | 203 void setImageSmoothingEnabled(bool); |
204 String imageSmoothingQuality() const; | 204 String imageSmoothingQuality() const; |
205 void setImageSmoothingQuality(const String&); | 205 void setImageSmoothingQuality(const String&); |
206 | 206 |
207 void getContextAttributes(Canvas2DContextAttributes&) const; | 207 void getContextAttributes(Canvas2DContextAttributes&) const; |
208 | 208 |
209 void drawFocusIfNeeded(Element*); | 209 void drawFocusIfNeeded(Element*); |
(...skipping 17 matching lines...) Expand all Loading... | |
227 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle) override; | 227 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle) override; |
228 | 228 |
229 private: | 229 private: |
230 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; | 230 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; |
231 | 231 |
232 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&); | 232 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&); |
233 | 233 |
234 CanvasRenderingContext2DState& modifiableState(); | 234 CanvasRenderingContext2DState& modifiableState(); |
235 const CanvasRenderingContext2DState& state() const { return *m_stateStack.la st(); } | 235 const CanvasRenderingContext2DState& state() const { return *m_stateStack.la st(); } |
236 | 236 |
237 void setShadow(const FloatSize& offset, float blur, RGBA32 color); | 237 void setShadow(const FloatSize& offset, double blur, RGBA32 color); |
238 | 238 |
239 void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*); | 239 void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*); |
240 void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*); | 240 void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*); |
241 void tryRestoreContextEvent(Timer<CanvasRenderingContext2D>*); | 241 void tryRestoreContextEvent(Timer<CanvasRenderingContext2D>*); |
242 | 242 |
243 bool computeDirtyRect(const FloatRect& localBounds, SkIRect*); | 243 bool computeDirtyRect(const FloatRect& localBounds, SkIRect*); |
244 bool computeDirtyRect(const FloatRect& localBounds, const SkIRect& transform edClipBounds, SkIRect*); | 244 bool computeDirtyRect(const FloatRect& localBounds, const SkIRect& transform edClipBounds, SkIRect*); |
245 void didDraw(const SkIRect&); | 245 void didDraw(const SkIRect&); |
246 | 246 |
247 SkCanvas* drawingCanvas() const; | 247 SkCanvas* drawingCanvas() const; |
248 | 248 |
249 void unwindStateStack(); | 249 void unwindStateStack(); |
250 void realizeSaves(); | 250 void realizeSaves(); |
251 | 251 |
252 void pruneLocalFontCache(size_t targetSize); | 252 void pruneLocalFontCache(size_t targetSize); |
253 void schedulePruneLocalFontCacheIfNeeded(); | 253 void schedulePruneLocalFontCacheIfNeeded(); |
254 | 254 |
255 bool shouldDrawImageAntialiased(const FloatRect& destRect) const; | 255 bool shouldDrawImageAntialiased(const FloatRect& destRect) const; |
256 | 256 |
257 template<typename DrawFunc, typename ContainsFunc> | 257 template<typename DrawFunc, typename ContainsFunc> |
258 bool draw(const DrawFunc&, const ContainsFunc&, const SkRect& bounds, Canvas RenderingContext2DState::PaintType, CanvasRenderingContext2DState::ImageType = C anvasRenderingContext2DState::NoImage); | 258 bool draw(const DrawFunc&, const ContainsFunc&, const SkRect& bounds, Canvas RenderingContext2DState::PaintType, CanvasRenderingContext2DState::ImageType = C anvasRenderingContext2DState::NoImage); |
259 void drawPathInternal(const Path&, CanvasRenderingContext2DState::PaintType, SkPath::FillType = SkPath::kWinding_FillType); | 259 void drawPathInternal(const Path&, CanvasRenderingContext2DState::PaintType, SkPath::FillType = SkPath::kWinding_FillType); |
260 void drawImageInternal(SkCanvas*, CanvasImageSource*, Image*, const FloatRec t& srcRect, const FloatRect& dstRect, const SkPaint*); | 260 void drawImageInternal(SkCanvas*, CanvasImageSource*, Image*, const FloatRec t& srcRect, const FloatRect& dstRect, const SkPaint*); |
261 void clipInternal(const Path&, const String& windingRuleString); | 261 void clipInternal(const Path&, const String& windingRuleString); |
262 | 262 |
263 bool isPointInPathInternal(const Path&, const float x, const float y, const String& windingRuleString); | 263 bool isPointInPathInternal(const Path&, const double x, const double y, cons t String& windingRuleString); |
264 bool isPointInStrokeInternal(const Path&, const float x, const float y); | 264 bool isPointInStrokeInternal(const Path&, const double x, const double y); |
265 | 265 |
266 void scrollPathIntoViewInternal(const Path&); | 266 void scrollPathIntoViewInternal(const Path&); |
267 | 267 |
268 void drawTextInternal(const String&, float x, float y, CanvasRenderingContex t2DState::PaintType, float* maxWidth = nullptr); | 268 void drawTextInternal(const String&, double x, double y, CanvasRenderingCont ext2DState::PaintType, double* maxWidth = nullptr); |
269 | 269 |
270 const Font& accessFont(); | 270 const Font& accessFont(); |
271 int getFontBaseline(const FontMetrics&) const; | 271 int getFontBaseline(const FontMetrics&) const; |
272 | 272 |
273 void clearCanvas(); | 273 void clearCanvas(); |
274 bool rectContainsTransformedRect(const FloatRect&, const SkIRect&) const; | 274 bool rectContainsTransformedRect(const FloatRect&, const SkIRect&) const; |
275 | 275 |
276 void inflateStrokeRect(FloatRect&) const; | 276 void inflateStrokeRect(FloatRect&) const; |
277 | 277 |
278 template<typename DrawFunc> | 278 template<typename DrawFunc> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 HashMap<String, Font> m_fontsResolvedUsingCurrentStyle; | 318 HashMap<String, Font> m_fontsResolvedUsingCurrentStyle; |
319 bool m_pruneLocalFontCacheScheduled; | 319 bool m_pruneLocalFontCacheScheduled; |
320 ListHashSet<String> m_fontLRUList; | 320 ListHashSet<String> m_fontLRUList; |
321 }; | 321 }; |
322 | 322 |
323 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); | 323 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); |
324 | 324 |
325 } // namespace blink | 325 } // namespace blink |
326 | 326 |
327 #endif // CanvasRenderingContext2D_h | 327 #endif // CanvasRenderingContext2D_h |
OLD | NEW |