Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1120)

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp

Issue 2610183002: Adding null pointer check in BaseRenderingContext2D::restoreMatrixClipStack (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/canvas2d/BaseRenderingContext2D.h" 5 #include "modules/canvas2d/BaseRenderingContext2D.h"
6 6
7 #include "bindings/core/v8/ExceptionMessages.h" 7 #include "bindings/core/v8/ExceptionMessages.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 9 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
10 #include "core/css/cssom/CSSURLImageValue.h" 10 #include "core/css/cssom/CSSURLImageValue.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 validateStateStack(); 91 validateStateStack();
92 } 92 }
93 93
94 void BaseRenderingContext2D::restoreMatrixClipStack(SkCanvas* c) const { 94 void BaseRenderingContext2D::restoreMatrixClipStack(SkCanvas* c) const {
95 if (!c) 95 if (!c)
96 return; 96 return;
97 HeapVector<Member<CanvasRenderingContext2DState>>::const_iterator currState; 97 HeapVector<Member<CanvasRenderingContext2DState>>::const_iterator currState;
98 DCHECK(m_stateStack.begin() < m_stateStack.end()); 98 DCHECK(m_stateStack.begin() < m_stateStack.end());
99 for (currState = m_stateStack.begin(); currState < m_stateStack.end(); 99 for (currState = m_stateStack.begin(); currState < m_stateStack.end();
100 currState++) { 100 currState++) {
101 CHECK(currState->get());
102 c->setMatrix(SkMatrix::I()); 101 c->setMatrix(SkMatrix::I());
103 currState->get()->playbackClips(c); 102 if (currState->get()) {
104 c->setMatrix(affineTransformToSkMatrix(currState->get()->transform())); 103 currState->get()->playbackClips(c);
104 c->setMatrix(affineTransformToSkMatrix(currState->get()->transform()));
105 }
105 c->save(); 106 c->save();
106 } 107 }
107 c->restore(); 108 c->restore();
108 validateStateStack(); 109 validateStateStack();
109 } 110 }
110 111
111 void BaseRenderingContext2D::unwindStateStack() { 112 void BaseRenderingContext2D::unwindStateStack() {
112 if (size_t stackSize = m_stateStack.size()) { 113 if (size_t stackSize = m_stateStack.size()) {
113 if (SkCanvas* skCanvas = existingDrawingCanvas()) { 114 if (SkCanvas* skCanvas = existingDrawingCanvas()) {
114 while (--stackSize) 115 while (--stackSize)
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * 2014 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] *
2014 m_usageCounters.numBlurredShadows + 2015 m_usageCounters.numBlurredShadows +
2015 ExpensiveCanvasHeuristicParameters:: 2016 ExpensiveCanvasHeuristicParameters::
2016 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * 2017 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] *
2017 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; 2018 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared;
2018 2019
2019 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; 2020 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment;
2020 } 2021 }
2021 2022
2022 } // namespace blink 2023 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698