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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 class Font; | 53 class Font; |
54 class FontMetrics; | 54 class FontMetrics; |
55 class HitRegion; | 55 class HitRegion; |
56 class HitRegionOptions; | 56 class HitRegionOptions; |
57 class HitRegionManager; | 57 class HitRegionManager; |
58 class HitTestCanvasResult; | 58 class HitTestCanvasResult; |
59 class Path2D; | 59 class Path2D; |
60 class SVGMatrixTearOff; | 60 class SVGMatrixTearOff; |
61 class TextMetrics; | 61 class TextMetrics; |
62 | 62 |
63 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmap Canva
sImageSourceUnion; | 63 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffs
creenCanvas CanvasImageSourceUnion; |
64 | 64 |
65 class MODULES_EXPORT CanvasRenderingContext2D final : public CanvasRenderingCont
ext, public BaseRenderingContext2D, public WebThread::TaskObserver, public SVGRe
sourceClient { | 65 class MODULES_EXPORT CanvasRenderingContext2D final : public CanvasRenderingCont
ext, public BaseRenderingContext2D, public WebThread::TaskObserver, public SVGRe
sourceClient { |
66 DEFINE_WRAPPERTYPEINFO(); | 66 DEFINE_WRAPPERTYPEINFO(); |
67 USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2D); | 67 USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2D); |
68 USING_PRE_FINALIZER(CanvasRenderingContext2D, dispose); | 68 USING_PRE_FINALIZER(CanvasRenderingContext2D, dispose); |
69 public: | 69 public: |
70 class Factory : public CanvasRenderingContextFactory { | 70 class Factory : public CanvasRenderingContextFactory { |
71 WTF_MAKE_NONCOPYABLE(Factory); | 71 WTF_MAKE_NONCOPYABLE(Factory); |
72 public: | 72 public: |
73 Factory() {} | 73 Factory() {} |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 AffineTransform baseTransform() const final; | 161 AffineTransform baseTransform() const final; |
162 void didDraw(const SkIRect& dirtyRect) final; | 162 void didDraw(const SkIRect& dirtyRect) final; |
163 | 163 |
164 bool stateHasFilter() final; | 164 bool stateHasFilter() final; |
165 SkImageFilter* stateGetFilter() final; | 165 SkImageFilter* stateGetFilter() final; |
166 void snapshotStateForFilter() final; | 166 void snapshotStateForFilter() final; |
167 | 167 |
168 void validateStateStack() final; | 168 void validateStateStack() final; |
169 | 169 |
| 170 PassRefPtr<Image> getImage(SnapshotReason) const final; |
| 171 |
170 bool isAccelerationOptimalForCanvasContent() const; | 172 bool isAccelerationOptimalForCanvasContent() const; |
171 | 173 |
172 void resetUsageTracking(); | 174 void resetUsageTracking(); |
173 | 175 |
174 void incrementFrameCount() { m_usageCounters.numFramesSinceReset++; }; | 176 void incrementFrameCount() { m_usageCounters.numFramesSinceReset++; } |
| 177 |
| 178 bool isPaintable() const final { return hasImageBuffer(); } |
175 | 179 |
176 private: | 180 private: |
177 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; | 181 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; |
178 | 182 |
179 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr
ibutes& attrs, Document&); | 183 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr
ibutes& attrs, Document&); |
180 | 184 |
181 void dispose(); | 185 void dispose(); |
182 | 186 |
183 void dispatchContextLostEvent(TimerBase*); | 187 void dispatchContextLostEvent(TimerBase*); |
184 void dispatchContextRestoredEvent(TimerBase*); | 188 void dispatchContextRestoredEvent(TimerBase*); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 LostContextMode m_contextLostMode; | 222 LostContextMode m_contextLostMode; |
219 bool m_contextRestorable; | 223 bool m_contextRestorable; |
220 unsigned m_tryRestoreContextAttemptCount; | 224 unsigned m_tryRestoreContextAttemptCount; |
221 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 225 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
222 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 226 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
223 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 227 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
224 | 228 |
225 HashMap<String, Font> m_fontsResolvedUsingCurrentStyle; | 229 HashMap<String, Font> m_fontsResolvedUsingCurrentStyle; |
226 bool m_pruneLocalFontCacheScheduled; | 230 bool m_pruneLocalFontCacheScheduled; |
227 ListHashSet<String> m_fontLRUList; | 231 ListHashSet<String> m_fontLRUList; |
228 | |
229 bool isPaintable() const final | |
230 { | |
231 NOTREACHED(); | |
232 return false; | |
233 } | |
234 }; | 232 }; |
235 | 233 |
236 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, | 234 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, |
237 context->is2d() && context->canvas(), context.is2d() && context.canvas()); | 235 context->is2d() && context->canvas(), context.is2d() && context.canvas()); |
238 | 236 |
239 } // namespace blink | 237 } // namespace blink |
240 | 238 |
241 #endif // CanvasRenderingContext2D_h | 239 #endif // CanvasRenderingContext2D_h |
OLD | NEW |