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