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 17 matching lines...) Expand all Loading... |
28 #define ImageDecoder_h | 28 #define ImageDecoder_h |
29 | 29 |
30 #include "SkColorPriv.h" | 30 #include "SkColorPriv.h" |
31 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
32 #include "platform/SharedBuffer.h" | 32 #include "platform/SharedBuffer.h" |
33 #include "platform/graphics/ImageOrientation.h" | 33 #include "platform/graphics/ImageOrientation.h" |
34 #include "platform/image-decoders/ImageAnimation.h" | 34 #include "platform/image-decoders/ImageAnimation.h" |
35 #include "platform/image-decoders/ImageFrame.h" | 35 #include "platform/image-decoders/ImageFrame.h" |
36 #include "public/platform/Platform.h" | 36 #include "public/platform/Platform.h" |
37 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
| 38 #include "wtf/HashSet.h" |
38 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
40 #include "wtf/Threading.h" | 41 #include "wtf/Threading.h" |
41 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
42 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
43 | 44 |
44 #if USE(QCMSLIB) | 45 #if USE(QCMSLIB) |
45 #include "qcms.h" | 46 #include "qcms.h" |
46 #endif | 47 #endif |
47 | 48 |
48 typedef Vector<char> ColorProfile; | 49 typedef Vector<char> ColorProfile; |
| 50 typedef HashSet<size_t, WTF::IntHash<size_t>, WTF::UnsignedWithZeroKeyHashTraits
<size_t>> SizeTHashSet; |
49 | 51 |
50 namespace blink { | 52 namespace blink { |
51 | 53 |
52 // ImagePlanes can be used to decode color components into provided buffers inst
ead of using an ImageFrame. | 54 // ImagePlanes can be used to decode color components into provided buffers inst
ead of using an ImageFrame. |
53 class PLATFORM_EXPORT ImagePlanes final { | 55 class PLATFORM_EXPORT ImagePlanes final { |
54 USING_FAST_MALLOC(ImagePlanes); | 56 USING_FAST_MALLOC(ImagePlanes); |
55 WTF_MAKE_NONCOPYABLE(ImagePlanes); | 57 WTF_MAKE_NONCOPYABLE(ImagePlanes); |
56 public: | 58 public: |
57 ImagePlanes(); | 59 ImagePlanes(); |
58 ImagePlanes(void* planes[3], size_t rowBytes[3]); | 60 ImagePlanes(void* planes[3], size_t rowBytes[3]); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // returns that number. | 329 // returns that number. |
328 virtual size_t decodeFrameCount() { return 1; } | 330 virtual size_t decodeFrameCount() { return 1; } |
329 | 331 |
330 // Performs any additional setup of the requested frame after it has been | 332 // Performs any additional setup of the requested frame after it has been |
331 // initially created, e.g. setting a duration or disposal method. | 333 // initially created, e.g. setting a duration or disposal method. |
332 virtual void initializeNewFrame(size_t) { } | 334 virtual void initializeNewFrame(size_t) { } |
333 | 335 |
334 // Decodes the requested frame. | 336 // Decodes the requested frame. |
335 virtual void decode(size_t) = 0; | 337 virtual void decode(size_t) = 0; |
336 | 338 |
| 339 // Clears decoded pixel data from all frames except the provided frames. |
| 340 // Callers may pass WTF::kNotFound to clear all frames. |
| 341 // Note: If |m_frameBufferCache| contains only one frame, it won't be cleare
d. |
| 342 // Returns the number of bytes of frame data actually cleared. |
| 343 size_t clearCacheExceptFrames(const SizeTHashSet&); |
| 344 |
337 RefPtr<SharedBuffer> m_data; // The encoded data. | 345 RefPtr<SharedBuffer> m_data; // The encoded data. |
338 Vector<ImageFrame, 1> m_frameBufferCache; | 346 Vector<ImageFrame, 1> m_frameBufferCache; |
339 bool m_premultiplyAlpha; | 347 bool m_premultiplyAlpha; |
340 bool m_ignoreGammaAndColorProfile; | 348 bool m_ignoreGammaAndColorProfile; |
341 ImageOrientation m_orientation; | 349 ImageOrientation m_orientation; |
342 | 350 |
343 // The maximum amount of memory a decoded image should require. Ideally, | 351 // The maximum amount of memory a decoded image should require. Ideally, |
344 // image decoders should downsample large images to fit under this limit | 352 // image decoders should downsample large images to fit under this limit |
345 // (and then return the downsampled size from decodedSize()). Ignoring | 353 // (and then return the downsampled size from decodedSize()). Ignoring |
346 // this limit can cause excessive memory use or even crashes on low- | 354 // this limit can cause excessive memory use or even crashes on low- |
(...skipping 12 matching lines...) Expand all Loading... |
359 | 367 |
360 IntSize m_size; | 368 IntSize m_size; |
361 bool m_sizeAvailable; | 369 bool m_sizeAvailable; |
362 bool m_isAllDataReceived; | 370 bool m_isAllDataReceived; |
363 bool m_failed; | 371 bool m_failed; |
364 }; | 372 }; |
365 | 373 |
366 } // namespace blink | 374 } // namespace blink |
367 | 375 |
368 #endif | 376 #endif |
OLD | NEW |