| 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/frame/ImageBitmap.h" | 5 #include "core/frame/ImageBitmap.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLCanvasElement.h" | 7 #include "core/html/HTMLCanvasElement.h" |
| 8 #include "core/html/HTMLVideoElement.h" | 8 #include "core/html/HTMLVideoElement.h" |
| 9 #include "core/html/ImageData.h" | 9 #include "core/html/ImageData.h" |
| 10 #include "core/offscreencanvas/OffscreenCanvas.h" | 10 #include "core/offscreencanvas/OffscreenCanvas.h" |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 image_ = CropImageAndApplyColorSpaceConversion( | 957 image_ = CropImageAndApplyColorSpaceConversion( |
| 958 input.Get(), parsed_options, | 958 input.Get(), parsed_options, |
| 959 bitmap->IsPremultiplied() ? kPremultiplyAlpha : kDontPremultiplyAlpha, | 959 bitmap->IsPremultiplied() ? kPremultiplyAlpha : kDontPremultiplyAlpha, |
| 960 ColorBehavior::TransformToGlobalTarget()); | 960 ColorBehavior::TransformToGlobalTarget()); |
| 961 if (!image_) | 961 if (!image_) |
| 962 return; | 962 return; |
| 963 image_->SetOriginClean(bitmap->OriginClean()); | 963 image_->SetOriginClean(bitmap->OriginClean()); |
| 964 image_->SetPremultiplied(parsed_options.premultiply_alpha); | 964 image_->SetPremultiplied(parsed_options.premultiply_alpha); |
| 965 } | 965 } |
| 966 | 966 |
| 967 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image, | 967 ImageBitmap::ImageBitmap(RefPtr<StaticBitmapImage> image, |
| 968 Optional<IntRect> crop_rect, | 968 Optional<IntRect> crop_rect, |
| 969 const ImageBitmapOptions& options) { | 969 const ImageBitmapOptions& options) { |
| 970 bool origin_clean = image->OriginClean(); | 970 bool origin_clean = image->OriginClean(); |
| 971 RefPtr<Image> input = image; | |
| 972 ParsedOptions parsed_options = | 971 ParsedOptions parsed_options = |
| 973 ParseOptions(options, crop_rect, input->size()); | 972 ParseOptions(options, crop_rect, image->size()); |
| 974 if (DstBufferSizeHasOverflow(parsed_options)) | 973 if (DstBufferSizeHasOverflow(parsed_options)) |
| 975 return; | 974 return; |
| 976 | 975 |
| 977 image_ = CropImageAndApplyColorSpaceConversion( | 976 image_ = CropImageAndApplyColorSpaceConversion( |
| 978 input.Get(), parsed_options, kPremultiplyAlpha, | 977 image.Get(), parsed_options, kPremultiplyAlpha, |
| 979 ColorBehavior::TransformToGlobalTarget()); | 978 ColorBehavior::TransformToGlobalTarget()); |
| 980 if (!image_) | 979 if (!image_) |
| 981 return; | 980 return; |
| 982 | 981 |
| 983 image_->SetOriginClean(origin_clean); | 982 image_->SetOriginClean(origin_clean); |
| 984 image_->SetPremultiplied(parsed_options.premultiply_alpha); | 983 image_->SetPremultiplied(parsed_options.premultiply_alpha); |
| 985 } | 984 } |
| 986 | 985 |
| 987 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) { | 986 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) { |
| 988 image_ = std::move(image); | 987 image_ = std::move(image); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, | 1138 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, |
| 1140 FloatRect* dst_rect) const {} | 1139 FloatRect* dst_rect) const {} |
| 1141 | 1140 |
| 1142 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { | 1141 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { |
| 1143 return FloatSize(width(), height()); | 1142 return FloatSize(width(), height()); |
| 1144 } | 1143 } |
| 1145 | 1144 |
| 1146 DEFINE_TRACE(ImageBitmap) {} | 1145 DEFINE_TRACE(ImageBitmap) {} |
| 1147 | 1146 |
| 1148 } // namespace blink | 1147 } // namespace blink |
| OLD | NEW |