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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); | 45 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); |
46 public: | 46 public: |
47 ~DeferredImageDecoder(); | 47 ~DeferredImageDecoder(); |
48 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
geSource::AlphaOption, ImageSource::GammaAndColorProfileOption); | 48 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
geSource::AlphaOption, ImageSource::GammaAndColorProfileOption); |
49 | 49 |
50 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
oder>); | 50 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
oder>); |
51 | 51 |
52 static bool isLazyDecoded(const SkBitmap&); | 52 static bool isLazyDecoded(const SkBitmap&); |
53 | 53 |
54 static void setEnabled(bool); | 54 static void setEnabled(bool); |
55 static void setSkiaDiscardableMemoryEnabled(bool); | |
56 | 55 |
57 String filenameExtension() const; | 56 String filenameExtension() const; |
58 | 57 |
59 ImageFrame* frameBufferAtIndex(size_t index); | 58 ImageFrame* frameBufferAtIndex(size_t index); |
60 | 59 |
61 void setData(SharedBuffer* data, bool allDataReceived); | 60 void setData(SharedBuffer* data, bool allDataReceived); |
62 | 61 |
63 bool isSizeAvailable(); | 62 bool isSizeAvailable(); |
64 IntSize size() const; | 63 IntSize size() const; |
65 IntSize frameSizeAtIndex(size_t index) const; | 64 IntSize frameSizeAtIndex(size_t index) const; |
66 size_t frameCount(); | 65 size_t frameCount(); |
67 int repetitionCount() const; | 66 int repetitionCount() const; |
68 size_t clearCacheExceptFrame(size_t); | 67 size_t clearCacheExceptFrame(size_t); |
69 bool frameHasAlphaAtIndex(size_t index) const; | 68 bool frameHasAlphaAtIndex(size_t index) const; |
70 bool frameIsCompleteAtIndex(size_t) const; | 69 bool frameIsCompleteAtIndex(size_t) const; |
71 float frameDurationAtIndex(size_t) const; | 70 float frameDurationAtIndex(size_t) const; |
72 unsigned frameBytesAtIndex(size_t index) const; | 71 unsigned frameBytesAtIndex(size_t index) const; |
73 ImageOrientation orientation() const; | 72 ImageOrientation orientation() const; |
74 bool hotSpot(IntPoint&) const; | 73 bool hotSpot(IntPoint&) const; |
75 | 74 |
76 // For testing. | 75 // For testing. |
77 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } | 76 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } |
78 | 77 |
79 private: | 78 private: |
80 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); | 79 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); |
81 void prepareLazyDecodedFrames(); | 80 void prepareLazyDecodedFrames(); |
82 SkBitmap createBitmap(size_t index); | |
83 SkBitmap createSkiaDiscardableBitmap(size_t index); | |
84 SkBitmap createLazyDecodingBitmap(size_t index); | 81 SkBitmap createLazyDecodingBitmap(size_t index); |
85 void activateLazyDecoding(); | 82 void activateLazyDecoding(); |
86 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); | 83 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); |
87 | 84 |
88 RefPtr<SharedBuffer> m_data; | 85 RefPtr<SharedBuffer> m_data; |
89 bool m_allDataReceived; | 86 bool m_allDataReceived; |
90 OwnPtr<ImageDecoder> m_actualDecoder; | 87 OwnPtr<ImageDecoder> m_actualDecoder; |
91 | 88 |
92 String m_filenameExtension; | 89 String m_filenameExtension; |
93 IntSize m_size; | 90 IntSize m_size; |
94 ImageOrientation m_orientation; | 91 ImageOrientation m_orientation; |
95 int m_repetitionCount; | 92 int m_repetitionCount; |
96 | 93 |
97 Vector<OwnPtr<ImageFrame> > m_lazyDecodedFrames; | 94 Vector<OwnPtr<ImageFrame> > m_lazyDecodedFrames; |
98 RefPtr<ImageFrameGenerator> m_frameGenerator; | 95 RefPtr<ImageFrameGenerator> m_frameGenerator; |
99 | 96 |
100 static bool s_enabled; | 97 static bool s_enabled; |
101 static bool s_skiaDiscardableMemoryEnabled; | |
102 }; | 98 }; |
103 | 99 |
104 } // namespace WebCore | 100 } // namespace WebCore |
105 | 101 |
106 #endif | 102 #endif |
OLD | NEW |