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 7c0de1e9e10b593f496e058d70579b981bd201f8..30949c9a0f1006ae8070ca25a8b0c95b284e1563 100644 |
| --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp |
| +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp |
| @@ -258,8 +258,8 @@ ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect, con |
| m_image->setPremultiplied(premultiplyAlpha); |
| } |
| -// The last two parameters are used for structure-cloning. |
| -ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect, const ImageBitmapOptions& options, const bool& isImageDataPremultiplied, const bool& isImageDataOriginClean) |
| +// The last parameter are used for structure-cloning. |
|
jbroman
2016/06/27 19:16:16
nit: "The last parameter is...", or better yet, "i
xidachen
2016/06/27 19:48:21
Done.
|
| +ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect, const ImageBitmapOptions& options, const bool& isImageDataOriginClean) |
| { |
| bool flipY; |
| bool premultiplyAlpha; |
| @@ -273,11 +273,7 @@ ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect, const ImageBi |
| int dstHeight = cropRect.height(); |
| // TODO (xidachen): skia doesn't support SkImage::NewRasterCopy from a kRGBA color type. |
| // For now, we swap R and B channel and uses kBGRA color type. |
| - SkImageInfo info; |
| - if (!isImageDataPremultiplied) |
| - info = SkImageInfo::Make(cropRect.width(), dstHeight, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); |
| - else |
| - info = SkImageInfo::Make(cropRect.width(), dstHeight, kBGRA_8888_SkColorType, kPremul_SkAlphaType); |
| + SkImageInfo info = SkImageInfo::Make(cropRect.width(), dstHeight, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); |
| int srcPixelBytesPerRow = info.bytesPerPixel() * data->size().width(); |
| int dstPixelBytesPerRow = info.bytesPerPixel() * cropRect.width(); |
| if (cropRect == IntRect(IntPoint(), data->size())) { |
| @@ -340,6 +336,7 @@ ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect, const ImageBi |
| m_image = StaticBitmapImage::create(flipSkImageVertically(buffer->newSkImageSnapshot(PreferNoAcceleration, SnapshotReasonUnknown).get(), PremultiplyAlpha)); |
| else |
| m_image = StaticBitmapImage::create(buffer->newSkImageSnapshot(PreferNoAcceleration, SnapshotReasonUnknown)); |
| + m_image->setOriginClean(isImageDataOriginClean); |
|
jbroman
2016/06/27 19:16:16
Is this change related to this CL?
xidachen
2016/06/27 19:48:21
Without this CL, the code path for structured-clon
|
| } |
| ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect, const ImageBitmapOptions& options) |
| @@ -405,10 +402,10 @@ ImageBitmap* ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropR |
| return new ImageBitmap(canvas, normalizedCropRect, options); |
| } |
| -ImageBitmap* ImageBitmap::create(ImageData* data, const IntRect& cropRect, const ImageBitmapOptions& options, const bool& isImageDataPremultiplied, const bool& isImageDataOriginClean) |
| +ImageBitmap* ImageBitmap::create(ImageData* data, const IntRect& cropRect, const ImageBitmapOptions& options, const bool& isImageDataOriginClean) |
| { |
| IntRect normalizedCropRect = normalizeRect(cropRect); |
| - return new ImageBitmap(data, normalizedCropRect, options, isImageDataPremultiplied, isImageDataOriginClean); |
| + return new ImageBitmap(data, normalizedCropRect, options, isImageDataOriginClean); |
| } |
| ImageBitmap* ImageBitmap::create(ImageBitmap* bitmap, const IntRect& cropRect, const ImageBitmapOptions& options) |