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

Side by Side Diff: src/codec/SkSwizzler.h

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments in Patch Set 5 Created 5 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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkSwizzler_DEFINED 8 #ifndef SkSwizzler_DEFINED
9 #define SkSwizzler_DEFINED 9 #define SkSwizzler_DEFINED
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 but sampling in X allows the swizzler to skip swizzling pixels and 129 but sampling in X allows the swizzler to skip swizzling pixels and
130 reading from and writing to memory. 130 reading from and writing to memory.
131 * @return A new SkSwizzler or nullptr on failure. 131 * @return A new SkSwizzler or nullptr on failure.
132 */ 132 */
133 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, 133 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
134 const SkImageInfo& dstInfo, SkCodec::ZeroI nitialized, 134 const SkImageInfo& dstInfo, SkCodec::ZeroI nitialized,
135 const SkImageInfo& srcInfo); 135 const SkImageInfo& srcInfo);
136 /** 136 /**
137 * Fill the remainder of the destination with a single color 137 * Fill the remainder of the destination with a single color
138 * 138 *
139 * @param dstStartRow 139 * @param fillDst
140 * The destination row to fill from. 140 * The destination row to fill from.
141 * 141 *
142 * @param numRows 142 * @param fillInfo
143 * The number of rows to fill. 143 * Contains the width of the rows to fill.
144 * Contains the number of rows to fill.
145 * Contains the color type of the rows to fill.
146 * Contains the alpha type of the rows to fill.
147 *
148 * @param rowBytes
149 * Stride in bytes of the destination.
144 * 150 *
145 * @param colorOrIndex 151 * @param colorOrIndex
146 * @param colorTable 152 * If dstInfo.colorType() is kN32, colorOrIndex is treated as a 32-bit color .
147 * If dstInfo.colorType() is kIndex8, colorOrIndex is assumed to be a uint8_ t 153 * If dstInfo.colorType() is k565, colorOrIndex is treated as a 16-bit color .
148 * index, and colorTable is ignored. Each 8-bit pixel will be set to (uint8_ t) 154 * If dstInfo.colorType() is kGray, colorOrIndex is treated as an 8-bit colo r.
149 * index. 155 * If dstInfo.colorType() is kIndex, colorOrIndex is treated as an 8-bit ind ex.
150 *
151 * If dstInfo.colorType() is kN32, colorOrIndex is treated differently depen ding on
152 * whether colorTable is nullptr:
153 *
154 * A nullptr colorTable means colorOrIndex is treated as an SkPMColor (premu l or
155 * unpremul, depending on dstInfo.alphaType()). Each 4-byte pixel will be se t to
156 * colorOrIndex.
157
158 * A non-nullptr colorTable means colorOrIndex is treated as a uint8_t index into
159 * the colorTable. i.e. each 4-byte pixel will be set to
160 * colorTable[(uint8_t) colorOrIndex].
161 *
162 * If dstInfo.colorType() is kGray, colorOrIndex is always treated as an 8-b it color.
163 *
164 * Other SkColorTypes are not supported. 156 * Other SkColorTypes are not supported.
165 * 157 *
166 * @param zeroInit 158 * @param zeroInit
167 * Indicates whether memory is already zero initialized. 159 * Indicates whether memory is already zero initialized.
168 * 160 *
169 */ 161 */
170 static void Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRo wBytes, 162 static void Fill(void* fillDst, const SkImageInfo& fillInfo, size_t rowBytes ,
171 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable , 163 uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit);
172 SkCodec::ZeroInitialized zeroInit);
173 164
174 /** 165 /**
175 * Swizzle a line. Generally this will be called height times, once 166 * Swizzle a line. Generally this will be called height times, once
176 * for each row of source. 167 * for each row of source.
177 * By allowing the caller to pass in the dst pointer, we give the caller 168 * By allowing the caller to pass in the dst pointer, we give the caller
178 * flexibility to use the swizzler even when the encoded data does not 169 * flexibility to use the swizzler even when the encoded data does not
179 * store the rows in order. This also improves usability for scaled and 170 * store the rows in order. This also improves usability for scaled and
180 * subset decodes. 171 * subset decodes.
181 * @param dst Where we write the output. 172 * @param dst Where we write the output.
182 * @param src The next row of the source data. 173 * @param src The next row of the source data.
(...skipping 29 matching lines...) Expand all
212 // deltaSrc is bitsPerPixel 203 // deltaSrc is bitsPerPixel
213 const SkImageInfo fDstInfo; 204 const SkImageInfo fDstInfo;
214 int fCurrY; 205 int fCurrY;
215 const int fX0; // first X coord to sample 206 const int fX0; // first X coord to sample
216 const int fSampleX; // step between X samples 207 const int fSampleX; // step between X samples
217 208
218 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info, 209 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info,
219 int sampleX); 210 int sampleX);
220 }; 211 };
221 #endif // SkSwizzler_DEFINED 212 #endif // SkSwizzler_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698