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..68768ae22dfc6f37251bd6fde548591c29b70650 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; |
- |
scroggo_chromium
2015/10/19 20:41:36
nit: Why did this line get removed?
|
m_bitmap = other.m_bitmap; |
// Keep the pixels locked since we will be writing directly into the |
// bitmap throughout this object's lifetime. |
@@ -94,14 +93,19 @@ 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. |
scroggo_chromium
2015/10/19 20:41:36
Was this removed because you intend to call it mor
aleksandar.stojiljkovic
2015/10/20 09:51:12
In current usage, allocation happens in Skia on Sk
|
- ASSERT(!width() && !height()); |
+ 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)) |
+ if (!m_bitmap.tryAllocPixels(m_allocator, 0)) { |
scroggo_chromium
2015/10/19 20:41:36
I prefer this style personally, but AFAIK braces a
aleksandar.stojiljkovic
2015/10/20 09:51:12
Done.
|
return false; |
+ } |
zeroFillPixelData(); |
return true; |