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