diff options
Diffstat (limited to 'WebCore/platform/image-decoders/ImageDecoder.h')
-rw-r--r-- | WebCore/platform/image-decoders/ImageDecoder.h | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index 535efa1..3ca7abf 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2008-2009 Torch Mobile, Inc. + * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without @@ -203,12 +204,11 @@ namespace WebCore { // biggest size that decoded images can have. Image decoders will deflate those // images that are bigger than m_maxNumPixels. (Not supported by all image decoders yet) ImageDecoder() - : m_failed(false) + : m_scaled(false) + , m_failed(false) , m_sizeAvailable(false) -#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , m_isAllDataReceived(false) , m_maxNumPixels(-1) - , m_scaled(false) -#endif { } @@ -223,7 +223,12 @@ namespace WebCore { virtual String filenameExtension() const = 0; // All specific decoder plugins must do something with the data they are given. - virtual void setData(SharedBuffer* data, bool allDataReceived) { m_data = data; } + bool isAllDataReceived() const { return m_isAllDataReceived; } + virtual void setData(SharedBuffer* data, bool allDataReceived) + { + m_data = data; + m_isAllDataReceived = allDataReceived; + } // Whether or not the size information has been decoded yet. This default // implementation just returns true if the size has been set and we have not @@ -237,11 +242,14 @@ namespace WebCore { // Returns the size of the image. virtual IntSize size() const { - // Requesting the size of an invalid bitmap is meaningless. - ASSERT(!m_failed); return m_size; } + IntSize scaledSize() const + { + return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size()) : size(); + } + // Returns the size of frame |index|. This will only differ from size() // for formats where different frames are different sizes (namely ICO, // where each frame represents a different icon within the master file). @@ -300,20 +308,17 @@ namespace WebCore { #endif protected: -#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) void prepareScaleDataIfNecessary(); int upperBoundScaledX(int origX, int searchStart = 0); int lowerBoundScaledX(int origX, int searchStart = 0); + int upperBoundScaledY(int origY, int searchStart = 0); + int lowerBoundScaledY(int origY, int searchStart = 0); int scaledY(int origY, int searchStart = 0); -#endif RefPtr<SharedBuffer> m_data; // The encoded data. -#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) - int m_maxNumPixels; Vector<int> m_scaledColumns; Vector<int> m_scaledRows; bool m_scaled; -#endif Vector<RGBA32Buffer> m_frameBufferCache; bool m_failed; @@ -331,6 +336,8 @@ namespace WebCore { IntSize m_size; bool m_sizeAvailable; + bool m_isAllDataReceived; + int m_maxNumPixels; }; } // namespace WebCore |