Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1317)

Unified Diff: Source/platform/graphics/DeferredImageDecoder.cpp

Issue 1001703003: Take NativeImageSkia out behind the woodshed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Switch to skia-style API (return bool instead of SkBitmap) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/DeferredImageDecoder.cpp
diff --git a/Source/platform/graphics/DeferredImageDecoder.cpp b/Source/platform/graphics/DeferredImageDecoder.cpp
index 61604b6960ac8ac025dd3b43b76a36114056cb33..6fc2f376bb501f6297fe059764daae974a36bbea 100644
--- a/Source/platform/graphics/DeferredImageDecoder.cpp
+++ b/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -88,30 +88,31 @@ String DeferredImageDecoder::filenameExtension() const
return m_actualDecoder ? m_actualDecoder->filenameExtension() : m_filenameExtension;
}
-PassRefPtr<NativeImageSkia> DeferredImageDecoder::createFrameAtIndex(size_t index)
+bool DeferredImageDecoder::createFrameAtIndex(size_t index, SkBitmap* bitmap)
{
prepareLazyDecodedFrames();
if (index < m_frameData.size()) {
// ImageFrameGenerator has the latest known alpha state. There will
// be a performance boost if this frame is opaque.
- SkBitmap bitmap = createBitmap(index);
+ *bitmap = createBitmap(index);
if (m_frameGenerator->hasAlpha(index)) {
m_frameData[index].m_hasAlpha = true;
- bitmap.setAlphaType(kPremul_SkAlphaType);
+ bitmap->setAlphaType(kPremul_SkAlphaType);
} else {
m_frameData[index].m_hasAlpha = false;
- bitmap.setAlphaType(kOpaque_SkAlphaType);
+ bitmap->setAlphaType(kOpaque_SkAlphaType);
}
m_frameData[index].m_frameBytes = m_size.area() * sizeof(ImageFrame::PixelData);
- return NativeImageSkia::create(bitmap);
+ return true;
}
if (m_actualDecoder) {
ImageFrame* buffer = m_actualDecoder->frameBufferAtIndex(index);
if (!buffer || buffer->status() == ImageFrame::FrameEmpty)
- return nullptr;
- return buffer->asNewNativeImage();
+ return false;
+ *bitmap = buffer->bitmap();
+ return true;
}
- return nullptr;
+ return false;
}
void DeferredImageDecoder::setData(SharedBuffer& data, bool allDataReceived)
« no previous file with comments | « Source/platform/graphics/DeferredImageDecoder.h ('k') | Source/platform/graphics/DeferredImageDecoderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698