| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // For testing. |factory| will overwrite the default ImageDecoder creation l
ogic if |factory->create()| returns non-zero. | 89 // For testing. |factory| will overwrite the default ImageDecoder creation l
ogic if |factory->create()| returns non-zero. |
| 90 void setImageDecoderFactory(PassOwnPtr<ImageDecoderFactory> factory) { m_ima
geDecoderFactory = factory; } | 90 void setImageDecoderFactory(PassOwnPtr<ImageDecoderFactory> factory) { m_ima
geDecoderFactory = factory; } |
| 91 | 91 |
| 92 // These methods are called while m_decodeMutex is locked. | 92 // These methods are called while m_decodeMutex is locked. |
| 93 SkBitmap tryToResumeDecode(const SkISize& scaledSize, size_t index); | 93 SkBitmap tryToResumeDecode(const SkISize& scaledSize, size_t index); |
| 94 | 94 |
| 95 // Use the given decoder to decode. If a decoder is not given then try to cr
eate one. | 95 // Use the given decoder to decode. If a decoder is not given then try to cr
eate one. |
| 96 // |complete| will be true if decoding was complete. | 96 // |complete| will be true if decoding was complete. |
| 97 SkBitmap decode(size_t index, ImageDecoder**, bool* complete); | 97 SkBitmap decode(size_t index, ImageDecoder**, bool* complete); |
| 98 | 98 |
| 99 // Return the next generation ID of a new image object. This is used | |
| 100 // to identify images of the same frame from different stages of | |
| 101 // progressive decode. | |
| 102 size_t nextGenerationId() { return m_decodeCount++; } | |
| 103 | |
| 104 SkISize m_fullSize; | 99 SkISize m_fullSize; |
| 105 ThreadSafeDataTransport m_data; | 100 ThreadSafeDataTransport m_data; |
| 106 bool m_isMultiFrame; | 101 bool m_isMultiFrame; |
| 107 bool m_decodeFailedAndEmpty; | 102 bool m_decodeFailedAndEmpty; |
| 108 Vector<bool> m_hasAlpha; | 103 Vector<bool> m_hasAlpha; |
| 109 size_t m_decodeCount; | 104 int m_decodeCount; |
| 110 OwnPtr<ExternalMemoryAllocator> m_externalAllocator; | 105 OwnPtr<ExternalMemoryAllocator> m_externalAllocator; |
| 111 | 106 |
| 112 OwnPtr<ImageDecoderFactory> m_imageDecoderFactory; | 107 OwnPtr<ImageDecoderFactory> m_imageDecoderFactory; |
| 113 | 108 |
| 114 // Prevents multiple decode operations on the same data. | 109 // Prevents multiple decode operations on the same data. |
| 115 Mutex m_decodeMutex; | 110 Mutex m_decodeMutex; |
| 116 | 111 |
| 117 // Protect concurrent access to m_hasAlpha. | 112 // Protect concurrent access to m_hasAlpha. |
| 118 Mutex m_alphaMutex; | 113 Mutex m_alphaMutex; |
| 119 }; | 114 }; |
| 120 | 115 |
| 121 } // namespace blink | 116 } // namespace blink |
| 122 | 117 |
| 123 #endif | 118 #endif |
| OLD | NEW |