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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = canvas->copiedImage(BackBuffer, PreferAcceleration); |
473 ParsedOptions parsedOptions = | 473 ParsedOptions parsedOptions = |
474 parseOptions(options, cropRect, canvas->bitmapSourceSize()); | 474 parseOptions(options, cropRect, IntSize(input->width(), input->height())); |
475 if (dstBufferSizeHasOverflow(parsedOptions)) | 475 if (dstBufferSizeHasOverflow(parsedOptions)) |
476 return; | 476 return; |
477 | 477 |
478 bool isPremultiplyAlphaReverted = false; | 478 bool isPremultiplyAlphaReverted = false; |
479 if (!parsedOptions.premultiplyAlpha) { | 479 if (!parsedOptions.premultiplyAlpha) { |
480 parsedOptions.premultiplyAlpha = true; | 480 parsedOptions.premultiplyAlpha = true; |
481 isPremultiplyAlphaReverted = true; | 481 isPremultiplyAlphaReverted = true; |
482 } | 482 } |
483 m_image = cropImage(input.get(), parsedOptions); | 483 m_image = cropImage(input.get(), parsedOptions); |
484 if (!m_image) | 484 if (!m_image) |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, | 857 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, |
858 FloatRect* dstRect) const {} | 858 FloatRect* dstRect) const {} |
859 | 859 |
860 FloatSize ImageBitmap::elementSize(const FloatSize&) const { | 860 FloatSize ImageBitmap::elementSize(const FloatSize&) const { |
861 return FloatSize(width(), height()); | 861 return FloatSize(width(), height()); |
862 } | 862 } |
863 | 863 |
864 DEFINE_TRACE(ImageBitmap) {} | 864 DEFINE_TRACE(ImageBitmap) {} |
865 | 865 |
866 } // namespace blink | 866 } // namespace blink |
OLD | NEW |