OLD | NEW |
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 Loading... |
156 | 156 |
157 /** | 157 /** |
158 * Implement fill using a custom width. | 158 * Implement fill using a custom width. |
159 */ | 159 */ |
160 void fill(const SkImageInfo& info, void* dst, size_t rowBytes, uint32_t colo
rOrIndex, | 160 void fill(const SkImageInfo& info, void* dst, size_t rowBytes, uint32_t colo
rOrIndex, |
161 SkCodec::ZeroInitialized zeroInit) override { | 161 SkCodec::ZeroInitialized zeroInit) override { |
162 const SkImageInfo fillInfo = info.makeWH(fAllocatedWidth, info.height())
; | 162 const SkImageInfo fillInfo = info.makeWH(fAllocatedWidth, info.height())
; |
163 SkSampler::Fill(fillInfo, dst, rowBytes, colorOrIndex, zeroInit); | 163 SkSampler::Fill(fillInfo, dst, rowBytes, colorOrIndex, zeroInit); |
164 } | 164 } |
165 | 165 |
166 /** | |
167 * If fSampleX > 1, the swizzler is sampling every fSampleX'th pixel and | |
168 * discarding the rest. | |
169 * | |
170 * This getter is currently used by SkBmpStandardCodec for Bmp-in-Ico decod
es. | |
171 * Ideally, the subclasses of SkCodec would have no knowledge of sampling,
but | |
172 * this allows us to apply a transparency mask to pixels after swizzling. | |
173 */ | |
174 int sampleX() const { return fSampleX; } | |
175 | |
176 private: | 166 private: |
177 | 167 |
178 /** | 168 /** |
179 * Method for converting raw data to Skia pixels. | 169 * Method for converting raw data to Skia pixels. |
180 * @param dstRow Row in which to write the resulting pixels. | 170 * @param dstRow Row in which to write the resulting pixels. |
181 * @param src Row of src data, in format specified by SrcConfig | 171 * @param src Row of src data, in format specified by SrcConfig |
182 * @param dstWidth Width in pixels of the destination | 172 * @param dstWidth Width in pixels of the destination |
183 * @param bpp if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel | 173 * @param bpp if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel |
184 * else, deltaSrc is bitsPerPixel | 174 * else, deltaSrc is bitsPerPixel |
185 * @param deltaSrc bpp * sampleX | 175 * @param deltaSrc bpp * sampleX |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // fBPP is bitsPerPixel | 269 // fBPP is bitsPerPixel |
280 const int fDstBPP; // Bytes per pixel for the destination
color type | 270 const int fDstBPP; // Bytes per pixel for the destination
color type |
281 | 271 |
282 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidt
h, int dstOffset, | 272 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidt
h, int dstOffset, |
283 int dstWidth, int srcBPP, int dstBPP); | 273 int dstWidth, int srcBPP, int dstBPP); |
284 | 274 |
285 int onSetSampleX(int) override; | 275 int onSetSampleX(int) override; |
286 | 276 |
287 }; | 277 }; |
288 #endif // SkSwizzler_DEFINED | 278 #endif // SkSwizzler_DEFINED |
OLD | NEW |