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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 RefPtrWillBeMember<CanvasStyle> m_fillStyle; | 271 RefPtrWillBeMember<CanvasStyle> m_fillStyle; |
272 float m_lineWidth; | 272 float m_lineWidth; |
273 LineCap m_lineCap; | 273 LineCap m_lineCap; |
274 LineJoin m_lineJoin; | 274 LineJoin m_lineJoin; |
275 float m_miterLimit; | 275 float m_miterLimit; |
276 FloatSize m_shadowOffset; | 276 FloatSize m_shadowOffset; |
277 float m_shadowBlur; | 277 float m_shadowBlur; |
278 RGBA32 m_shadowColor; | 278 RGBA32 m_shadowColor; |
279 float m_globalAlpha; | 279 float m_globalAlpha; |
280 CompositeOperator m_globalComposite; | 280 CompositeOperator m_globalComposite; |
281 blink::WebBlendMode m_globalBlend; | 281 WebBlendMode m_globalBlend; |
282 AffineTransform m_transform; | 282 AffineTransform m_transform; |
283 bool m_invertibleCTM; | 283 bool m_invertibleCTM; |
284 Vector<float> m_lineDash; | 284 Vector<float> m_lineDash; |
285 float m_lineDashOffset; | 285 float m_lineDashOffset; |
286 bool m_imageSmoothingEnabled; | 286 bool m_imageSmoothingEnabled; |
287 | 287 |
288 // Text state. | 288 // Text state. |
289 TextAlign m_textAlign; | 289 TextAlign m_textAlign; |
290 TextBaseline m_textBaseline; | 290 TextBaseline m_textBaseline; |
291 Direction m_direction; | 291 Direction m_direction; |
(...skipping 24 matching lines...) Expand all Loading... |
316 void didDraw(const FloatRect&); | 316 void didDraw(const FloatRect&); |
317 | 317 |
318 GraphicsContext* drawingContext() const; | 318 GraphicsContext* drawingContext() const; |
319 | 319 |
320 void unwindStateStack(); | 320 void unwindStateStack(); |
321 void realizeSaves(GraphicsContext*); | 321 void realizeSaves(GraphicsContext*); |
322 | 322 |
323 void applyStrokePattern(); | 323 void applyStrokePattern(); |
324 void applyFillPattern(); | 324 void applyFillPattern(); |
325 | 325 |
326 void drawImageInternal(CanvasImageSource*, float sx, float sy, float sw, flo
at sh, float dx, float dy, float dw, float dh, ExceptionState&, CompositeOperato
r, blink::WebBlendMode, GraphicsContext* = 0); | 326 void drawImageInternal(CanvasImageSource*, float sx, float sy, float sw, flo
at sh, float dx, float dy, float dw, float dh, ExceptionState&); |
327 void drawVideo(HTMLVideoElement*, FloatRect srcRect, FloatRect dstRect); | 327 void drawVideo(HTMLVideoElement*, FloatRect srcRect, FloatRect dstRect); |
328 | 328 |
329 void fillInternal(const Path&, const String& windingRuleString); | 329 void fillInternal(const Path&, const String& windingRuleString); |
330 void strokeInternal(const Path&); | 330 void strokeInternal(const Path&); |
331 void clipInternal(const Path&, const String& windingRuleString); | 331 void clipInternal(const Path&, const String& windingRuleString); |
332 | 332 |
333 bool isPointInPathInternal(const Path&, const float x, const float y, const
String& windingRuleString); | 333 bool isPointInPathInternal(const Path&, const float x, const float y, const
String& windingRuleString); |
334 bool isPointInStrokeInternal(const Path&, const float x, const float y); | 334 bool isPointInStrokeInternal(const Path&, const float x, const float y); |
335 | 335 |
336 void scrollPathIntoViewInternal(const Path&); | 336 void scrollPathIntoViewInternal(const Path&); |
337 | 337 |
338 void drawTextInternal(const String& text, float x, float y, bool fill, float
maxWidth = 0, bool useMaxWidth = false); | 338 void drawTextInternal(const String& text, float x, float y, bool fill, float
maxWidth = 0, bool useMaxWidth = false); |
339 | 339 |
340 const Font& accessFont(); | 340 const Font& accessFont(); |
341 int getFontBaseline(const FontMetrics&) const; | 341 int getFontBaseline(const FontMetrics&) const; |
342 | 342 |
343 void clearCanvas(); | 343 void clearCanvas(); |
344 bool rectContainsTransformedRect(const FloatRect&, const FloatRect&) const; | 344 bool rectContainsTransformedRect(const FloatRect&, const FloatRect&) const; |
345 | 345 |
346 void inflateStrokeRect(FloatRect&) const; | 346 void inflateStrokeRect(FloatRect&) const; |
347 | 347 |
348 template<class T> void fullCanvasCompositedFill(const T&); | 348 enum DrawingType { Fill, Stroke }; |
349 template<class T> void fullCanvasCompositedStroke(const T&); | 349 template<DrawingType drawingType, class T> void fullCanvasCompositedDraw(con
st T&); |
350 | 350 |
351 void drawFocusIfNeededInternal(const Path&, Element*); | 351 void drawFocusIfNeededInternal(const Path&, Element*); |
352 bool focusRingCallIsValid(const Path&, Element*); | 352 bool focusRingCallIsValid(const Path&, Element*); |
353 void drawFocusRing(const Path&); | 353 void drawFocusRing(const Path&); |
354 | 354 |
355 bool hasClip() { return state().m_hasClip; } | 355 bool hasClip() { return state().m_hasClip; } |
356 | 356 |
357 void validateStateStack(); | 357 void validateStateStack(); |
358 | 358 |
359 virtual bool is2d() const override { return true; } | 359 virtual bool is2d() const override { return true; } |
360 virtual bool isAccelerated() const override; | 360 virtual bool isAccelerated() const override; |
361 virtual bool hasAlpha() const override { return m_hasAlpha; } | 361 virtual bool hasAlpha() const override { return m_hasAlpha; } |
362 virtual void setIsHidden(bool) override; | 362 virtual void setIsHidden(bool) override; |
363 | 363 |
364 virtual bool isTransformInvertible() const override { return state().m_inver
tibleCTM; } | 364 virtual bool isTransformInvertible() const override { return state().m_inver
tibleCTM; } |
365 | 365 |
366 virtual blink::WebLayer* platformLayer() const override; | 366 virtual WebLayer* platformLayer() const override; |
367 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp
tr) const; | 367 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp
tr) const; |
368 | 368 |
369 WillBeHeapVector<OwnPtrWillBeMember<State> > m_stateStack; | 369 WillBeHeapVector<OwnPtrWillBeMember<State> > m_stateStack; |
370 OwnPtrWillBeMember<HitRegionManager> m_hitRegionManager; | 370 OwnPtrWillBeMember<HitRegionManager> m_hitRegionManager; |
371 bool m_usesCSSCompatibilityParseMode; | 371 bool m_usesCSSCompatibilityParseMode; |
372 bool m_hasAlpha; | 372 bool m_hasAlpha; |
373 bool m_isContextLost; | 373 bool m_isContextLost; |
374 bool m_contextRestorable; | 374 bool m_contextRestorable; |
375 Canvas2DContextStorage m_storageMode; | 375 Canvas2DContextStorage m_storageMode; |
376 MutableStylePropertyMap m_fetchedFonts; | 376 MutableStylePropertyMap m_fetchedFonts; |
377 ListHashSet<String> m_fetchedFontsLRUList; | 377 ListHashSet<String> m_fetchedFontsLRUList; |
378 unsigned m_tryRestoreContextAttemptCount; | 378 unsigned m_tryRestoreContextAttemptCount; |
379 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 379 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
380 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 380 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
381 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 381 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
382 }; | 382 }; |
383 | 383 |
384 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 384 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
385 | 385 |
386 } // namespace blink | 386 } // namespace blink |
387 | 387 |
388 #endif // CanvasRenderingContext2D_h | 388 #endif // CanvasRenderingContext2D_h |
OLD | NEW |