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

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

Issue 1995733005: Fix 2D canvas state persistency after OffscreenCanvas.transferToImageBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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/parser/CSSParser.h" 10 #include "core/css/parser/CSSParser.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 m_stateStack.removeLast(); 85 m_stateStack.removeLast();
86 m_stateStack.last()->clearResolvedFilter(); 86 m_stateStack.last()->clearResolvedFilter();
87 m_path.transform(state().transform().inverse()); 87 m_path.transform(state().transform().inverse());
88 SkCanvas* c = drawingCanvas(); 88 SkCanvas* c = drawingCanvas();
89 if (c) 89 if (c)
90 c->restore(); 90 c->restore();
91 91
92 validateStateStack(); 92 validateStateStack();
93 } 93 }
94 94
95 void BaseRenderingContext2D::restoreMatrixClipStack(SkCanvas* c) const
96 {
97 if (!c)
98 return;
99 HeapVector<Member<CanvasRenderingContext2DState>>::const_iterator currState;
100 DCHECK(m_stateStack.begin() < m_stateStack.end());
101 for (currState = m_stateStack.begin(); currState < m_stateStack.end(); currS tate++) {
102 c->setMatrix(SkMatrix::I());
103 currState->get()->playbackClips(c);
104 c->setMatrix(affineTransformToSkMatrix(currState->get()->transform()));
105 c->save();
106 }
107 c->restore();
108 }
109
95 static inline void convertCanvasStyleToUnionType(CanvasStyle* style, StringOrCan vasGradientOrCanvasPattern& returnValue) 110 static inline void convertCanvasStyleToUnionType(CanvasStyle* style, StringOrCan vasGradientOrCanvasPattern& returnValue)
96 { 111 {
97 if (CanvasGradient* gradient = style->getCanvasGradient()) { 112 if (CanvasGradient* gradient = style->getCanvasGradient()) {
98 returnValue.setCanvasGradient(gradient); 113 returnValue.setCanvasGradient(gradient);
99 return; 114 return;
100 } 115 }
101 if (CanvasPattern* pattern = style->getCanvasPattern()) { 116 if (CanvasPattern* pattern = style->getCanvasPattern()) {
102 returnValue.setCanvasPattern(pattern); 117 returnValue.setCanvasPattern(pattern);
103 return; 118 return;
104 } 119 }
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 1401
1387 imageBuffer()->willOverwriteCanvas(); 1402 imageBuffer()->willOverwriteCanvas();
1388 } 1403 }
1389 1404
1390 DEFINE_TRACE(BaseRenderingContext2D) 1405 DEFINE_TRACE(BaseRenderingContext2D)
1391 { 1406 {
1392 visitor->trace(m_stateStack); 1407 visitor->trace(m_stateStack);
1393 } 1408 }
1394 1409
1395 } // namespace blink 1410 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698