Index: Source/platform/graphics/ImageSource.cpp |
diff --git a/Source/platform/graphics/ImageSource.cpp b/Source/platform/graphics/ImageSource.cpp |
index 68ce34edfc3b82f8253961589f4e930d8d5e8a95..c87e32bf98f7f05f84c9b311cae69eb720e2df9b 100644 |
--- a/Source/platform/graphics/ImageSource.cpp |
+++ b/Source/platform/graphics/ImageSource.cpp |
@@ -30,8 +30,6 @@ |
#include "platform/graphics/DeferredImageDecoder.h" |
#include "platform/image-decoders/ImageDecoder.h" |
-#include "wtf/PassOwnPtr.h" |
-#include "wtf/PassRefPtr.h" |
namespace WebCore { |
@@ -55,12 +53,15 @@ bool ImageSource::initialized() const |
return m_decoder; |
} |
+void ImageSource::resetDecoder() |
+{ |
+ m_decoder.clear(); |
+} |
+ |
void ImageSource::setData(SharedBuffer& data, bool allDataReceived) |
{ |
- // Make the decoder by sniffing the bytes. |
- // This method will examine the data and instantiate an instance of the appropriate decoder plugin. |
- // If insufficient bytes are available to determine the image type, no decoder plugin will be |
- // made. |
+ // Create a decoder by sniffing the encoded data. If insufficient data bytes are available to |
+ // determine the encoded image type, no decoder is created. |
if (!m_decoder) |
m_decoder = DeferredImageDecoder::create(data, m_alphaOption, m_gammaAndColorProfileOption); |
@@ -83,6 +84,11 @@ bool ImageSource::hasColorProfile() const |
return m_decoder && m_decoder->hasColorProfile(); |
} |
+PassRefPtr<ColorSpaceProfile> ImageSource::colorProfile() const |
+{ |
+ return m_decoder ? m_decoder->colorProfile() : nullptr; |
+} |
+ |
IntSize ImageSource::size(RespectImageOrientationEnum shouldRespectOrientation) const |
{ |
return frameSizeAtIndex(0, shouldRespectOrientation); |
@@ -166,9 +172,7 @@ bool ImageSource::frameIsCompleteAtIndex(size_t index) const |
unsigned ImageSource::frameBytesAtIndex(size_t index) const |
{ |
- if (!m_decoder) |
- return 0; |
- return m_decoder->frameBytesAtIndex(index); |
+ return m_decoder ? m_decoder->frameBytesAtIndex(index) : 0; |
} |
} |