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

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

Issue 985583002: Don't cache any SkBitmaps in DeferredImageDecoder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: done now 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
« no previous file with comments | « Source/platform/graphics/ImageSource.h ('k') | Source/platform/image-decoders/ImageAnimation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/ImageSource.cpp
diff --git a/Source/platform/graphics/ImageSource.cpp b/Source/platform/graphics/ImageSource.cpp
index febfecb721eb5749ec4a472cbbc18f8500017355..e8c9ca0088d7a95f07e43ea47f20fb09fef5fbec 100644
--- a/Source/platform/graphics/ImageSource.cpp
+++ b/Source/platform/graphics/ImageSource.cpp
@@ -48,16 +48,6 @@ size_t ImageSource::clearCacheExceptFrame(size_t clearExceptFrame)
return m_decoder ? m_decoder->clearCacheExceptFrame(clearExceptFrame) : 0;
}
-bool ImageSource::initialized() const
-{
- return m_decoder;
-}
-
-void ImageSource::resetDecoder()
-{
- m_decoder.clear();
-}
-
void ImageSource::setData(SharedBuffer& data, bool allDataReceived)
{
// Create a decoder by sniffing the encoded data. If insufficient data bytes are available to
@@ -95,7 +85,7 @@ IntSize ImageSource::frameSizeAtIndex(size_t index, RespectImageOrientationEnum
return IntSize();
IntSize size = m_decoder->frameSizeAtIndex(index);
- if ((shouldRespectOrientation == RespectImageOrientation) && m_decoder->orientation().usesWidthAsHeight())
+ if ((shouldRespectOrientation == RespectImageOrientation) && m_decoder->orientationAtIndex(index).usesWidthAsHeight())
return IntSize(size.height(), size.width());
return size;
@@ -113,26 +103,15 @@ int ImageSource::repetitionCount()
size_t ImageSource::frameCount() const
{
- return m_decoder ? m_decoder->frameCount() : 0;
+ int count = m_decoder ? m_decoder->frameCount() : 0;
+ return count;
}
PassRefPtr<NativeImageSkia> ImageSource::createFrameAtIndex(size_t index)
{
if (!m_decoder)
return nullptr;
-
- ImageFrame* buffer = m_decoder->frameBufferAtIndex(index);
- if (!buffer || buffer->status() == ImageFrame::FrameEmpty)
- return nullptr;
-
- // Zero-height images can cause problems for some ports. If we have an
- // empty image dimension, just bail.
- if (size().isEmpty())
- return nullptr;
-
- // Return the buffer contents as a native image. For some ports, the data
- // is already in a native container, and this just increments its refcount.
- return buffer->asNewNativeImage();
+ return m_decoder->createFrameAtIndex(index);
}
float ImageSource::frameDurationAtIndex(size_t index) const
@@ -150,9 +129,9 @@ float ImageSource::frameDurationAtIndex(size_t index) const
return duration;
}
-ImageOrientation ImageSource::orientationAtIndex(size_t) const
+ImageOrientation ImageSource::orientationAtIndex(size_t index) const
{
- return m_decoder ? m_decoder->orientation() : DefaultImageOrientation;
+ return m_decoder ? m_decoder->orientationAtIndex(index) : DefaultImageOrientation;
}
bool ImageSource::frameHasAlphaAtIndex(size_t index) const
« no previous file with comments | « Source/platform/graphics/ImageSource.h ('k') | Source/platform/image-decoders/ImageAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698