Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 2802813002: Adds SVGImageElement as a ImageBitmapSource (Closed)
Patch Set: tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/offscreencanvas/OffscreenCanvas.h" 10 #include "core/offscreencanvas/OffscreenCanvas.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 if (parsedOptions.premultiplyAlpha) { 545 if (parsedOptions.premultiplyAlpha) {
546 if (imageFormat == DontPremultiplyAlpha) 546 if (imageFormat == DontPremultiplyAlpha)
547 return StaticBitmapImage::create( 547 return StaticBitmapImage::create(
548 unPremulSkImageToPremul(skiaImage.get())); 548 unPremulSkImageToPremul(skiaImage.get()));
549 return StaticBitmapImage::create(std::move(skiaImage)); 549 return StaticBitmapImage::create(std::move(skiaImage));
550 } 550 }
551 return StaticBitmapImage::create(premulSkImageToUnPremul(skiaImage.get())); 551 return StaticBitmapImage::create(premulSkImageToUnPremul(skiaImage.get()));
552 } 552 }
553 553
554 ImageBitmap::ImageBitmap(HTMLImageElement* image, 554 ImageBitmap::ImageBitmap(HTMLAndSVGImageElementSource* image,
555 Optional<IntRect> cropRect, 555 Optional<IntRect> cropRect,
556 Document* document, 556 Document* document,
557 const ImageBitmapOptions& options) { 557 const ImageBitmapOptions& options) {
558 RefPtr<Image> input = image->cachedImage()->getImage(); 558 RefPtr<Image> input = image->cachedImage()->getImage();
559 ParsedOptions parsedOptions = 559 ParsedOptions parsedOptions =
560 parseOptions(options, cropRect, image->bitmapSourceSize()); 560 parseOptions(options, cropRect, image->bitmapSourceSize());
561 if (dstBufferSizeHasOverflow(parsedOptions)) 561 if (dstBufferSizeHasOverflow(parsedOptions))
562 return; 562 return;
563 563
564 if (options.colorSpaceConversion() == kImageBitmapOptionNone) { 564 if (options.colorSpaceConversion() == kImageBitmapOptionNone) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 976
977 PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() { 977 PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() {
978 ASSERT(!isNeutered()); 978 ASSERT(!isNeutered());
979 m_isNeutered = true; 979 m_isNeutered = true;
980 m_image->transfer(); 980 m_image->transfer();
981 return std::move(m_image); 981 return std::move(m_image);
982 } 982 }
983 983
984 ImageBitmap::~ImageBitmap() {} 984 ImageBitmap::~ImageBitmap() {}
985 985
986 ImageBitmap* ImageBitmap::create(HTMLImageElement* image, 986 ImageBitmap* ImageBitmap::create(HTMLAndSVGImageElementSource* image,
987 Optional<IntRect> cropRect, 987 Optional<IntRect> cropRect,
988 Document* document, 988 Document* document,
989 const ImageBitmapOptions& options) { 989 const ImageBitmapOptions& options) {
990 return new ImageBitmap(image, cropRect, document, options); 990 return new ImageBitmap(image, cropRect, document, options);
991 } 991 }
992 992
993 ImageBitmap* ImageBitmap::create(HTMLVideoElement* video, 993 ImageBitmap* ImageBitmap::create(HTMLVideoElement* video,
994 Optional<IntRect> cropRect, 994 Optional<IntRect> cropRect,
995 Document* document, 995 Document* document,
996 const ImageBitmapOptions& options) { 996 const ImageBitmapOptions& options) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, 1125 void ImageBitmap::adjustDrawRects(FloatRect* srcRect,
1126 FloatRect* dstRect) const {} 1126 FloatRect* dstRect) const {}
1127 1127
1128 FloatSize ImageBitmap::elementSize(const FloatSize&) const { 1128 FloatSize ImageBitmap::elementSize(const FloatSize&) const {
1129 return FloatSize(width(), height()); 1129 return FloatSize(width(), height());
1130 } 1130 }
1131 1131
1132 DEFINE_TRACE(ImageBitmap) {} 1132 DEFINE_TRACE(ImageBitmap) {}
1133 1133
1134 } // namespace blink 1134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698