| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return true; | 171 return true; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void RecordingImageBufferSurface::willDrawVideo() | 174 void RecordingImageBufferSurface::willDrawVideo() |
| 175 { | 175 { |
| 176 // Video draws need to be synchronous | 176 // Video draws need to be synchronous |
| 177 if (!m_fallbackSurface) | 177 if (!m_fallbackSurface) |
| 178 fallBackToRasterCanvas(); | 178 fallBackToRasterCanvas(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void RecordingImageBufferSurface::draw(GraphicsContext* context, const FloatRect
& destRect, const FloatRect& srcRect, CompositeOperator op, WebBlendMode blendMo
de, bool needsCopy) |
| 182 { |
| 183 if (m_fallbackSurface) { |
| 184 m_fallbackSurface->draw(context, destRect, srcRect, op, blendMode, needs
Copy); |
| 185 return; |
| 186 } |
| 187 |
| 188 RefPtr<SkPicture> picture = getPicture(); |
| 189 if (picture) { |
| 190 context->compositePicture(picture.get(), destRect, srcRect, op, blendMod
e); |
| 191 } else { |
| 192 ImageBufferSurface::draw(context, destRect, srcRect, op, blendMode, need
sCopy); |
| 193 } |
| 194 } |
| 195 |
| 181 // Fallback passthroughs | 196 // Fallback passthroughs |
| 182 | 197 |
| 183 const SkBitmap& RecordingImageBufferSurface::bitmap() | 198 const SkBitmap& RecordingImageBufferSurface::bitmap() |
| 184 { | 199 { |
| 185 if (m_fallbackSurface) | 200 if (m_fallbackSurface) |
| 186 return m_fallbackSurface->bitmap(); | 201 return m_fallbackSurface->bitmap(); |
| 187 return ImageBufferSurface::bitmap(); | 202 return ImageBufferSurface::bitmap(); |
| 188 } | 203 } |
| 189 | 204 |
| 190 bool RecordingImageBufferSurface::restore() | 205 bool RecordingImageBufferSurface::restore() |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 262 |
| 248 void RecordingImageBufferSurface::setIsHidden(bool hidden) | 263 void RecordingImageBufferSurface::setIsHidden(bool hidden) |
| 249 { | 264 { |
| 250 if (m_fallbackSurface) | 265 if (m_fallbackSurface) |
| 251 m_fallbackSurface->setIsHidden(hidden); | 266 m_fallbackSurface->setIsHidden(hidden); |
| 252 else | 267 else |
| 253 ImageBufferSurface::setIsHidden(hidden); | 268 ImageBufferSurface::setIsHidden(hidden); |
| 254 } | 269 } |
| 255 | 270 |
| 256 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |