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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 (alpha_op == kPremultiplyAlpha) ? kPremul_SkAlphaType | 1064 (alpha_op == kPremultiplyAlpha) ? kPremul_SkAlphaType |
1065 : kUnpremul_SkAlphaType); | 1065 : kUnpremul_SkAlphaType); |
1066 RefPtr<Uint8Array> dst_pixels = | 1066 RefPtr<Uint8Array> dst_pixels = |
1067 CopySkImageData(image_->ImageForCurrentFrame().get(), info); | 1067 CopySkImageData(image_->ImageForCurrentFrame().get(), info); |
1068 return dst_pixels.Release(); | 1068 return dst_pixels.Release(); |
1069 } | 1069 } |
1070 | 1070 |
1071 unsigned long ImageBitmap::width() const { | 1071 unsigned long ImageBitmap::width() const { |
1072 if (!image_) | 1072 if (!image_) |
1073 return 0; | 1073 return 0; |
1074 ASSERT(image_->width() > 0); | 1074 DCHECK_GT(image_->width(), 0); |
1075 return image_->width(); | 1075 return image_->width(); |
1076 } | 1076 } |
1077 | 1077 |
1078 unsigned long ImageBitmap::height() const { | 1078 unsigned long ImageBitmap::height() const { |
1079 if (!image_) | 1079 if (!image_) |
1080 return 0; | 1080 return 0; |
1081 ASSERT(image_->height() > 0); | 1081 DCHECK_GT(image_->height(), 0); |
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(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |