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

Unified Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 1800153003: Force image-decoding before resolving createImageBitmap promise (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/ImageBitmap.cpp
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
index 70e44f107e18ca2162b7060aabdb147d64a335cb..66af5e6fe21da6105b671bda4f486279dafe1e8f 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -135,7 +135,13 @@ static PassRefPtr<StaticBitmapImage> cropImage(Image* image, const IntRect& crop
if (cropRect == srcRect) {
if (flipY)
return StaticBitmapImage::create(flipSkImageVertically(skiaImage->newSubset(srcRect), premultiplyAlpha ? PremultiplyAlpha : DontPremultiplyAlpha));
- return StaticBitmapImage::create(adoptRef(skiaImage->newSubset(srcRect)));
+ SkImage* croppedSkImage = skiaImage->newSubset(srcRect);
+ if (cropRect == imgRect) {
+ SkImageInfo info = SkImageInfo::MakeN32(image->width(), image->height(), premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType);
+ OwnPtr<uint8_t[]> imagePixels = copySkImageData(croppedSkImage, info);
Justin Novosad 2016/03/17 21:27:21 Making a full copy, only to discard it after is wa
+
+ }
+ return StaticBitmapImage::create(adoptRef(croppedSkImage));
}
RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(cropRect.width(), cropRect.height()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698