Chromium Code Reviews| 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 #if USE(QCMSLIB) | 42 #if USE(QCMSLIB) |
| 43 #include "qcms.h" | 43 #include "qcms.h" |
| 44 #if OS(MACOSX) | 44 #if OS(MACOSX) |
| 45 #include <ApplicationServices/ApplicationServices.h> | 45 #include <ApplicationServices/ApplicationServices.h> |
| 46 #include "wtf/RetainPtr.h" | 46 #include "wtf/RetainPtr.h" |
| 47 #endif | 47 #endif |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 // DecodingBuffers can be used to decode color components into provided buffers instead of using an ImageFrame. | |
| 53 class DecodingBuffers { | |
|
Alpha Left Google
2014/07/24 22:07:27
This should be called ImagePlanes to be clear.
sugoi1
2014/07/24 23:16:35
Acknowledged.
| |
| 54 public: | |
| 55 DecodingBuffers(); | |
| 56 | |
| 57 void set(void* planes[3], size_t rowBytes[3]); | |
|
Alpha Left Google
2014/07/24 22:07:27
It will not always be 3 planes but it's good for n
sugoi1
2014/07/24 23:16:35
Acknowledged.
| |
| 58 void* getPlane(int); | |
|
Noel Gordon
2014/07/25 15:55:01
blink webcore convention: no "get" prefix in class
sugoi1
2014/07/25 16:56:48
Done.
| |
| 59 size_t getRowBytes(int) const; | |
| 60 | |
| 61 private: | |
| 62 void* m_planes[3]; | |
| 63 size_t m_rowBytes[3]; | |
| 64 }; | |
| 65 | |
| 52 // ImageDecoder is a base for all format-specific decoders | 66 // ImageDecoder is a base for all format-specific decoders |
| 53 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. | 67 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. |
| 54 // | 68 // |
| 55 class PLATFORM_EXPORT ImageDecoder { | 69 class PLATFORM_EXPORT ImageDecoder { |
| 56 WTF_MAKE_NONCOPYABLE(ImageDecoder); WTF_MAKE_FAST_ALLOCATED; | 70 WTF_MAKE_NONCOPYABLE(ImageDecoder); WTF_MAKE_FAST_ALLOCATED; |
| 57 public: | 71 public: |
| 58 static const size_t noDecodedImageByteLimit = blink::Platform::noDecodedImag eByteLimit; | 72 static const size_t noDecodedImageByteLimit = blink::Platform::noDecodedImag eByteLimit; |
| 59 | 73 |
| 60 ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColo rProfileOption gammaAndColorProfileOption, size_t maxDecodedBytes) | 74 ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColo rProfileOption gammaAndColorProfileOption, size_t maxDecodedBytes) |
| 61 : m_premultiplyAlpha(alphaOption == ImageSource::AlphaPremultiplied) | 75 : m_premultiplyAlpha(alphaOption == ImageSource::AlphaPremultiplied) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 // decode call out and use it here. | 107 // decode call out and use it here. |
| 94 virtual bool isSizeAvailable() | 108 virtual bool isSizeAvailable() |
| 95 { | 109 { |
| 96 return !m_failed && m_sizeAvailable; | 110 return !m_failed && m_sizeAvailable; |
| 97 } | 111 } |
| 98 | 112 |
| 99 virtual IntSize size() const { return m_size; } | 113 virtual IntSize size() const { return m_size; } |
| 100 | 114 |
| 101 // Decoders which downsample images should override this method to | 115 // Decoders which downsample images should override this method to |
| 102 // return the actual decoded size. | 116 // return the actual decoded size. |
| 103 virtual IntSize decodedSize() const { return size(); } | 117 virtual IntSize decodedSize(int component = 0) const { return size(); } |
|
Noel Gordon
2014/07/25 15:55:01
I believe the Androids might downsample when decod
sugoi1
2014/07/25 16:56:48
Looking at DecodingImageGenerator::onGetPixels() :
| |
| 104 | 118 |
| 105 // This will only differ from size() for ICO (where each frame is a | 119 // This will only differ from size() for ICO (where each frame is a |
| 106 // different icon) or other formats where different frames are different | 120 // different icon) or other formats where different frames are different |
| 107 // sizes. This does NOT differ from size() for GIF or WebP, since | 121 // sizes. This does NOT differ from size() for GIF or WebP, since |
| 108 // decoding GIF or WebP composites any smaller frames against previous | 122 // decoding GIF or WebP composites any smaller frames against previous |
| 109 // frames to create full-size frames. | 123 // frames to create full-size frames. |
| 110 virtual IntSize frameSizeAtIndex(size_t) const | 124 virtual IntSize frameSizeAtIndex(size_t) const |
| 111 { | 125 { |
| 112 return size(); | 126 return size(); |
| 113 } | 127 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator) | 258 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator) |
| 245 { | 259 { |
| 246 // FIXME: this doesn't work for images with multiple frames. | 260 // FIXME: this doesn't work for images with multiple frames. |
| 247 if (m_frameBufferCache.isEmpty()) { | 261 if (m_frameBufferCache.isEmpty()) { |
| 248 m_frameBufferCache.resize(1); | 262 m_frameBufferCache.resize(1); |
| 249 m_frameBufferCache[0].setRequiredPreviousFrameIndex( | 263 m_frameBufferCache[0].setRequiredPreviousFrameIndex( |
| 250 findRequiredPreviousFrame(0, false)); | 264 findRequiredPreviousFrame(0, false)); |
| 251 } | 265 } |
| 252 m_frameBufferCache[0].setMemoryAllocator(allocator); | 266 m_frameBufferCache[0].setMemoryAllocator(allocator); |
| 253 } | 267 } |
| 254 | 268 |
|
Alpha Left Google
2014/07/24 22:07:26
How do I know if the code that uses this decoder c
sugoi1
2014/07/24 23:16:35
I'm not sure I understand your question. The code
Alpha Left Google
2014/07/24 23:30:56
I mean there's different types of subsampling. My
sugoi1
2014/07/25 02:55:13
Well, the caller first receives the size of the Y,
| |
| 269 virtual void setAcceleratedYUVDecoding(bool) { } | |
|
Alpha Left Google
2014/07/24 22:07:26
nit: drop "accelerated" from methods names. Decodi
sugoi1
2014/07/24 23:16:35
Acknowledged.
| |
| 270 virtual bool acceleratedYUVDecoding() const { return false; } | |
| 271 virtual bool doAcceleratedYUVDecoding() { return false; } | |
| 272 virtual void setDecodingBuffers(OwnPtr<DecodingBuffers>&) { } | |
| 273 | |
| 255 protected: | 274 protected: |
| 256 // Calculates the most recent frame whose image data may be needed in | 275 // Calculates the most recent frame whose image data may be needed in |
| 257 // order to decode frame |frameIndex|, based on frame disposal methods | 276 // order to decode frame |frameIndex|, based on frame disposal methods |
| 258 // and |frameRectIsOpaque|, where |frameRectIsOpaque| signifies whether | 277 // and |frameRectIsOpaque|, where |frameRectIsOpaque| signifies whether |
| 259 // the rectangle of frame at |frameIndex| is known to be opaque. | 278 // the rectangle of frame at |frameIndex| is known to be opaque. |
| 260 // If no previous frame's data is required, returns WTF::kNotFound. | 279 // If no previous frame's data is required, returns WTF::kNotFound. |
| 261 // | 280 // |
| 262 // This function requires that the previous frame's | 281 // This function requires that the previous frame's |
| 263 // |m_requiredPreviousFrameIndex| member has been set correctly. The | 282 // |m_requiredPreviousFrameIndex| member has been set correctly. The |
| 264 // easiest way to ensure this is for subclasses to call this method and | 283 // easiest way to ensure this is for subclasses to call this method and |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 | 318 |
| 300 IntSize m_size; | 319 IntSize m_size; |
| 301 bool m_sizeAvailable; | 320 bool m_sizeAvailable; |
| 302 bool m_isAllDataReceived; | 321 bool m_isAllDataReceived; |
| 303 bool m_failed; | 322 bool m_failed; |
| 304 }; | 323 }; |
| 305 | 324 |
| 306 } // namespace blink | 325 } // namespace blink |
| 307 | 326 |
| 308 #endif | 327 #endif |
| OLD | NEW |