Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 1719533002: Modify YUV codecs to match Skia's API change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update DEPS again Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 typedef Vector<char> ColorProfile; 48 typedef Vector<char> ColorProfile;
49 49
50 namespace blink { 50 namespace blink {
51 51
52 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame. 52 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame.
53 class PLATFORM_EXPORT ImagePlanes final { 53 class PLATFORM_EXPORT ImagePlanes final {
54 USING_FAST_MALLOC(ImagePlanes); 54 USING_FAST_MALLOC(ImagePlanes);
55 WTF_MAKE_NONCOPYABLE(ImagePlanes); 55 WTF_MAKE_NONCOPYABLE(ImagePlanes);
56 public: 56 public:
57 ImagePlanes(); 57 ImagePlanes();
58 ImagePlanes(void* planes[3], size_t rowBytes[3]); 58 ImagePlanes(void* planes[3], const size_t rowBytes[3]);
59 59
60 void* plane(int); 60 void* plane(int);
61 size_t rowBytes(int) const; 61 size_t rowBytes(int) const;
62 62
63 private: 63 private:
64 void* m_planes[3]; 64 void* m_planes[3];
65 size_t m_rowBytes[3]; 65 size_t m_rowBytes[3];
66 }; 66 };
67 67
68 // ImageDecoder is a base for all format-specific decoders 68 // ImageDecoder is a base for all format-specific decoders
69 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. 69 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache.
70 // 70 //
71 class PLATFORM_EXPORT ImageDecoder { 71 class PLATFORM_EXPORT ImageDecoder {
72 WTF_MAKE_NONCOPYABLE(ImageDecoder); USING_FAST_MALLOC(ImageDecoder); 72 WTF_MAKE_NONCOPYABLE(ImageDecoder); USING_FAST_MALLOC(ImageDecoder);
73 public: 73 public:
74 enum SizeType { ActualSize, SizeForMemoryAllocation };
75
76 static const size_t noDecodedImageByteLimit = Platform::noDecodedImageByteLi mit; 74 static const size_t noDecodedImageByteLimit = Platform::noDecodedImageByteLi mit;
77 75
78 enum AlphaOption { 76 enum AlphaOption {
79 AlphaPremultiplied, 77 AlphaPremultiplied,
80 AlphaNotPremultiplied 78 AlphaNotPremultiplied
81 }; 79 };
82 80
83 enum GammaAndColorProfileOption { 81 enum GammaAndColorProfileOption {
84 GammaAndColorProfileApplied, 82 GammaAndColorProfileApplied,
85 GammaAndColorProfileIgnored 83 GammaAndColorProfileIgnored
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 { 127 {
130 return !m_failed && m_sizeAvailable; 128 return !m_failed && m_sizeAvailable;
131 } 129 }
132 130
133 virtual IntSize size() const { return m_size; } 131 virtual IntSize size() const { return m_size; }
134 132
135 // Decoders which downsample images should override this method to 133 // Decoders which downsample images should override this method to
136 // return the actual decoded size. 134 // return the actual decoded size.
137 virtual IntSize decodedSize() const { return size(); } 135 virtual IntSize decodedSize() const { return size(); }
138 136
139 // Decoders which support YUV decoding can override this to 137 // Image decoders that support YUV decoding must override this to
140 // give potentially different sizes per component. 138 // provide the size of each component.
141 virtual IntSize decodedYUVSize(int component, SizeType) const { return decod edSize(); } 139 virtual IntSize decodedYUVSize(int component) const
140 {
141 ASSERT(false);
142 return IntSize();
143 }
144
145 // Image decoders that support YUV decoding must override this to
146 // return the width of each row of the memory allocation.
147 virtual size_t decodedYUVWidthBytes(int component) const
148 {
149 ASSERT(false);
150 return 0;
151 }
142 152
143 // This will only differ from size() for ICO (where each frame is a 153 // This will only differ from size() for ICO (where each frame is a
144 // different icon) or other formats where different frames are different 154 // different icon) or other formats where different frames are different
145 // sizes. This does NOT differ from size() for GIF or WebP, since 155 // sizes. This does NOT differ from size() for GIF or WebP, since
146 // decoding GIF or WebP composites any smaller frames against previous 156 // decoding GIF or WebP composites any smaller frames against previous
147 // frames to create full-size frames. 157 // frames to create full-size frames.
148 virtual IntSize frameSizeAtIndex(size_t) const 158 virtual IntSize frameSizeAtIndex(size_t) const
149 { 159 {
150 return size(); 160 return size();
151 } 161 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 369
360 IntSize m_size; 370 IntSize m_size;
361 bool m_sizeAvailable; 371 bool m_sizeAvailable;
362 bool m_isAllDataReceived; 372 bool m_isAllDataReceived;
363 bool m_failed; 373 bool m_failed;
364 }; 374 };
365 375
366 } // namespace blink 376 } // namespace blink
367 377
368 #endif 378 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698