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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR
efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false) | 59 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR
efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false) |
60 { | 60 { |
61 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived,
isMultiFrame)); | 61 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived,
isMultiFrame)); |
62 } | 62 } |
63 | 63 |
64 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool
allDataReceived, bool isMultiFrame); | 64 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool
allDataReceived, bool isMultiFrame); |
65 ~ImageFrameGenerator(); | 65 ~ImageFrameGenerator(); |
66 | 66 |
67 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t
index = 0); | 67 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t
index = 0); |
68 | 68 |
69 // Decodes and scales the specified frame indicated by |index|. Dimensions | |
70 // and output format are specified in |info|. Decoded pixels are written | |
71 // into |pixels| with a stride of |rowBytes|. | |
72 // | |
73 // Returns true if decoding was successful. | |
74 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r
owBytes); | |
75 | |
76 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); | 69 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); |
77 | 70 |
78 // Creates a new SharedBuffer containing the data received so far. | 71 // Creates a new SharedBuffer containing the data received so far. |
79 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); | 72 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); |
80 | 73 |
81 SkISize getFullSize() const { return m_fullSize; } | 74 SkISize getFullSize() const { return m_fullSize; } |
82 | 75 |
83 bool isMultiFrame() const { return m_isMultiFrame; } | 76 bool isMultiFrame() const { return m_isMultiFrame; } |
84 | 77 |
85 // FIXME: Return alpha state for each frame. | 78 // FIXME: Return alpha state for each frame. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Prevents multiple decode operations on the same data. | 113 // Prevents multiple decode operations on the same data. |
121 Mutex m_decodeMutex; | 114 Mutex m_decodeMutex; |
122 | 115 |
123 // Protect concurrent access to m_hasAlpha. | 116 // Protect concurrent access to m_hasAlpha. |
124 Mutex m_alphaMutex; | 117 Mutex m_alphaMutex; |
125 }; | 118 }; |
126 | 119 |
127 } // namespace WebCore | 120 } // namespace WebCore |
128 | 121 |
129 #endif | 122 #endif |
OLD | NEW |