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

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

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix windows errors Created 5 years, 3 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
« no previous file with comments | « src/codec/SkScanlineDecoder.cpp ('k') | src/codec/SkSwizzler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 * colorOrIndex. 156 * colorOrIndex.
157 157
158 * A non-nullptr colorTable means colorOrIndex is treated as a uint8_t index into 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 159 * the colorTable. i.e. each 4-byte pixel will be set to
160 * colorTable[(uint8_t) colorOrIndex]. 160 * colorTable[(uint8_t) colorOrIndex].
161 * 161 *
162 * If dstInfo.colorType() is kGray, colorOrIndex is always treated as an 8-b it color. 162 * If dstInfo.colorType() is kGray, colorOrIndex is always treated as an 8-b it color.
163 * 163 *
164 * Other SkColorTypes are not supported. 164 * Other SkColorTypes are not supported.
165 * 165 *
166 * @param zeroInit
167 * Indicates whether memory is already zero initialized.
168 *
166 */ 169 */
167 static void Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRo wBytes, 170 static void Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRo wBytes,
168 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable ); 171 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable ,
172 SkCodec::ZeroInitialized zeroInit);
169 173
170 /** 174 /**
171 * Swizzle a line. Generally this will be called height times, once 175 * Swizzle a line. Generally this will be called height times, once
172 * for each row of source. 176 * for each row of source.
173 * By allowing the caller to pass in the dst pointer, we give the caller 177 * By allowing the caller to pass in the dst pointer, we give the caller
174 * flexibility to use the swizzler even when the encoded data does not 178 * flexibility to use the swizzler even when the encoded data does not
175 * store the rows in order. This also improves usability for scaled and 179 * store the rows in order. This also improves usability for scaled and
176 * subset decodes. 180 * subset decodes.
177 * @param dst Where we write the output. 181 * @param dst Where we write the output.
178 * @param src The next row of the source data. 182 * @param src The next row of the source data.
179 * @return A result code describing if the row was fully opaque, fully 183 * @return A result code describing if the row was fully opaque, fully
180 * transparent, or neither 184 * transparent, or neither
181 */ 185 */
182 ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); 186 ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src);
183 187
184 private: 188 private:
185 189
186 /** 190 /**
187 * Method for converting raw data to Skia pixels. 191 * Method for converting raw data to Skia pixels.
188 * @param dstRow Row in which to write the resulting pixels. 192 * @param dstRow Row in which to write the resulting pixels.
189 * @param src Row of src data, in format specified by SrcConfig 193 * @param src Row of src data, in format specified by SrcConfig
190 * @param dstWidth Width in pixels of the destination 194 * @param dstWidth Width in pixels of the destination
191 * @param deltaSrc if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel 195 * @param bpp if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel
192 * else, deltaSrc is bitsPerPixel 196 * else, deltaSrc is bitsPerPixel
197 * @param deltaSrc bpp * sampleX
193 * @param ctable Colors (used for kIndex source). 198 * @param ctable Colors (used for kIndex source).
194 * @param offset The offset before the first pixel to sample. 199 * @param offset The offset before the first pixel to sample.
195 Is in bytes or bits based on what deltaSrc is in. 200 Is in bytes or bits based on what deltaSrc is in.
196 */ 201 */
197 typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow, 202 typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow,
198 const uint8_t* SK_RESTRICT src, 203 const uint8_t* SK_RESTRICT src,
199 int dstWidth, int deltaSrc, int offset, 204 int dstWidth, int bpp, int deltaSrc, int offs et,
200 const SkPMColor ctable[]); 205 const SkPMColor ctable[]);
201 206
202 const RowProc fRowProc; 207 const RowProc fRowProc;
203 const SkPMColor* fColorTable; // Unowned pointer 208 const SkPMColor* fColorTable; // Unowned pointer
204 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 209 const int fDeltaSrc; // if bitsPerPixel % 8 == 0
205 // deltaSrc is bytesPerPixel 210 // deltaSrc is bytesPerPixel
206 // else 211 // else
207 // deltaSrc is bitsPerPixel 212 // deltaSrc is bitsPerPixel
208 const SkImageInfo fDstInfo; 213 const SkImageInfo fDstInfo;
209 int fCurrY; 214 int fCurrY;
210 const int fX0; // first X coord to sample 215 const int fX0; // first X coord to sample
211 const int fSampleX; // step between X samples 216 const int fSampleX; // step between X samples
212 217
213 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info, 218 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info,
214 int sampleX); 219 int sampleX);
215 }; 220 };
216 #endif // SkSwizzler_DEFINED 221 #endif // SkSwizzler_DEFINED
OLDNEW
« no previous file with comments | « src/codec/SkScanlineDecoder.cpp ('k') | src/codec/SkSwizzler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698