| 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/graphics/skia/SkiaUtils.h" | 10 #include "platform/graphics/skia/SkiaUtils.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 m_image = StaticBitmapImage::create(std::move(skiaImage)); | 462 m_image = StaticBitmapImage::create(std::move(skiaImage)); |
| 463 m_image->setOriginClean( | 463 m_image->setOriginClean( |
| 464 !video->wouldTaintOrigin(document->getSecurityOrigin())); | 464 !video->wouldTaintOrigin(document->getSecurityOrigin())); |
| 465 m_image->setPremultiplied(parsedOptions.premultiplyAlpha); | 465 m_image->setPremultiplied(parsedOptions.premultiplyAlpha); |
| 466 } | 466 } |
| 467 | 467 |
| 468 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, | 468 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, |
| 469 Optional<IntRect> cropRect, | 469 Optional<IntRect> cropRect, |
| 470 const ImageBitmapOptions& options) { | 470 const ImageBitmapOptions& options) { |
| 471 ASSERT(canvas->isPaintable()); | 471 ASSERT(canvas->isPaintable()); |
| 472 RefPtr<Image> input = canvas->copiedImage(BackBuffer, PreferAcceleration); | 472 RefPtr<Image> input; |
| 473 if (canvas->placeholderFrame()) |
| 474 input = canvas->placeholderFrame(); |
| 475 else |
| 476 input = canvas->copiedImage(BackBuffer, PreferAcceleration); |
| 473 ParsedOptions parsedOptions = | 477 ParsedOptions parsedOptions = |
| 474 parseOptions(options, cropRect, IntSize(input->width(), input->height())); | 478 parseOptions(options, cropRect, IntSize(input->width(), input->height())); |
| 475 if (dstBufferSizeHasOverflow(parsedOptions)) | 479 if (dstBufferSizeHasOverflow(parsedOptions)) |
| 476 return; | 480 return; |
| 477 | 481 |
| 478 bool isPremultiplyAlphaReverted = false; | 482 bool isPremultiplyAlphaReverted = false; |
| 479 if (!parsedOptions.premultiplyAlpha) { | 483 if (!parsedOptions.premultiplyAlpha) { |
| 480 parsedOptions.premultiplyAlpha = true; | 484 parsedOptions.premultiplyAlpha = true; |
| 481 isPremultiplyAlphaReverted = true; | 485 isPremultiplyAlphaReverted = true; |
| 482 } | 486 } |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, | 862 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, |
| 859 FloatRect* dstRect) const {} | 863 FloatRect* dstRect) const {} |
| 860 | 864 |
| 861 FloatSize ImageBitmap::elementSize(const FloatSize&) const { | 865 FloatSize ImageBitmap::elementSize(const FloatSize&) const { |
| 862 return FloatSize(width(), height()); | 866 return FloatSize(width(), height()); |
| 863 } | 867 } |
| 864 | 868 |
| 865 DEFINE_TRACE(ImageBitmap) {} | 869 DEFINE_TRACE(ImageBitmap) {} |
| 866 | 870 |
| 867 } // namespace blink | 871 } // namespace blink |
| OLD | NEW |