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

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: fix test Created 4 years, 6 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 m_stateStack.removeLast(); 86 m_stateStack.removeLast();
87 m_stateStack.last()->clearResolvedFilter(); 87 m_stateStack.last()->clearResolvedFilter();
88 m_path.transform(state().transform().inverse()); 88 m_path.transform(state().transform().inverse());
89 SkCanvas* c = drawingCanvas(); 89 SkCanvas* c = drawingCanvas();
90 if (c) 90 if (c)
91 c->restore(); 91 c->restore();
92 92
93 validateStateStack(); 93 validateStateStack();
94 } 94 }
95 95
96 void BaseRenderingContext2D::restoreMatrixClipStack(SkCanvas* c) const
97 {
98 if (!c)
99 return;
100 HeapVector<Member<CanvasRenderingContext2DState>>::const_iterator currState;
101 DCHECK(m_stateStack.begin() < m_stateStack.end());
102 for (currState = m_stateStack.begin(); currState < m_stateStack.end(); currS tate++) {
103 c->setMatrix(SkMatrix::I());
104 currState->get()->playbackClips(c);
105 c->setMatrix(affineTransformToSkMatrix(currState->get()->transform()));
106 c->save();
107 }
108 c->restore();
109 }
110
96 static inline void convertCanvasStyleToUnionType(CanvasStyle* style, StringOrCan vasGradientOrCanvasPattern& returnValue) 111 static inline void convertCanvasStyleToUnionType(CanvasStyle* style, StringOrCan vasGradientOrCanvasPattern& returnValue)
97 { 112 {
98 if (CanvasGradient* gradient = style->getCanvasGradient()) { 113 if (CanvasGradient* gradient = style->getCanvasGradient()) {
99 returnValue.setCanvasGradient(gradient); 114 returnValue.setCanvasGradient(gradient);
100 return; 115 return;
101 } 116 }
102 if (CanvasPattern* pattern = style->getCanvasPattern()) { 117 if (CanvasPattern* pattern = style->getCanvasPattern()) {
103 returnValue.setCanvasPattern(pattern); 118 returnValue.setCanvasPattern(pattern);
104 return; 119 return;
105 } 120 }
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 1482
1468 imageBuffer()->willOverwriteCanvas(); 1483 imageBuffer()->willOverwriteCanvas();
1469 } 1484 }
1470 1485
1471 DEFINE_TRACE(BaseRenderingContext2D) 1486 DEFINE_TRACE(BaseRenderingContext2D)
1472 { 1487 {
1473 visitor->trace(m_stateStack); 1488 visitor->trace(m_stateStack);
1474 } 1489 }
1475 1490
1476 } // namespace blink 1491 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698