OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void* m_planes[3]; | 62 void* m_planes[3]; |
63 size_t m_rowBytes[3]; | 63 size_t m_rowBytes[3]; |
64 }; | 64 }; |
65 | 65 |
66 // ImageDecoder is a base for all format-specific decoders | 66 // ImageDecoder is a base for all format-specific decoders |
67 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. | 67 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. |
68 // | 68 // |
69 class PLATFORM_EXPORT ImageDecoder { | 69 class PLATFORM_EXPORT ImageDecoder { |
70 WTF_MAKE_NONCOPYABLE(ImageDecoder); WTF_MAKE_FAST_ALLOCATED; | 70 WTF_MAKE_NONCOPYABLE(ImageDecoder); WTF_MAKE_FAST_ALLOCATED; |
71 public: | 71 public: |
| 72 enum SizeType { ActualSize, SizeForMemoryAllocation }; |
| 73 |
72 static const size_t noDecodedImageByteLimit = blink::Platform::noDecodedImag
eByteLimit; | 74 static const size_t noDecodedImageByteLimit = blink::Platform::noDecodedImag
eByteLimit; |
73 | 75 |
74 ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColo
rProfileOption gammaAndColorProfileOption, size_t maxDecodedBytes) | 76 ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColo
rProfileOption gammaAndColorProfileOption, size_t maxDecodedBytes) |
75 : m_premultiplyAlpha(alphaOption == ImageSource::AlphaPremultiplied) | 77 : m_premultiplyAlpha(alphaOption == ImageSource::AlphaPremultiplied) |
76 , m_ignoreGammaAndColorProfile(gammaAndColorProfileOption == ImageSource
::GammaAndColorProfileIgnored) | 78 , m_ignoreGammaAndColorProfile(gammaAndColorProfileOption == ImageSource
::GammaAndColorProfileIgnored) |
77 , m_maxDecodedBytes(maxDecodedBytes) | 79 , m_maxDecodedBytes(maxDecodedBytes) |
78 , m_sizeAvailable(false) | 80 , m_sizeAvailable(false) |
79 , m_isAllDataReceived(false) | 81 , m_isAllDataReceived(false) |
80 , m_failed(false) { } | 82 , m_failed(false) { } |
81 | 83 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 115 } |
114 | 116 |
115 virtual IntSize size() const { return m_size; } | 117 virtual IntSize size() const { return m_size; } |
116 | 118 |
117 // Decoders which downsample images should override this method to | 119 // Decoders which downsample images should override this method to |
118 // return the actual decoded size. | 120 // return the actual decoded size. |
119 virtual IntSize decodedSize() const { return size(); } | 121 virtual IntSize decodedSize() const { return size(); } |
120 | 122 |
121 // Decoders which support YUV decoding can override this to | 123 // Decoders which support YUV decoding can override this to |
122 // give potentially different sizes per component. | 124 // give potentially different sizes per component. |
123 virtual IntSize decodedYUVSize(int component) const { return decodedSize();
} | 125 virtual IntSize decodedYUVSize(int component, SizeType) const { return decod
edSize(); } |
124 | 126 |
125 // This will only differ from size() for ICO (where each frame is a | 127 // This will only differ from size() for ICO (where each frame is a |
126 // different icon) or other formats where different frames are different | 128 // different icon) or other formats where different frames are different |
127 // sizes. This does NOT differ from size() for GIF or WebP, since | 129 // sizes. This does NOT differ from size() for GIF or WebP, since |
128 // decoding GIF or WebP composites any smaller frames against previous | 130 // decoding GIF or WebP composites any smaller frames against previous |
129 // frames to create full-size frames. | 131 // frames to create full-size frames. |
130 virtual IntSize frameSizeAtIndex(size_t) const | 132 virtual IntSize frameSizeAtIndex(size_t) const |
131 { | 133 { |
132 return size(); | 134 return size(); |
133 } | 135 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 325 |
324 IntSize m_size; | 326 IntSize m_size; |
325 bool m_sizeAvailable; | 327 bool m_sizeAvailable; |
326 bool m_isAllDataReceived; | 328 bool m_isAllDataReceived; |
327 bool m_failed; | 329 bool m_failed; |
328 }; | 330 }; |
329 | 331 |
330 } // namespace blink | 332 } // namespace blink |
331 | 333 |
332 #endif | 334 #endif |
OLD | NEW |