| 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..43aef5b8c295b9b34c440ad02f9e1da93974852e 100644
|
| --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
|
| @@ -135,7 +135,14 @@ 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) {
|
| + // Call readPixels to trigger image decoding. Only read 1*1 subregion to be efficient.
|
| + SkImageInfo info = SkImageInfo::MakeN32(1, 1, premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType);
|
| + OwnPtr<uint8_t[]> imagePixels = adoptArrayPtr(new uint8_t[info.bytesPerPixel()]);
|
| + croppedSkImage->readPixels(info, imagePixels.get(), info.bytesPerPixel(), 0, 0);
|
| + }
|
| + return StaticBitmapImage::create(adoptRef(croppedSkImage));
|
| }
|
|
|
| RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(cropRect.width(), cropRect.height()));
|
|
|