| 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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 bool is_image_bitmap_premultiplied, | 1040 bool is_image_bitmap_premultiplied, |
| 1041 bool is_image_bitmap_origin_clean) { | 1041 bool is_image_bitmap_origin_clean) { |
| 1042 return new ImageBitmap(pixel_data, width, height, | 1042 return new ImageBitmap(pixel_data, width, height, |
| 1043 is_image_bitmap_premultiplied, | 1043 is_image_bitmap_premultiplied, |
| 1044 is_image_bitmap_origin_clean); | 1044 is_image_bitmap_origin_clean); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 void ImageBitmap::close() { | 1047 void ImageBitmap::close() { |
| 1048 if (!image_ || is_neutered_) | 1048 if (!image_ || is_neutered_) |
| 1049 return; | 1049 return; |
| 1050 if (image_) |
| 1051 image_->UnregisterExternalAllocationWithCurrentContext(); |
| 1050 image_.Clear(); | 1052 image_.Clear(); |
| 1051 is_neutered_ = true; | 1053 is_neutered_ = true; |
| 1052 } | 1054 } |
| 1053 | 1055 |
| 1054 // static | 1056 // static |
| 1055 ImageBitmap* ImageBitmap::Take(ScriptPromiseResolver*, sk_sp<SkImage> image) { | 1057 ImageBitmap* ImageBitmap::Take(ScriptPromiseResolver*, sk_sp<SkImage> image) { |
| 1056 return ImageBitmap::Create(StaticBitmapImage::Create(std::move(image))); | 1058 return ImageBitmap::Create(StaticBitmapImage::Create(std::move(image))); |
| 1057 } | 1059 } |
| 1058 | 1060 |
| 1059 PassRefPtr<Uint8Array> ImageBitmap::CopyBitmapData(AlphaDisposition alpha_op, | 1061 PassRefPtr<Uint8Array> ImageBitmap::CopyBitmapData(AlphaDisposition alpha_op, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, | 1130 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, |
| 1129 FloatRect* dst_rect) const {} | 1131 FloatRect* dst_rect) const {} |
| 1130 | 1132 |
| 1131 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { | 1133 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { |
| 1132 return FloatSize(width(), height()); | 1134 return FloatSize(width(), height()); |
| 1133 } | 1135 } |
| 1134 | 1136 |
| 1135 DEFINE_TRACE(ImageBitmap) {} | 1137 DEFINE_TRACE(ImageBitmap) {} |
| 1136 | 1138 |
| 1137 } // namespace blink | 1139 } // namespace blink |
| OLD | NEW |