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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 m_image->setOriginClean( | 465 m_image->setOriginClean( |
466 !video->wouldTaintOrigin(document->getSecurityOrigin())); | 466 !video->wouldTaintOrigin(document->getSecurityOrigin())); |
467 m_image->setPremultiplied(parsedOptions.premultiplyAlpha); | 467 m_image->setPremultiplied(parsedOptions.premultiplyAlpha); |
468 } | 468 } |
469 | 469 |
470 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, | 470 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, |
471 Optional<IntRect> cropRect, | 471 Optional<IntRect> cropRect, |
472 const ImageBitmapOptions& options) { | 472 const ImageBitmapOptions& options) { |
473 ASSERT(canvas->isPaintable()); | 473 ASSERT(canvas->isPaintable()); |
474 RefPtr<Image> input; | 474 RefPtr<Image> input; |
475 if (canvas->placeholderFrame()) | 475 if (canvas->placeholderFrame()) { |
476 input = canvas->placeholderFrame(); | 476 input = canvas->placeholderFrame(); |
477 else | 477 } else { |
478 input = canvas->copiedImage(BackBuffer, PreferAcceleration); | 478 input = canvas->copiedImage(BackBuffer, PreferAcceleration, |
| 479 SnapshotReasonCreateImageBitmap); |
| 480 } |
479 ParsedOptions parsedOptions = | 481 ParsedOptions parsedOptions = |
480 parseOptions(options, cropRect, IntSize(input->width(), input->height())); | 482 parseOptions(options, cropRect, IntSize(input->width(), input->height())); |
481 if (dstBufferSizeHasOverflow(parsedOptions)) | 483 if (dstBufferSizeHasOverflow(parsedOptions)) |
482 return; | 484 return; |
483 | 485 |
484 bool isPremultiplyAlphaReverted = false; | 486 bool isPremultiplyAlphaReverted = false; |
485 if (!parsedOptions.premultiplyAlpha) { | 487 if (!parsedOptions.premultiplyAlpha) { |
486 parsedOptions.premultiplyAlpha = true; | 488 parsedOptions.premultiplyAlpha = true; |
487 isPremultiplyAlphaReverted = true; | 489 isPremultiplyAlphaReverted = true; |
488 } | 490 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, | 866 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, |
865 FloatRect* dstRect) const {} | 867 FloatRect* dstRect) const {} |
866 | 868 |
867 FloatSize ImageBitmap::elementSize(const FloatSize&) const { | 869 FloatSize ImageBitmap::elementSize(const FloatSize&) const { |
868 return FloatSize(width(), height()); | 870 return FloatSize(width(), height()); |
869 } | 871 } |
870 | 872 |
871 DEFINE_TRACE(ImageBitmap) {} | 873 DEFINE_TRACE(ImageBitmap) {} |
872 | 874 |
873 } // namespace blink | 875 } // namespace blink |
OLD | NEW |