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 "platform/image-decoders/ImageDecoder.h" | 10 #include "platform/image-decoders/ImageDecoder.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (premultiplyAlpha) | 158 if (premultiplyAlpha) |
159 return StaticBitmapImage::create(skiaImage.release()); | 159 return StaticBitmapImage::create(skiaImage.release()); |
160 return StaticBitmapImage::create(premulSkImageToUnPremul(skiaImage.get())); | 160 return StaticBitmapImage::create(premulSkImageToUnPremul(skiaImage.get())); |
161 } | 161 } |
162 | 162 |
163 ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) | 163 ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) |
164 { | 164 { |
165 bool flipY; | 165 bool flipY; |
166 parseOptions(options, flipY); | 166 parseOptions(options, flipY); |
167 | 167 |
168 m_image = cropImage(image->cachedImage()->image(), cropRect, flipY, m_isPrem
ultiplied, PremultiplyAlpha); | 168 m_image = cropImage(image->cachedImage()->getImage(), cropRect, flipY, m_isP
remultiplied, PremultiplyAlpha); |
169 if (!m_image) | 169 if (!m_image) |
170 return; | 170 return; |
171 m_image->setOriginClean(!image->wouldTaintOrigin(document->getSecurityOrigin
())); | 171 m_image->setOriginClean(!image->wouldTaintOrigin(document->getSecurityOrigin
())); |
172 } | 172 } |
173 | 173 |
174 ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) | 174 ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) |
175 { | 175 { |
176 IntSize playerSize; | 176 IntSize playerSize; |
177 if (video->webMediaPlayer()) | 177 if (video->webMediaPlayer()) |
178 playerSize = video->webMediaPlayer()->naturalSize(); | 178 playerSize = video->webMediaPlayer()->naturalSize(); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 446 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
447 { | 447 { |
448 return FloatSize(width(), height()); | 448 return FloatSize(width(), height()); |
449 } | 449 } |
450 | 450 |
451 DEFINE_TRACE(ImageBitmap) | 451 DEFINE_TRACE(ImageBitmap) |
452 { | 452 { |
453 } | 453 } |
454 | 454 |
455 } // namespace blink | 455 } // namespace blink |
OLD | NEW |