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/ExpensiveCanvasHeuristicParameters.h" | 9 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
10 #include "platform/graphics/GraphicsContext.h" | 10 #include "platform/graphics/GraphicsContext.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 void RecordingImageBufferSurface::willOverwriteCanvas() | 142 void RecordingImageBufferSurface::willOverwriteCanvas() |
143 { | 143 { |
144 m_frameWasCleared = true; | 144 m_frameWasCleared = true; |
145 m_previousFrame.clear(); | 145 m_previousFrame.clear(); |
146 m_previousFrameHasExpensiveOp = false; | 146 m_previousFrameHasExpensiveOp = false; |
147 m_previousFramePixelCount = 0; | 147 m_previousFramePixelCount = 0; |
148 if (m_didRecordDrawCommandsInCurrentFrame) { | 148 if (m_didRecordDrawCommandsInCurrentFrame) { |
149 // Discard previous draw commands | 149 // Discard previous draw commands |
150 m_currentFrame->endRecording(); | 150 adoptRef(m_currentFrame->endRecording()); |
151 initializeCurrentFrame(); | 151 initializeCurrentFrame(); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void RecordingImageBufferSurface::didDraw(const FloatRect& rect) | 155 void RecordingImageBufferSurface::didDraw(const FloatRect& rect) |
156 { | 156 { |
157 m_didRecordDrawCommandsInCurrentFrame = true; | 157 m_didRecordDrawCommandsInCurrentFrame = true; |
158 IntRect pixelBounds = enclosingIntRect(rect); | 158 IntRect pixelBounds = enclosingIntRect(rect); |
159 m_currentFramePixelCount += pixelBounds.width() * pixelBounds.height(); | 159 m_currentFramePixelCount += pixelBounds.width() * pixelBounds.height(); |
160 } | 160 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 void RecordingImageBufferSurface::setIsHidden(bool hidden) | 307 void RecordingImageBufferSurface::setIsHidden(bool hidden) |
308 { | 308 { |
309 if (m_fallbackSurface) | 309 if (m_fallbackSurface) |
310 m_fallbackSurface->setIsHidden(hidden); | 310 m_fallbackSurface->setIsHidden(hidden); |
311 else | 311 else |
312 ImageBufferSurface::setIsHidden(hidden); | 312 ImageBufferSurface::setIsHidden(hidden); |
313 } | 313 } |
314 | 314 |
315 } // namespace blink | 315 } // namespace blink |
OLD | NEW |