| 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 "core/imagebitmap/ImageBitmap.h" | 5 #include "core/imagebitmap/ImageBitmap.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 | 961 |
| 962 PassRefPtr<Uint8Array> ImageBitmap::CopyBitmapData(AlphaDisposition alpha_op, | 962 PassRefPtr<Uint8Array> ImageBitmap::CopyBitmapData(AlphaDisposition alpha_op, |
| 963 DataColorFormat format) { | 963 DataColorFormat format) { |
| 964 SkImageInfo info = SkImageInfo::Make( | 964 SkImageInfo info = SkImageInfo::Make( |
| 965 width(), height(), | 965 width(), height(), |
| 966 (format == kRGBAColorType) ? kRGBA_8888_SkColorType : kN32_SkColorType, | 966 (format == kRGBAColorType) ? kRGBA_8888_SkColorType : kN32_SkColorType, |
| 967 (alpha_op == kPremultiplyAlpha) ? kPremul_SkAlphaType | 967 (alpha_op == kPremultiplyAlpha) ? kPremul_SkAlphaType |
| 968 : kUnpremul_SkAlphaType); | 968 : kUnpremul_SkAlphaType); |
| 969 RefPtr<Uint8Array> dst_pixels = | 969 RefPtr<Uint8Array> dst_pixels = |
| 970 CopySkImageData(image_->ImageForCurrentFrame(), info); | 970 CopySkImageData(image_->ImageForCurrentFrame(), info); |
| 971 return dst_pixels.Release(); | 971 return dst_pixels; |
| 972 } | 972 } |
| 973 | 973 |
| 974 unsigned long ImageBitmap::width() const { | 974 unsigned long ImageBitmap::width() const { |
| 975 if (!image_) | 975 if (!image_) |
| 976 return 0; | 976 return 0; |
| 977 DCHECK_GT(image_->width(), 0); | 977 DCHECK_GT(image_->width(), 0); |
| 978 return image_->width(); | 978 return image_->width(); |
| 979 } | 979 } |
| 980 | 980 |
| 981 unsigned long ImageBitmap::height() const { | 981 unsigned long ImageBitmap::height() const { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, | 1032 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, |
| 1033 FloatRect* dst_rect) const {} | 1033 FloatRect* dst_rect) const {} |
| 1034 | 1034 |
| 1035 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { | 1035 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { |
| 1036 return FloatSize(width(), height()); | 1036 return FloatSize(width(), height()); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 DEFINE_TRACE(ImageBitmap) {} | 1039 DEFINE_TRACE(ImageBitmap) {} |
| 1040 | 1040 |
| 1041 } // namespace blink | 1041 } // namespace blink |
| OLD | NEW |