| 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 27 matching lines...) Expand all Loading... |
| 38 m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas()); | 38 m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas()); |
| 39 } | 39 } |
| 40 m_didRecordDrawCommandsInCurrentFrame = false; | 40 m_didRecordDrawCommandsInCurrentFrame = false; |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void RecordingImageBufferSurface::setImageBuffer(ImageBuffer* imageBuffer) | 44 void RecordingImageBufferSurface::setImageBuffer(ImageBuffer* imageBuffer) |
| 45 { | 45 { |
| 46 m_imageBuffer = imageBuffer; | 46 m_imageBuffer = imageBuffer; |
| 47 if (m_currentFrame && m_imageBuffer) { | 47 if (m_currentFrame && m_imageBuffer) { |
| 48 m_imageBuffer->context()->setClient(this); | |
| 49 m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas()); | 48 m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas()); |
| 50 } | 49 } |
| 51 if (m_fallbackSurface) { | 50 if (m_fallbackSurface) { |
| 52 m_fallbackSurface->setImageBuffer(imageBuffer); | 51 m_fallbackSurface->setImageBuffer(imageBuffer); |
| 53 m_imageBuffer->context()->setClient(0); | |
| 54 } | 52 } |
| 55 } | 53 } |
| 56 | 54 |
| 57 void RecordingImageBufferSurface::willAccessPixels() | 55 void RecordingImageBufferSurface::willAccessPixels() |
| 58 { | 56 { |
| 59 if (m_fallbackSurface) | 57 if (m_fallbackSurface) |
| 60 m_fallbackSurface->willAccessPixels(); | 58 m_fallbackSurface->willAccessPixels(); |
| 61 else | 59 else |
| 62 fallBackToRasterCanvas(); | 60 fallBackToRasterCanvas(); |
| 63 } | 61 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 m_previousFrame.clear(); | 75 m_previousFrame.clear(); |
| 78 } | 76 } |
| 79 | 77 |
| 80 if (m_currentFrame) { | 78 if (m_currentFrame) { |
| 81 RefPtr<SkPicture> currentPicture = adoptRef(m_currentFrame->endRecording
()); | 79 RefPtr<SkPicture> currentPicture = adoptRef(m_currentFrame->endRecording
()); |
| 82 currentPicture->playback(m_fallbackSurface->canvas()); | 80 currentPicture->playback(m_fallbackSurface->canvas()); |
| 83 m_currentFrame.clear(); | 81 m_currentFrame.clear(); |
| 84 } | 82 } |
| 85 | 83 |
| 86 if (m_imageBuffer) { | 84 if (m_imageBuffer) { |
| 87 m_imageBuffer->context()->setClient(0); | |
| 88 m_imageBuffer->resetCanvas(m_fallbackSurface->canvas()); | 85 m_imageBuffer->resetCanvas(m_fallbackSurface->canvas()); |
| 89 m_imageBuffer->context()->setAccelerated(m_fallbackSurface->isAccelerate
d()); | 86 m_imageBuffer->context()->setAccelerated(m_fallbackSurface->isAccelerate
d()); |
| 90 } | 87 } |
| 91 | 88 |
| 92 } | 89 } |
| 93 | 90 |
| 94 PassRefPtr<SkImage> RecordingImageBufferSurface::newImageSnapshot() const | 91 PassRefPtr<SkImage> RecordingImageBufferSurface::newImageSnapshot() const |
| 95 { | 92 { |
| 96 if (!m_fallbackSurface) | 93 if (!m_fallbackSurface) |
| 97 const_cast<RecordingImageBufferSurface*>(this)->fallBackToRasterCanvas()
; | 94 const_cast<RecordingImageBufferSurface*>(this)->fallBackToRasterCanvas()
; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 265 |
| 269 void RecordingImageBufferSurface::setIsHidden(bool hidden) | 266 void RecordingImageBufferSurface::setIsHidden(bool hidden) |
| 270 { | 267 { |
| 271 if (m_fallbackSurface) | 268 if (m_fallbackSurface) |
| 272 m_fallbackSurface->setIsHidden(hidden); | 269 m_fallbackSurface->setIsHidden(hidden); |
| 273 else | 270 else |
| 274 ImageBufferSurface::setIsHidden(hidden); | 271 ImageBufferSurface::setIsHidden(hidden); |
| 275 } | 272 } |
| 276 | 273 |
| 277 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |