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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
43 | 43 |
44 #if USE(QCMSLIB) | 44 #if USE(QCMSLIB) |
45 #include "qcms.h" | 45 #include "qcms.h" |
46 #endif | 46 #endif |
47 | 47 |
48 typedef Vector<char> ColorProfile; | 48 typedef Vector<char> ColorProfile; |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
| 52 enum DecodedImageType { |
| 53 // These values are histogrammed over time; do not change their ordinal |
| 54 // values. When deleting an image type, replace it with a dummy value; |
| 55 // when adding an image type, do so at the bottom (and update DecodedImageTy
peMax). |
| 56 // Also, this enum should be in sync with the 'DecodedImageType' enum in |
| 57 // tools/metrics/histograms/histograms.xml |
| 58 ImageUnknown = 0, |
| 59 ImageJPEG, |
| 60 ImagePNG, |
| 61 ImageGIF, |
| 62 ImageWebP, |
| 63 ImageICO, |
| 64 ImageBMP, |
| 65 |
| 66 DecodedImageTypeMax = ImageBMP // Must equal the last "real" image type abov
e. |
| 67 }; |
| 68 |
52 // ImagePlanes can be used to decode color components into provided buffers inst
ead of using an ImageFrame. | 69 // ImagePlanes can be used to decode color components into provided buffers inst
ead of using an ImageFrame. |
53 class PLATFORM_EXPORT ImagePlanes { | 70 class PLATFORM_EXPORT ImagePlanes { |
54 public: | 71 public: |
55 ImagePlanes(); | 72 ImagePlanes(); |
56 ImagePlanes(void* planes[3], size_t rowBytes[3]); | 73 ImagePlanes(void* planes[3], size_t rowBytes[3]); |
57 | 74 |
58 void* plane(int); | 75 void* plane(int); |
59 size_t rowBytes(int) const; | 76 size_t rowBytes(int) const; |
60 | 77 |
61 private: | 78 private: |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // returns that number. | 336 // returns that number. |
320 virtual size_t decodeFrameCount() { return 1; } | 337 virtual size_t decodeFrameCount() { return 1; } |
321 | 338 |
322 // Performs any additional setup of the requested frame after it has been | 339 // Performs any additional setup of the requested frame after it has been |
323 // initially created, e.g. setting a duration or disposal method. | 340 // initially created, e.g. setting a duration or disposal method. |
324 virtual void initializeNewFrame(size_t) { } | 341 virtual void initializeNewFrame(size_t) { } |
325 | 342 |
326 // Decodes the requested frame. | 343 // Decodes the requested frame. |
327 virtual void decode(size_t) = 0; | 344 virtual void decode(size_t) = 0; |
328 | 345 |
| 346 // Report image stats if it's NOT a trivial 1x1 image. |
| 347 void reportStats(DecodedImageType type) const |
| 348 { |
| 349 if (isDecodedSizeAvailable() && (size().width() > 1 || size().height() >
1)) { |
| 350 Platform::current()->histogramEnumeration("Blink.DecodedImageType",
type, DecodedImageTypeMax + 1); |
| 351 } |
| 352 } |
| 353 |
329 RefPtr<SharedBuffer> m_data; // The encoded data. | 354 RefPtr<SharedBuffer> m_data; // The encoded data. |
330 Vector<ImageFrame, 1> m_frameBufferCache; | 355 Vector<ImageFrame, 1> m_frameBufferCache; |
331 bool m_premultiplyAlpha; | 356 bool m_premultiplyAlpha; |
332 bool m_ignoreGammaAndColorProfile; | 357 bool m_ignoreGammaAndColorProfile; |
333 ImageOrientation m_orientation; | 358 ImageOrientation m_orientation; |
334 | 359 |
335 // The maximum amount of memory a decoded image should require. Ideally, | 360 // The maximum amount of memory a decoded image should require. Ideally, |
336 // image decoders should downsample large images to fit under this limit | 361 // image decoders should downsample large images to fit under this limit |
337 // (and then return the downsampled size from decodedSize()). Ignoring | 362 // (and then return the downsampled size from decodedSize()). Ignoring |
338 // this limit can cause excessive memory use or even crashes on low- | 363 // this limit can cause excessive memory use or even crashes on low- |
(...skipping 12 matching lines...) Expand all Loading... |
351 | 376 |
352 IntSize m_size; | 377 IntSize m_size; |
353 bool m_sizeAvailable; | 378 bool m_sizeAvailable; |
354 bool m_isAllDataReceived; | 379 bool m_isAllDataReceived; |
355 bool m_failed; | 380 bool m_failed; |
356 }; | 381 }; |
357 | 382 |
358 } // namespace blink | 383 } // namespace blink |
359 | 384 |
360 #endif | 385 #endif |
OLD | NEW |