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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef CanvasRenderingContext2D_h | 26 #ifndef CanvasRenderingContext2D_h |
27 #define CanvasRenderingContext2D_h | 27 #define CanvasRenderingContext2D_h |
28 | 28 |
29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
30 #include "bindings/core/v8/UnionTypesCore.h" | 30 #include "bindings/core/v8/UnionTypesCore.h" |
31 #include "core/html/canvas/Canvas2DContextAttributes.h" | 31 #include "core/html/canvas/Canvas2DContextAttributes.h" |
32 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 32 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
33 #include "core/html/canvas/CanvasPathMethods.h" | 33 #include "core/html/canvas/CanvasPathMethods.h" |
34 #include "core/html/canvas/CanvasRenderingContext.h" | 34 #include "core/html/canvas/CanvasRenderingContext.h" |
| 35 #include "core/html/canvas/CanvasRenderingContext2DState.h" |
35 #include "platform/graphics/GraphicsTypes.h" | 36 #include "platform/graphics/GraphicsTypes.h" |
36 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
37 #include "wtf/ListHashSet.h" | 38 #include "wtf/ListHashSet.h" |
38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
40 | 41 |
41 namespace blink { class WebLayer; } | 42 namespace blink { class WebLayer; } |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class CanvasImageSource; | 46 class CanvasImageSource; |
46 class CanvasRenderingContext2DState; | |
47 class Element; | 47 class Element; |
48 class ExceptionState; | 48 class ExceptionState; |
49 class FloatRect; | 49 class FloatRect; |
50 class FloatSize; | 50 class FloatSize; |
51 class Font; | 51 class Font; |
52 class FontMetrics; | 52 class FontMetrics; |
53 class HitRegion; | 53 class HitRegion; |
54 class HitRegionOptions; | 54 class HitRegionOptions; |
55 class HitRegionManager; | 55 class HitRegionManager; |
56 class ImageData; | 56 class ImageData; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; | 216 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; |
217 | 217 |
218 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr
ibutes& attrs, Document&); | 218 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr
ibutes& attrs, Document&); |
219 | 219 |
220 CanvasRenderingContext2DState& modifiableState(); | 220 CanvasRenderingContext2DState& modifiableState(); |
221 const CanvasRenderingContext2DState& state() const { return *m_stateStack.la
st(); } | 221 const CanvasRenderingContext2DState& state() const { return *m_stateStack.la
st(); } |
222 | 222 |
223 void applyLineDash() const; | 223 void applyLineDash() const; |
224 void setShadow(const FloatSize& offset, float blur, RGBA32 color); | 224 void setShadow(const FloatSize& offset, float blur, RGBA32 color); |
225 void applyShadow(ShadowMode = DrawShadowAndForeground); | 225 void applyShadow(ShadowMode = DrawShadowAndForeground); |
226 bool shouldDrawShadows() const; | |
227 | 226 |
228 void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*); | 227 void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*); |
229 void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*); | 228 void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*); |
230 void tryRestoreContextEvent(Timer<CanvasRenderingContext2D>*); | 229 void tryRestoreContextEvent(Timer<CanvasRenderingContext2D>*); |
231 | 230 |
232 bool computeDirtyRect(const FloatRect& localBounds, SkIRect*); | 231 bool computeDirtyRect(const FloatRect& localBounds, SkIRect*); |
233 bool computeDirtyRect(const FloatRect& localBounds, const SkIRect& transform
edClipBounds, SkIRect*); | 232 bool computeDirtyRect(const FloatRect& localBounds, const SkIRect& transform
edClipBounds, SkIRect*); |
234 void didDraw(const SkIRect&); | 233 void didDraw(const SkIRect&); |
235 | 234 |
236 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas | 235 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas |
(...skipping 17 matching lines...) Expand all Loading... |
254 void drawTextInternal(const String& text, float x, float y, bool fill, float
maxWidth = 0, bool useMaxWidth = false); | 253 void drawTextInternal(const String& text, float x, float y, bool fill, float
maxWidth = 0, bool useMaxWidth = false); |
255 | 254 |
256 const Font& accessFont(); | 255 const Font& accessFont(); |
257 int getFontBaseline(const FontMetrics&) const; | 256 int getFontBaseline(const FontMetrics&) const; |
258 | 257 |
259 void clearCanvas(); | 258 void clearCanvas(); |
260 bool rectContainsTransformedRect(const FloatRect&, const SkIRect&) const; | 259 bool rectContainsTransformedRect(const FloatRect&, const SkIRect&) const; |
261 | 260 |
262 void inflateStrokeRect(FloatRect&) const; | 261 void inflateStrokeRect(FloatRect&) const; |
263 | 262 |
264 void fullCanvasCompositedDraw(PassOwnPtr<Closure> draw); | 263 void fullCanvasCompositedDraw(PassOwnPtr<Closure> draw); // deprecated |
| 264 void fullCanvasCompositedDraw(PassOwnPtr<Function<void(SkCanvas*, const SkPa
int*)>>, CanvasRenderingContext2DState::PaintType, OpacityMode bitmapOpacity); |
265 | 265 |
266 void drawFocusIfNeededInternal(const Path&, Element*); | 266 void drawFocusIfNeededInternal(const Path&, Element*); |
267 bool focusRingCallIsValid(const Path&, Element*); | 267 bool focusRingCallIsValid(const Path&, Element*); |
268 void drawFocusRing(const Path&); | 268 void drawFocusRing(const Path&); |
269 void updateFocusRingElementAccessibility(const Path&, Element*); | 269 void updateFocusRingElementAccessibility(const Path&, Element*); |
270 | 270 |
271 void validateStateStack(); | 271 void validateStateStack(); |
272 | 272 |
273 enum DrawType { | 273 enum DrawType { |
274 ClipFill, // Fill that is already known to cover the current clip | 274 ClipFill, // Fill that is already known to cover the current clip |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 307 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
308 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 308 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
309 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 309 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
310 }; | 310 }; |
311 | 311 |
312 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 312 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
313 | 313 |
314 } // namespace blink | 314 } // namespace blink |
315 | 315 |
316 #endif // CanvasRenderingContext2D_h | 316 #endif // CanvasRenderingContext2D_h |
OLD | NEW |