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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 return image_->height(); | 1082 return image_->height(); |
1083 } | 1083 } |
1084 | 1084 |
1085 bool ImageBitmap::IsAccelerated() const { | 1085 bool ImageBitmap::IsAccelerated() const { |
1086 return image_ && (image_->IsTextureBacked() || image_->HasMailbox()); | 1086 return image_ && (image_->IsTextureBacked() || image_->HasMailbox()); |
1087 } | 1087 } |
1088 | 1088 |
1089 IntSize ImageBitmap::Size() const { | 1089 IntSize ImageBitmap::Size() const { |
1090 if (!image_) | 1090 if (!image_) |
1091 return IntSize(); | 1091 return IntSize(); |
1092 ASSERT(image_->width() > 0 && image_->height() > 0); | 1092 DCHECK_GT(image_->width(), 0); |
| 1093 DCHECK_GT(image_->height(), 0); |
1093 return IntSize(image_->width(), image_->height()); | 1094 return IntSize(image_->width(), image_->height()); |
1094 } | 1095 } |
1095 | 1096 |
1096 ScriptPromise ImageBitmap::CreateImageBitmap(ScriptState* script_state, | 1097 ScriptPromise ImageBitmap::CreateImageBitmap(ScriptState* script_state, |
1097 EventTarget& event_target, | 1098 EventTarget& event_target, |
1098 Optional<IntRect> crop_rect, | 1099 Optional<IntRect> crop_rect, |
1099 const ImageBitmapOptions& options, | 1100 const ImageBitmapOptions& options, |
1100 ExceptionState& exception_state) { | 1101 ExceptionState& exception_state) { |
1101 if ((crop_rect && !IsSourceSizeValid(crop_rect->Width(), crop_rect->Height(), | 1102 if ((crop_rect && !IsSourceSizeValid(crop_rect->Width(), crop_rect->Height(), |
1102 exception_state)) || | 1103 exception_state)) || |
(...skipping 25 matching lines...) Expand all Loading... |
1128 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, | 1129 void ImageBitmap::AdjustDrawRects(FloatRect* src_rect, |
1129 FloatRect* dst_rect) const {} | 1130 FloatRect* dst_rect) const {} |
1130 | 1131 |
1131 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { | 1132 FloatSize ImageBitmap::ElementSize(const FloatSize&) const { |
1132 return FloatSize(width(), height()); | 1133 return FloatSize(width(), height()); |
1133 } | 1134 } |
1134 | 1135 |
1135 DEFINE_TRACE(ImageBitmap) {} | 1136 DEFINE_TRACE(ImageBitmap) {} |
1136 | 1137 |
1137 } // namespace blink | 1138 } // namespace blink |
OLD | NEW |