| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2012 Google Inc. All rights reserved. | 2  * Copyright (C) 2012 Google Inc. All rights reserved. | 
| 3  * | 3  * | 
| 4  * Redistribution and use in source and binary forms, with or without | 4  * Redistribution and use in source and binary forms, with or without | 
| 5  * modification, are permitted provided that the following conditions | 5  * modification, are permitted provided that the following conditions | 
| 6  * are met: | 6  * are met: | 
| 7  * 1. Redistributions of source code must retain the above copyright | 7  * 1. Redistributions of source code must retain the above copyright | 
| 8  *    notice, this list of conditions and the following disclaimer. | 8  *    notice, this list of conditions and the following disclaimer. | 
| 9  * 2. Redistributions in binary form must reproduce the above copyright | 9  * 2. Redistributions in binary form must reproduce the above copyright | 
| 10  *    notice, this list of conditions and the following disclaimer in the | 10  *    notice, this list of conditions and the following disclaimer in the | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 34 #include "platform/graphics/ImageFrameGenerator.h" | 34 #include "platform/graphics/ImageFrameGenerator.h" | 
| 35 #include "platform/image-decoders/ImageDecoder.h" | 35 #include "platform/image-decoders/ImageDecoder.h" | 
| 36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" | 
| 37 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" | 
| 38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" | 
| 39 | 39 | 
| 40 class SkImage; | 40 class SkImage; | 
| 41 | 41 | 
| 42 namespace blink { | 42 namespace blink { | 
| 43 | 43 | 
|  | 44 class ColorSpaceProfile; | 
| 44 class ImageFrameGenerator; | 45 class ImageFrameGenerator; | 
| 45 class SharedBuffer; | 46 class SharedBuffer; | 
| 46 | 47 | 
| 47 class PLATFORM_EXPORT DeferredImageDecoder { | 48 class PLATFORM_EXPORT DeferredImageDecoder { | 
| 48     WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); | 49     WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); | 
| 49 public: | 50 public: | 
| 50     ~DeferredImageDecoder(); | 51     ~DeferredImageDecoder(); | 
| 51     static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
     geDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); | 52     static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
     geDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); | 
| 52 | 53 | 
| 53     static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
     oder>); | 54     static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
     oder>); | 
| 54 | 55 | 
| 55     static void setEnabled(bool); | 56     static void setEnabled(bool); | 
| 56     static bool enabled(); | 57     static bool enabled(); | 
| 57 | 58 | 
| 58     String filenameExtension() const; | 59     String filenameExtension() const; | 
| 59 | 60 | 
| 60     PassRefPtr<SkImage> createFrameAtIndex(size_t); | 61     PassRefPtr<SkImage> createFrameAtIndex(size_t); | 
| 61 | 62 | 
| 62     void setData(SharedBuffer& data, bool allDataReceived); | 63     void setData(SharedBuffer& data, bool allDataReceived); | 
| 63 | 64 | 
| 64     bool isSizeAvailable(); | 65     bool isSizeAvailable(); | 
| 65     bool hasColorProfile() const; | 66     bool hasColorProfile() const; | 
|  | 67     PassRefPtr<ColorSpaceProfile> colorProfile() const; | 
|  | 68     void setDeviceProfile(ColorSpaceProfile*); | 
| 66     IntSize size() const; | 69     IntSize size() const; | 
| 67     IntSize frameSizeAtIndex(size_t index) const; | 70     IntSize frameSizeAtIndex(size_t index) const; | 
| 68     size_t frameCount(); | 71     size_t frameCount(); | 
| 69     int repetitionCount() const; | 72     int repetitionCount() const; | 
| 70     size_t clearCacheExceptFrame(size_t); | 73     size_t clearCacheExceptFrame(size_t); | 
| 71     bool frameHasAlphaAtIndex(size_t index) const; | 74     bool frameHasAlphaAtIndex(size_t index) const; | 
| 72     bool frameIsCompleteAtIndex(size_t) const; | 75     bool frameIsCompleteAtIndex(size_t) const; | 
| 73     float frameDurationAtIndex(size_t) const; | 76     float frameDurationAtIndex(size_t) const; | 
| 74     size_t frameBytesAtIndex(size_t index) const; | 77     size_t frameBytesAtIndex(size_t index) const; | 
| 75     ImageOrientation orientationAtIndex(size_t index) const; | 78     ImageOrientation orientationAtIndex(size_t index) const; | 
| 76     bool hotSpot(IntPoint&) const; | 79     bool hotSpot(IntPoint&) const; | 
| 77 | 80 | 
| 78     // For testing. | 81     // For testing. | 
| 79     ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } | 82     ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } | 
| 80 | 83 | 
| 81 private: | 84 private: | 
| 82     explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); | 85     explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); | 
| 83     void prepareLazyDecodedFrames(); | 86     void prepareLazyDecodedFrames(); | 
| 84     PassRefPtr<SkImage> createImage(size_t index, bool knownToBeOpaque) const; | 87     PassRefPtr<SkImage> createImage(size_t index, bool knownToBeOpaque) const; | 
| 85     void activateLazyDecoding(); | 88     void activateLazyDecoding(); | 
| 86 | 89 | 
| 87     RefPtr<SharedBuffer> m_data; | 90     RefPtr<SharedBuffer> m_data; | 
| 88     bool m_allDataReceived; | 91     bool m_allDataReceived; | 
| 89     unsigned m_lastDataSize; | 92     unsigned m_lastDataSize; | 
| 90     OwnPtr<ImageDecoder> m_actualDecoder; | 93     OwnPtr<ImageDecoder> m_actualDecoder; | 
| 91 | 94 | 
| 92     String m_filenameExtension; | 95     String m_filenameExtension; | 
| 93     IntSize m_size; | 96     IntSize m_size; | 
| 94     int m_repetitionCount; | 97     int m_repetitionCount; | 
|  | 98 | 
| 95     bool m_hasColorProfile; | 99     bool m_hasColorProfile; | 
|  | 100     RefPtr<ColorSpaceProfile> m_colorProfile; | 
|  | 101     RefPtr<ColorSpaceProfile> m_deviceProfile; | 
| 96 | 102 | 
| 97     // Carries only frame state and other information. Does not carry bitmap. | 103     // Carries only frame state and other information. Does not carry bitmap. | 
| 98     Vector<FrameData> m_frameData; | 104     Vector<FrameData> m_frameData; | 
| 99     RefPtr<ImageFrameGenerator> m_frameGenerator; | 105     RefPtr<ImageFrameGenerator> m_frameGenerator; | 
| 100 | 106 | 
| 101     static bool s_enabled; | 107     static bool s_enabled; | 
| 102 }; | 108 }; | 
| 103 | 109 | 
| 104 } // namespace blink | 110 } // namespace blink | 
| 105 | 111 | 
| 106 #endif | 112 #endif | 
| OLD | NEW | 
|---|