| 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 <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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1105   if (!IsResizeOptionValid(options, exception_state)) | 1105   if (!IsResizeOptionValid(options, exception_state)) | 
| 1106     return ScriptPromise(); | 1106     return ScriptPromise(); | 
| 1107   return ImageBitmapSource::FulfillImageBitmap( | 1107   return ImageBitmapSource::FulfillImageBitmap( | 
| 1108       script_state, Create(this, crop_rect, options)); | 1108       script_state, Create(this, crop_rect, options)); | 
| 1109 } | 1109 } | 
| 1110 | 1110 | 
| 1111 PassRefPtr<Image> ImageBitmap::GetSourceImageForCanvas( | 1111 PassRefPtr<Image> ImageBitmap::GetSourceImageForCanvas( | 
| 1112     SourceImageStatus* status, | 1112     SourceImageStatus* status, | 
| 1113     AccelerationHint, | 1113     AccelerationHint, | 
| 1114     SnapshotReason, | 1114     SnapshotReason, | 
| 1115     const FloatSize&) const { | 1115     const FloatSize&) { | 
| 1116   *status = kNormalSourceImageStatus; | 1116   *status = kNormalSourceImageStatus; | 
| 1117   if (!image_) | 1117   if (!image_) | 
| 1118     return nullptr; | 1118     return nullptr; | 
| 1119   if (image_->IsPremultiplied()) | 1119   if (image_->IsPremultiplied()) | 
| 1120     return image_; | 1120     return image_; | 
| 1121   // Skia does not support drawing unpremul SkImage on SkCanvas. | 1121   // Skia does not support drawing unpremul SkImage on SkCanvas. | 
| 1122   // Premultiply and return. | 1122   // Premultiply and return. | 
| 1123   sk_sp<SkImage> premul_sk_image = | 1123   sk_sp<SkImage> premul_sk_image = | 
| 1124       UnPremulSkImageToPremul(image_->ImageForCurrentFrame().get()); | 1124       UnPremulSkImageToPremul(image_->ImageForCurrentFrame().get()); | 
| 1125   return StaticBitmapImage::Create(premul_sk_image); | 1125   return StaticBitmapImage::Create(premul_sk_image); | 
| 1126 } | 1126 } | 
| 1127 | 1127 | 
| 1128 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, | 1128 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, | 
| 1129                                   FloatRect* dst_rect) const {} | 1129                                   FloatRect* dst_rect) const {} | 
| 1130 | 1130 | 
| 1131 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { | 1131 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { | 
| 1132   return FloatSize(width(), height()); | 1132   return FloatSize(width(), height()); | 
| 1133 } | 1133 } | 
| 1134 | 1134 | 
| 1135 DEFINE_TRACE(ImageBitmap) {} | 1135 DEFINE_TRACE(ImageBitmap) {} | 
| 1136 | 1136 | 
| 1137 }  // namespace blink | 1137 }  // namespace blink | 
| OLD | NEW | 
|---|