| Index: third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
|
| diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
|
| index 3b75b8c146cb4f2e29ea3f220fac0f9797a9cdfd..bef0489f1176660c337d65235c86e03de0a9ef5b 100644
|
| --- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
|
| +++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
|
| @@ -46,7 +46,6 @@ ImageFrame& ImageFrame::operator=(const ImageFrame& other)
|
| {
|
| if (this == &other)
|
| return *this;
|
| -
|
| m_bitmap = other.m_bitmap;
|
| // Keep the pixels locked since we will be writing directly into the
|
| // bitmap throughout this object's lifetime.
|
| @@ -94,12 +93,18 @@ bool ImageFrame::copyBitmapData(const ImageFrame& other)
|
| return other.m_bitmap.copyTo(&m_bitmap, other.m_bitmap.colorType());
|
| }
|
|
|
| -bool ImageFrame::setSize(int newWidth, int newHeight)
|
| +bool ImageFrame::setSize(int newWidth, int newHeight, ColorType bitmapType)
|
| {
|
| - // setSize() should only be called once, it leaks memory otherwise.
|
| - ASSERT(!width() && !height());
|
| + // shouldn't be called with the same size, though not a problem if it happens
|
| + ASSERT(m_bitmap.isNull() || hasSize(IntSize(newWidth, newHeight), bitmapType));
|
| + if (bitmapType == RGBA8888) {
|
| + m_bitmap.setInfo(SkImageInfo::MakeN32Premul(newWidth, newHeight));
|
| + } else if (bitmapType == RGB565) {
|
| + m_bitmap.setInfo(SkImageInfo::Make(newWidth, newHeight, kRGB_565_SkColorType, kOpaque_SkAlphaType));
|
| + } else {
|
| + ASSERT(false);
|
| + }
|
|
|
| - m_bitmap.setInfo(SkImageInfo::MakeN32Premul(newWidth, newHeight));
|
| if (!m_bitmap.tryAllocPixels(m_allocator, 0))
|
| return false;
|
|
|
|
|