OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
10 * | 10 * |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // legacy synchronous context restoration. | 156 // legacy synchronous context restoration. |
157 reset(); | 157 reset(); |
158 m_isContextLost = false; | 158 m_isContextLost = false; |
159 } | 159 } |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 void CanvasRenderingContext2D::dispatchContextLostEvent(Timer<CanvasRenderingCon
text2D>*) | 163 void CanvasRenderingContext2D::dispatchContextLostEvent(Timer<CanvasRenderingCon
text2D>*) |
164 { | 164 { |
165 if (contextLostRestoredEventsEnabled()) { | 165 if (contextLostRestoredEventsEnabled()) { |
166 RefPtr<Event> event(Event::createCancelable(EventTypeNames::contextlost)
); | 166 RefPtrWillBeRawPtr<Event> event = Event::createCancelable(EventTypeNames
::contextlost); |
167 canvas()->dispatchEvent(event); | 167 canvas()->dispatchEvent(event); |
168 if (event->defaultPrevented()) { | 168 if (event->defaultPrevented()) { |
169 m_contextRestorable = false; | 169 m_contextRestorable = false; |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 // If an image buffer is present, it means the context was not lost due to | 173 // If an image buffer is present, it means the context was not lost due to |
174 // an eviction, but rather due to a surface failure (gpu context lost?) | 174 // an eviction, but rather due to a surface failure (gpu context lost?) |
175 if (m_contextRestorable && canvas()->hasImageBuffer()) { | 175 if (m_contextRestorable && canvas()->hasImageBuffer()) { |
176 m_tryRestoreContextAttemptCount = 0; | 176 m_tryRestoreContextAttemptCount = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 void CanvasRenderingContext2D::dispatchContextRestoredEvent(Timer<CanvasRenderin
gContext2D>*) | 204 void CanvasRenderingContext2D::dispatchContextRestoredEvent(Timer<CanvasRenderin
gContext2D>*) |
205 { | 205 { |
206 if (!m_isContextLost) | 206 if (!m_isContextLost) |
207 return; | 207 return; |
208 reset(); | 208 reset(); |
209 m_isContextLost = false; | 209 m_isContextLost = false; |
210 if (contextLostRestoredEventsEnabled()) { | 210 if (contextLostRestoredEventsEnabled()) { |
211 RefPtr<Event> event(Event::create(EventTypeNames::contextrestored)); | 211 RefPtrWillBeRawPtr<Event> event(Event::create(EventTypeNames::contextres
tored)); |
212 canvas()->dispatchEvent(event); | 212 canvas()->dispatchEvent(event); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 void CanvasRenderingContext2D::reset() | 216 void CanvasRenderingContext2D::reset() |
217 { | 217 { |
218 unwindStateStack(); | 218 unwindStateStack(); |
219 m_stateStack.resize(1); | 219 m_stateStack.resize(1); |
220 m_stateStack.first() = adoptPtrWillBeNoop(new State()); | 220 m_stateStack.first() = adoptPtrWillBeNoop(new State()); |
221 m_path.clear(); | 221 m_path.clear(); |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 c->setAlphaAsFloat(1.0); | 2441 c->setAlphaAsFloat(1.0); |
2442 c->clearShadow(); | 2442 c->clearShadow(); |
2443 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); | 2443 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); |
2444 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2444 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
2445 c->restore(); | 2445 c->restore(); |
2446 | 2446 |
2447 didDraw(dirtyRect); | 2447 didDraw(dirtyRect); |
2448 } | 2448 } |
2449 | 2449 |
2450 } // namespace WebCore | 2450 } // namespace WebCore |
OLD | NEW |