| 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/AcceleratedStaticBitmapImage.h" | |
| 11 #include "platform/graphics/skia/SkiaUtils.h" | 10 #include "platform/graphics/skia/SkiaUtils.h" |
| 12 #include "platform/image-decoders/ImageDecoder.h" | 11 #include "platform/image-decoders/ImageDecoder.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkSurface.h" | 13 #include "third_party/skia/include/core/SkSurface.h" |
| 15 #include "wtf/PtrUtil.h" | 14 #include "wtf/PtrUtil.h" |
| 16 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
| 17 #include <memory> | 16 #include <memory> |
| 18 | 17 |
| 19 namespace blink { | 18 namespace blink { |
| 20 | 19 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 return; | 510 return; |
| 512 m_image->setOriginClean(originClean); | 511 m_image->setOriginClean(originClean); |
| 513 m_image->setPremultiplied(parsedOptions.premultiplyAlpha); | 512 m_image->setPremultiplied(parsedOptions.premultiplyAlpha); |
| 514 } | 513 } |
| 515 | 514 |
| 516 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) | 515 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) |
| 517 { | 516 { |
| 518 m_image = image; | 517 m_image = image; |
| 519 } | 518 } |
| 520 | 519 |
| 521 ImageBitmap::ImageBitmap(WebExternalTextureMailbox& mailbox) | |
| 522 { | |
| 523 m_image = AcceleratedStaticBitmapImage::create(mailbox); | |
| 524 } | |
| 525 | |
| 526 PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() | 520 PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() |
| 527 { | 521 { |
| 528 ASSERT(!isNeutered()); | 522 ASSERT(!isNeutered()); |
| 529 m_isNeutered = true; | 523 m_isNeutered = true; |
| 530 return m_image.release(); | 524 return m_image.release(); |
| 531 } | 525 } |
| 532 | 526 |
| 533 ImageBitmap::~ImageBitmap() | 527 ImageBitmap::~ImageBitmap() |
| 534 { | 528 { |
| 535 } | 529 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 562 ImageBitmap* ImageBitmap::create(PassRefPtr<StaticBitmapImage> image, Optional<I
ntRect> cropRect, const ImageBitmapOptions& options) | 556 ImageBitmap* ImageBitmap::create(PassRefPtr<StaticBitmapImage> image, Optional<I
ntRect> cropRect, const ImageBitmapOptions& options) |
| 563 { | 557 { |
| 564 return new ImageBitmap(image, cropRect, options); | 558 return new ImageBitmap(image, cropRect, options); |
| 565 } | 559 } |
| 566 | 560 |
| 567 ImageBitmap* ImageBitmap::create(PassRefPtr<StaticBitmapImage> image) | 561 ImageBitmap* ImageBitmap::create(PassRefPtr<StaticBitmapImage> image) |
| 568 { | 562 { |
| 569 return new ImageBitmap(image); | 563 return new ImageBitmap(image); |
| 570 } | 564 } |
| 571 | 565 |
| 572 ImageBitmap* ImageBitmap::create(WebExternalTextureMailbox& mailbox) | |
| 573 { | |
| 574 return new ImageBitmap(mailbox); | |
| 575 } | |
| 576 | |
| 577 ImageBitmap* ImageBitmap::create(std::unique_ptr<uint8_t[]> data, uint32_t width
, uint32_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClea
n) | 566 ImageBitmap* ImageBitmap::create(std::unique_ptr<uint8_t[]> data, uint32_t width
, uint32_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClea
n) |
| 578 { | 567 { |
| 579 return new ImageBitmap(std::move(data), width, height, isImageBitmapPremulti
plied, isImageBitmapOriginClean); | 568 return new ImageBitmap(std::move(data), width, height, isImageBitmapPremulti
plied, isImageBitmapOriginClean); |
| 580 } | 569 } |
| 581 | 570 |
| 582 void ImageBitmap::close() | 571 void ImageBitmap::close() |
| 583 { | 572 { |
| 584 if (!m_image || m_isNeutered) | 573 if (!m_image || m_isNeutered) |
| 585 return; | 574 return; |
| 586 m_image.clear(); | 575 m_image.clear(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 641 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
| 653 { | 642 { |
| 654 return FloatSize(width(), height()); | 643 return FloatSize(width(), height()); |
| 655 } | 644 } |
| 656 | 645 |
| 657 DEFINE_TRACE(ImageBitmap) | 646 DEFINE_TRACE(ImageBitmap) |
| 658 { | 647 { |
| 659 } | 648 } |
| 660 | 649 |
| 661 } // namespace blink | 650 } // namespace blink |
| OLD | NEW |