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

Side by Side Diff: Source/platform/graphics/RecordingImageBufferSurface.cpp

Issue 661763003: Ensure canvas state is preserved when 2d canvas falls out of display list mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixup Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/canvas/canvas-unbalanced-save-expected.html ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 6
7 #include "platform/graphics/RecordingImageBufferSurface.h" 7 #include "platform/graphics/RecordingImageBufferSurface.h"
8 8
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/graphics/ImageBuffer.h" 10 #include "platform/graphics/ImageBuffer.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return; 81 return;
82 } 82 }
83 83
84 m_fallbackSurface = m_fallbackFactory->createSurface(size(), opacityMode()); 84 m_fallbackSurface = m_fallbackFactory->createSurface(size(), opacityMode());
85 m_fallbackSurface->setImageBuffer(m_imageBuffer); 85 m_fallbackSurface->setImageBuffer(m_imageBuffer);
86 86
87 if (m_previousFrame) { 87 if (m_previousFrame) {
88 m_previousFrame->draw(m_fallbackSurface->canvas()); 88 m_previousFrame->draw(m_fallbackSurface->canvas());
89 m_previousFrame.clear(); 89 m_previousFrame.clear();
90 } 90 }
91
91 if (m_currentFrame) { 92 if (m_currentFrame) {
93 bool savedState = false;
94 StateStack stateStack;
95 savedState = saveState(m_currentFrame->getRecordingCanvas(), &stateStack );
92 RefPtr<SkPicture> currentPicture = adoptRef(m_currentFrame->endRecording ()); 96 RefPtr<SkPicture> currentPicture = adoptRef(m_currentFrame->endRecording ());
93 currentPicture->draw(m_fallbackSurface->canvas()); 97 currentPicture->draw(m_fallbackSurface->canvas());
94 m_currentFrame.clear(); 98 m_currentFrame.clear();
99 if (savedState)
100 setCurrentState(m_fallbackSurface->canvas(), &stateStack);
95 } 101 }
96 102
97 if (m_imageBuffer) { 103 if (m_imageBuffer) {
98 m_imageBuffer->context()->setRegionTrackingMode(GraphicsContext::RegionT rackingDisabled); 104 m_imageBuffer->context()->setRegionTrackingMode(GraphicsContext::RegionT rackingDisabled);
99 m_imageBuffer->context()->resetCanvas(m_fallbackSurface->canvas()); 105 m_imageBuffer->context()->resetCanvas(m_fallbackSurface->canvas());
100 } 106 }
101 } 107 }
102 108
103 SkCanvas* RecordingImageBufferSurface::canvas() const 109 SkCanvas* RecordingImageBufferSurface::canvas() const
104 { 110 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 286
281 void RecordingImageBufferSurface::setIsHidden(bool hidden) 287 void RecordingImageBufferSurface::setIsHidden(bool hidden)
282 { 288 {
283 if (m_fallbackSurface) 289 if (m_fallbackSurface)
284 m_fallbackSurface->setIsHidden(hidden); 290 m_fallbackSurface->setIsHidden(hidden);
285 else 291 else
286 ImageBufferSurface::setIsHidden(hidden); 292 ImageBufferSurface::setIsHidden(hidden);
287 } 293 }
288 294
289 } // namespace blink 295 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-unbalanced-save-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698