Chromium Code Reviews| 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())); |