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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 void scrollPathIntoView(); | 156 void scrollPathIntoView(); |
157 void scrollPathIntoView(Path2D*); | 157 void scrollPathIntoView(Path2D*); |
158 | 158 |
159 void clearRect(float x, float y, float width, float height); | 159 void clearRect(float x, float y, float width, float height); |
160 void fillRect(float x, float y, float width, float height); | 160 void fillRect(float x, float y, float width, float height); |
161 void strokeRect(float x, float y, float width, float height); | 161 void strokeRect(float x, float y, float width, float height); |
162 | 162 |
163 void drawImage(const CanvasImageSourceUnion&, float x, float y, ExceptionSta te&); | 163 void drawImage(const CanvasImageSourceUnion&, float x, float y, ExceptionSta te&); |
164 void drawImage(const CanvasImageSourceUnion&, float x, float y, float width, float height, ExceptionState&); | 164 void drawImage(const CanvasImageSourceUnion&, float x, float y, float width, float height, ExceptionState&); |
165 void drawImage(const CanvasImageSourceUnion&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&); | 165 void drawImage(const CanvasImageSourceUnion&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&); |
166 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&); | |
dshwang
2015/02/11 08:37:52
why does it become public? I guess it's for unitte
Justin Novosad
2015/02/11 18:59:54
Yes it is for testing purposes. The problem is tha
| |
166 | 167 |
167 PassRefPtrWillBeRawPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1); | 168 PassRefPtrWillBeRawPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1); |
168 PassRefPtrWillBeRawPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState&); | 169 PassRefPtrWillBeRawPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState&); |
169 PassRefPtrWillBeRawPtr<CanvasPattern> createPattern(const CanvasImageSourceU nion&, const String& repetitionType, ExceptionState&); | 170 PassRefPtrWillBeRawPtr<CanvasPattern> createPattern(const CanvasImageSourceU nion&, const String& repetitionType, ExceptionState&); |
170 | 171 |
171 PassRefPtrWillBeRawPtr<ImageData> createImageData(PassRefPtrWillBeRawPtr<Ima geData>) const; | 172 PassRefPtrWillBeRawPtr<ImageData> createImageData(PassRefPtrWillBeRawPtr<Ima geData>) const; |
172 PassRefPtrWillBeRawPtr<ImageData> createImageData(float width, float height, ExceptionState&) const; | 173 PassRefPtrWillBeRawPtr<ImageData> createImageData(float width, float height, ExceptionState&) const; |
173 PassRefPtrWillBeRawPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionState&) const; | 174 PassRefPtrWillBeRawPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionState&) const; |
174 void putImageData(ImageData*, float dx, float dy); | 175 void putImageData(ImageData*, float dx, float dy); |
175 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight); | 176 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 // Text state. | 269 // Text state. |
269 TextAlign m_textAlign; | 270 TextAlign m_textAlign; |
270 TextBaseline m_textBaseline; | 271 TextBaseline m_textBaseline; |
271 Direction m_direction; | 272 Direction m_direction; |
272 | 273 |
273 String m_unparsedFont; | 274 String m_unparsedFont; |
274 Font m_font; | 275 Font m_font; |
275 bool m_realizedFont; | 276 bool m_realizedFont; |
276 | 277 |
277 bool m_hasClip; | 278 bool m_hasClip; |
279 bool m_hasComplexClip; | |
278 | 280 |
279 ClipList m_clipList; | 281 ClipList m_clipList; |
280 }; | 282 }; |
281 | 283 |
282 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&); | 284 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&); |
283 | 285 |
284 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m _stateStack.last(); } | 286 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m _stateStack.last(); } |
285 const State& state() const { return *m_stateStack.last(); } | 287 const State& state() const { return *m_stateStack.last(); } |
286 | 288 |
287 void applyLineDash() const; | 289 void applyLineDash() const; |
(...skipping 11 matching lines...) Expand all Loading... | |
299 | 301 |
300 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas | 302 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas |
301 SkCanvas* drawingCanvas() const; | 303 SkCanvas* drawingCanvas() const; |
302 | 304 |
303 void unwindStateStack(); | 305 void unwindStateStack(); |
304 void realizeSaves(SkCanvas*); | 306 void realizeSaves(SkCanvas*); |
305 | 307 |
306 void applyStrokePattern(); | 308 void applyStrokePattern(); |
307 void applyFillPattern(); | 309 void applyFillPattern(); |
308 | 310 |
309 void drawImageInternal(CanvasImageSource*, float sx, float sy, float sw, flo at sh, float dx, float dy, float dw, float dh, ExceptionState&); | |
310 | |
311 void fillInternal(const Path&, const String& windingRuleString); | 311 void fillInternal(const Path&, const String& windingRuleString); |
312 void strokeInternal(const Path&); | 312 void strokeInternal(const Path&); |
313 void clipInternal(const Path&, const String& windingRuleString); | 313 void clipInternal(const Path&, const String& windingRuleString); |
314 | 314 |
315 bool isPointInPathInternal(const Path&, const float x, const float y, const String& windingRuleString); | 315 bool isPointInPathInternal(const Path&, const float x, const float y, const String& windingRuleString); |
316 bool isPointInStrokeInternal(const Path&, const float x, const float y); | 316 bool isPointInStrokeInternal(const Path&, const float x, const float y); |
317 | 317 |
318 void scrollPathIntoViewInternal(const Path&); | 318 void scrollPathIntoViewInternal(const Path&); |
319 | 319 |
320 void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false); | 320 void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false); |
321 | 321 |
322 const Font& accessFont(); | 322 const Font& accessFont(); |
323 int getFontBaseline(const FontMetrics&) const; | 323 int getFontBaseline(const FontMetrics&) const; |
324 | 324 |
325 void clearCanvas(); | 325 void clearCanvas(); |
326 bool rectContainsTransformedRect(const FloatRect&, const FloatRect&) const; | 326 bool rectContainsTransformedRect(const FloatRect&, const FloatRect&) const; |
327 | 327 |
328 void inflateStrokeRect(FloatRect&) const; | 328 void inflateStrokeRect(FloatRect&) const; |
329 | 329 |
330 void fullCanvasCompositedDraw(PassOwnPtr<Closure> draw); | 330 void fullCanvasCompositedDraw(PassOwnPtr<Closure> draw); |
331 | 331 |
332 void drawFocusIfNeededInternal(const Path&, Element*); | 332 void drawFocusIfNeededInternal(const Path&, Element*); |
333 bool focusRingCallIsValid(const Path&, Element*); | 333 bool focusRingCallIsValid(const Path&, Element*); |
334 void drawFocusRing(const Path&); | 334 void drawFocusRing(const Path&); |
335 | 335 |
336 bool hasClip() { return state().m_hasClip; } | 336 bool hasClip() { return state().m_hasClip; } |
337 | 337 |
338 void validateStateStack(); | 338 void validateStateStack(); |
339 | 339 |
340 enum DrawType { | |
341 ClipFill, // Fill that is already known to cover the current clip | |
342 UntransformedUnclippedFill | |
343 }; | |
344 | |
345 enum ImageType { | |
346 NoImage, | |
347 OpaqueImage, | |
348 NonOpaqueImage | |
349 }; | |
350 | |
351 void checkOverdraw(const SkRect&, const SkPaint*, ImageType, DrawType); | |
352 | |
340 virtual bool is2d() const override { return true; } | 353 virtual bool is2d() const override { return true; } |
341 virtual bool isAccelerated() const override; | 354 virtual bool isAccelerated() const override; |
342 virtual bool hasAlpha() const override { return m_hasAlpha; } | 355 virtual bool hasAlpha() const override { return m_hasAlpha; } |
343 virtual void setIsHidden(bool) override; | 356 virtual void setIsHidden(bool) override; |
344 | 357 |
345 virtual bool isTransformInvertible() const override { return state().m_inver tibleCTM; } | 358 virtual bool isTransformInvertible() const override { return state().m_inver tibleCTM; } |
346 | 359 |
347 virtual WebLayer* platformLayer() const override; | 360 virtual WebLayer* platformLayer() const override; |
348 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp tr) const; | 361 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp tr) const; |
349 | 362 |
(...skipping 10 matching lines...) Expand all Loading... | |
360 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 373 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
361 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 374 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
362 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 375 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
363 }; | 376 }; |
364 | 377 |
365 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); | 378 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); |
366 | 379 |
367 } // namespace blink | 380 } // namespace blink |
368 | 381 |
369 #endif // CanvasRenderingContext2D_h | 382 #endif // CanvasRenderingContext2D_h |
OLD | NEW |