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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h

Issue 2398453002: Rewrap comments to 80 columns in Source/platform/graphics/. (Closed)
Patch Set: Review feedback Created 4 years, 2 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 WTF_MAKE_NONCOPYABLE(ImageFrameGenerator); 63 WTF_MAKE_NONCOPYABLE(ImageFrameGenerator);
64 64
65 public: 65 public:
66 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, 66 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize,
67 bool isMultiFrame = false) { 67 bool isMultiFrame = false) {
68 return adoptRef(new ImageFrameGenerator(fullSize, isMultiFrame)); 68 return adoptRef(new ImageFrameGenerator(fullSize, isMultiFrame));
69 } 69 }
70 70
71 ~ImageFrameGenerator(); 71 ~ImageFrameGenerator();
72 72
73 // Decodes and scales the specified frame at |index|. The dimensions and outpu t 73 // Decodes and scales the specified frame at |index|. The dimensions and
74 // format are given in SkImageInfo. Decoded pixels are written into |pixels| w ith 74 // output format are given in SkImageInfo. Decoded pixels are written into
75 // a stride of |rowBytes|. Returns true if decoding was successful. 75 // |pixels| with a stride of |rowBytes|. Returns true if decoding was
76 // successful.
76 bool decodeAndScale(SegmentReader*, 77 bool decodeAndScale(SegmentReader*,
77 bool allDataReceived, 78 bool allDataReceived,
78 size_t index, 79 size_t index,
79 const SkImageInfo&, 80 const SkImageInfo&,
80 void* pixels, 81 void* pixels,
81 size_t rowBytes); 82 size_t rowBytes);
82 83
83 // Decodes YUV components directly into the provided memory planes. 84 // Decodes YUV components directly into the provided memory planes. Must not
84 // Must not be called unless getYUVComponentSizes has been called and returned true. 85 // be called unless getYUVComponentSizes has been called and returned true.
85 // YUV decoding does not currently support progressive decoding. In order to s upport it, ImageDecoder needs something 86 // YUV decoding does not currently support progressive decoding. In order to
86 // analagous to its ImageFrame cache to hold partial planes, and the GPU code needs to handle them. 87 // support it, ImageDecoder needs something analagous to its ImageFrame cache
88 // to hold partial planes, and the GPU code needs to handle them.
87 bool decodeToYUV(SegmentReader*, 89 bool decodeToYUV(SegmentReader*,
88 size_t index, 90 size_t index,
89 const SkISize componentSizes[3], 91 const SkISize componentSizes[3],
90 void* planes[3], 92 void* planes[3],
91 const size_t rowBytes[3]); 93 const size_t rowBytes[3]);
92 94
93 const SkISize& getFullSize() const { return m_fullSize; } 95 const SkISize& getFullSize() const { return m_fullSize; }
94 96
95 bool isMultiFrame() const { return m_isMultiFrame; } 97 bool isMultiFrame() const { return m_isMultiFrame; }
96 bool decodeFailed() const { return m_decodeFailed; } 98 bool decodeFailed() const { return m_decodeFailed; }
97 99
98 bool hasAlpha(size_t index); 100 bool hasAlpha(size_t index);
99 101
100 // Must not be called unless the SkROBuffer has all the data. 102 // Must not be called unless the SkROBuffer has all the data. YUV decoding
101 // YUV decoding does not currently support progressive decoding. See comment a bove on decodeToYUV. 103 // does not currently support progressive decoding. See comment above on
104 // decodeToYUV().
102 bool getYUVComponentSizes(SegmentReader*, SkYUVSizeInfo*); 105 bool getYUVComponentSizes(SegmentReader*, SkYUVSizeInfo*);
103 106
104 private: 107 private:
105 ImageFrameGenerator(const SkISize& fullSize, bool isMultiFrame); 108 ImageFrameGenerator(const SkISize& fullSize, bool isMultiFrame);
106 109
107 friend class ImageFrameGeneratorTest; 110 friend class ImageFrameGeneratorTest;
108 friend class DeferredImageDecoderTest; 111 friend class DeferredImageDecoderTest;
109 // For testing. |factory| will overwrite the default ImageDecoder creation log ic if |factory->create()| returns non-zero. 112 // For testing. |factory| will overwrite the default ImageDecoder creation
113 // logic if |factory->create()| returns non-zero.
110 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { 114 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) {
111 m_imageDecoderFactory = std::move(factory); 115 m_imageDecoderFactory = std::move(factory);
112 } 116 }
113 117
114 void setHasAlpha(size_t index, bool hasAlpha); 118 void setHasAlpha(size_t index, bool hasAlpha);
115 119
116 SkBitmap tryToResumeDecode(SegmentReader*, 120 SkBitmap tryToResumeDecode(SegmentReader*,
117 bool allDataReceived, 121 bool allDataReceived,
118 size_t index, 122 size_t index,
119 const SkISize& scaledSize, 123 const SkISize& scaledSize,
(...skipping 19 matching lines...) Expand all
139 // Prevents multiple decode operations on the same data. 143 // Prevents multiple decode operations on the same data.
140 Mutex m_decodeMutex; 144 Mutex m_decodeMutex;
141 145
142 // Protect concurrent access to m_hasAlpha. 146 // Protect concurrent access to m_hasAlpha.
143 Mutex m_alphaMutex; 147 Mutex m_alphaMutex;
144 }; 148 };
145 149
146 } // namespace blink 150 } // namespace blink
147 151
148 #endif 152 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698