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

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: Rebase on merged SkCodec and SkScanlineDecoder 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.
scroggo 2015/10/01 14:48:32 And, alpha I assume?
msarett 2015/10/01 18:14:14 Yes it does, although the alpha type is actually i
146 *
147 * @param rowBytes
148 * Stride in bytes of the destination.
144 * 149 *
145 * @param colorOrIndex 150 * @param colorOrIndex
146 * @param colorTable 151 * 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 152 * 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) 153 * If dstInfo.colorType() is kGray, colorOrIndex is treated as an 8-bit colo r.
149 * index. 154 * 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. 155 * Other SkColorTypes are not supported.
165 * 156 *
166 * @param zeroInit 157 * @param zeroInit
167 * Indicates whether memory is already zero initialized. 158 * Indicates whether memory is already zero initialized.
168 * 159 *
169 */ 160 */
170 static void Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRo wBytes, 161 static void Fill(void* fillDst, const SkImageInfo& fillInfo, size_t rowBytes ,
171 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable , 162 uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit);
172 SkCodec::ZeroInitialized zeroInit);
173 163
174 /** 164 /**
175 * Swizzle a line. Generally this will be called height times, once 165 * Swizzle a line. Generally this will be called height times, once
176 * for each row of source. 166 * for each row of source.
177 * By allowing the caller to pass in the dst pointer, we give the caller 167 * 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 168 * 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 169 * store the rows in order. This also improves usability for scaled and
180 * subset decodes. 170 * subset decodes.
181 * @param dst Where we write the output. 171 * @param dst Where we write the output.
182 * @param src The next row of the source data. 172 * @param src The next row of the source data.
(...skipping 29 matching lines...) Expand all
212 // deltaSrc is bitsPerPixel 202 // deltaSrc is bitsPerPixel
213 const SkImageInfo fDstInfo; 203 const SkImageInfo fDstInfo;
214 int fCurrY; 204 int fCurrY;
215 const int fX0; // first X coord to sample 205 const int fX0; // first X coord to sample
216 const int fSampleX; // step between X samples 206 const int fSampleX; // step between X samples
217 207
218 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info, 208 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info,
219 int sampleX); 209 int sampleX);
220 }; 210 };
221 #endif // SkSwizzler_DEFINED 211 #endif // SkSwizzler_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698