| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |