| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (premultiplyAlpha) | 165 if (premultiplyAlpha) |
| 166 return StaticBitmapImage::create(skiaImage.release()); | 166 return StaticBitmapImage::create(skiaImage.release()); |
| 167 return StaticBitmapImage::create(premulSkImageToUnPremul(skiaImage.get())); | 167 return StaticBitmapImage::create(premulSkImageToUnPremul(skiaImage.get())); |
| 168 } | 168 } |
| 169 | 169 |
| 170 ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) | 170 ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) |
| 171 { | 171 { |
| 172 bool flipY; | 172 bool flipY; |
| 173 parseOptions(options, flipY); | 173 parseOptions(options, flipY); |
| 174 | 174 |
| 175 m_image = cropImage(image->cachedImage()->getImage(), cropRect, flipY, m_isP
remultiplied, PremultiplyAlpha); | 175 m_image = cropImage(image->cachedImage()->getImage(), cropRect, flipY, m_isP
remultiplied); |
| 176 if (!m_image) | 176 if (!m_image) |
| 177 return; | 177 return; |
| 178 m_image->setOriginClean(!image->wouldTaintOrigin(document->getSecurityOrigin
())); | 178 m_image->setOriginClean(!image->wouldTaintOrigin(document->getSecurityOrigin
())); |
| 179 } | 179 } |
| 180 | 180 |
| 181 ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) | 181 ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect, Docum
ent* document, const ImageBitmapOptions& options) |
| 182 { | 182 { |
| 183 IntSize playerSize; | 183 IntSize playerSize; |
| 184 if (video->webMediaPlayer()) | 184 if (video->webMediaPlayer()) |
| 185 playerSize = video->webMediaPlayer()->naturalSize(); | 185 playerSize = video->webMediaPlayer()->naturalSize(); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 453 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
| 454 { | 454 { |
| 455 return FloatSize(width(), height()); | 455 return FloatSize(width(), height()); |
| 456 } | 456 } |
| 457 | 457 |
| 458 DEFINE_TRACE(ImageBitmap) | 458 DEFINE_TRACE(ImageBitmap) |
| 459 { | 459 { |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |