| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "core/frame/ImageBitmap.h" | 6 #include "core/frame/ImageBitmap.h" |
| 7 | 7 |
| 8 #include "core/html/HTMLCanvasElement.h" | 8 #include "core/html/HTMLCanvasElement.h" |
| 9 #include "core/html/HTMLVideoElement.h" | 9 #include "core/html/HTMLVideoElement.h" |
| 10 #include "core/html/ImageData.h" | 10 #include "core/html/ImageData.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 DisplayItemListContextRecorder contextRecorder(*buffer->context()); | 77 DisplayItemListContextRecorder contextRecorder(*buffer->context()); |
| 78 GraphicsContext& paintContext = contextRecorder.context(); | 78 GraphicsContext& paintContext = contextRecorder.context(); |
| 79 | 79 |
| 80 DrawingRecorder recorder(paintContext, *buffer, DisplayItem::VideoBitmap
, videoRect); | 80 DrawingRecorder recorder(paintContext, *buffer, DisplayItem::VideoBitmap
, videoRect); |
| 81 if (!recorder.canUseCachedDrawing()) { | 81 if (!recorder.canUseCachedDrawing()) { |
| 82 paintContext.clip(dstRect); | 82 paintContext.clip(dstRect); |
| 83 paintContext.translate(-srcRect.x(), -srcRect.y()); | 83 paintContext.translate(-srcRect.x(), -srcRect.y()); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 video->paintCurrentFrameInContext(buffer->context(), videoRect); | 87 video->paintCurrentFrame(buffer->canvas(), videoRect, nullptr); |
| 88 m_bitmap = buffer->copyImage(DontCopyBackingStore); | 88 m_bitmap = buffer->copyImage(DontCopyBackingStore); |
| 89 m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cro
pRect.y())), srcRect.size()); | 89 m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cro
pRect.y())), srcRect.size()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect) | 92 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect) |
| 93 : m_imageElement(nullptr) | 93 : m_imageElement(nullptr) |
| 94 , m_cropRect(cropRect) | 94 , m_cropRect(cropRect) |
| 95 , m_bitmapOffset(IntPoint()) | 95 , m_bitmapOffset(IntPoint()) |
| 96 { | 96 { |
| 97 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size())
); | 97 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size())
); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return FloatSize(width(), height()); | 228 return FloatSize(width(), height()); |
| 229 } | 229 } |
| 230 | 230 |
| 231 DEFINE_TRACE(ImageBitmap) | 231 DEFINE_TRACE(ImageBitmap) |
| 232 { | 232 { |
| 233 visitor->trace(m_imageElement); | 233 visitor->trace(m_imageElement); |
| 234 ImageLoaderClient::trace(visitor); | 234 ImageLoaderClient::trace(visitor); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |