| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 , m_hasAlpha(attrs.alpha()) | 124 , m_hasAlpha(attrs.alpha()) |
| 125 , m_contextLostMode(NotLostContext) | 125 , m_contextLostMode(NotLostContext) |
| 126 , m_contextRestorable(true) | 126 , m_contextRestorable(true) |
| 127 , m_tryRestoreContextAttemptCount(0) | 127 , m_tryRestoreContextAttemptCount(0) |
| 128 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) | 128 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) |
| 129 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) | 129 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) |
| 130 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) | 130 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) |
| 131 { | 131 { |
| 132 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) | 132 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) |
| 133 m_clipAntialiasing = AntiAliased; | 133 m_clipAntialiasing = AntiAliased; |
| 134 m_stateStack.append(adoptPtrWillBeNoop(new CanvasRenderingContext2DState()))
; | 134 m_stateStack.append(CanvasRenderingContext2DState::create()); |
| 135 setShouldAntialias(true); | 135 setShouldAntialias(true); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void CanvasRenderingContext2D::unwindStateStack() | 138 void CanvasRenderingContext2D::unwindStateStack() |
| 139 { | 139 { |
| 140 if (size_t stackSize = m_stateStack.size()) { | 140 if (size_t stackSize = m_stateStack.size()) { |
| 141 if (SkCanvas* skCanvas = canvas()->existingDrawingCanvas()) { | 141 if (SkCanvas* skCanvas = canvas()->existingDrawingCanvas()) { |
| 142 while (--stackSize) | 142 while (--stackSize) |
| 143 skCanvas->restore(); | 143 skCanvas->restore(); |
| 144 } | 144 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 RefPtrWillBeRawPtr<Event> event(Event::create(EventTypeNames::contextres
tored)); | 276 RefPtrWillBeRawPtr<Event> event(Event::create(EventTypeNames::contextres
tored)); |
| 277 canvas()->dispatchEvent(event); | 277 canvas()->dispatchEvent(event); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 void CanvasRenderingContext2D::reset() | 281 void CanvasRenderingContext2D::reset() |
| 282 { | 282 { |
| 283 validateStateStack(); | 283 validateStateStack(); |
| 284 unwindStateStack(); | 284 unwindStateStack(); |
| 285 m_stateStack.resize(1); | 285 m_stateStack.resize(1); |
| 286 m_stateStack.first() = adoptPtrWillBeNoop(new CanvasRenderingContext2DState(
)); | 286 m_stateStack.first() = CanvasRenderingContext2DState::create(); |
| 287 m_path.clear(); | 287 m_path.clear(); |
| 288 SkCanvas* c = canvas()->existingDrawingCanvas(); | 288 SkCanvas* c = canvas()->existingDrawingCanvas(); |
| 289 if (c) { | 289 if (c) { |
| 290 c->resetMatrix(); | 290 c->resetMatrix(); |
| 291 c->clipRect(SkRect::MakeWH(canvas()->width(), canvas()->height()), SkReg
ion::kReplace_Op); | 291 c->clipRect(SkRect::MakeWH(canvas()->width(), canvas()->height()), SkReg
ion::kReplace_Op); |
| 292 } | 292 } |
| 293 validateStateStack(); | 293 validateStateStack(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void CanvasRenderingContext2D::restoreCanvasMatrixClipStack() | 296 void CanvasRenderingContext2D::restoreCanvasMatrixClipStack() |
| (...skipping 13 matching lines...) Expand all Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 void CanvasRenderingContext2D::realizeSaves() | 312 void CanvasRenderingContext2D::realizeSaves() |
| 313 { | 313 { |
| 314 validateStateStack(); | 314 validateStateStack(); |
| 315 if (state().hasUnrealizedSaves()) { | 315 if (state().hasUnrealizedSaves()) { |
| 316 ASSERT(m_stateStack.size() >= 1); | 316 ASSERT(m_stateStack.size() >= 1); |
| 317 // Reduce the current state's unrealized count by one now, | 317 // Reduce the current state's unrealized count by one now, |
| 318 // to reflect the fact we are saving one state. | 318 // to reflect the fact we are saving one state. |
| 319 m_stateStack.last()->restore(); | 319 m_stateStack.last()->restore(); |
| 320 m_stateStack.append(adoptPtrWillBeNoop(new CanvasRenderingContext2DState
(state(), CanvasRenderingContext2DState::DontCopyClipList))); | 320 m_stateStack.append(CanvasRenderingContext2DState::create(state(), Canva
sRenderingContext2DState::DontCopyClipList)); |
| 321 // Set the new state's unrealized count to 0, because it has no outstand
ing saves. | 321 // Set the new state's unrealized count to 0, because it has no outstand
ing saves. |
| 322 // We need to do this explicitly because the copy constructor and operat
or= used | 322 // We need to do this explicitly because the copy constructor and operat
or= used |
| 323 // by the Vector operations copy the unrealized count from the previous
state (in | 323 // by the Vector operations copy the unrealized count from the previous
state (in |
| 324 // turn necessary to support correct resizing and unwinding of the stack
). | 324 // turn necessary to support correct resizing and unwinding of the stack
). |
| 325 m_stateStack.last()->resetUnrealizedSaveCount(); | 325 m_stateStack.last()->resetUnrealizedSaveCount(); |
| 326 SkCanvas* canvas = drawingCanvas(); | 326 SkCanvas* canvas = drawingCanvas(); |
| 327 if (canvas) | 327 if (canvas) |
| 328 canvas->save(); | 328 canvas->save(); |
| 329 validateStateStack(); | 329 validateStateStack(); |
| 330 } | 330 } |
| (...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) | 2237 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) |
| 2238 return; | 2238 return; |
| 2239 if (alpha < 0xFF) | 2239 if (alpha < 0xFF) |
| 2240 return; | 2240 return; |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 canvas()->buffer()->willOverwriteCanvas(); | 2243 canvas()->buffer()->willOverwriteCanvas(); |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 } // namespace blink | 2246 } // namespace blink |
| OLD | NEW |