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 |
166 private: | 176 private: |
167 | 177 |
168 /** | 178 /** |
169 * Method for converting raw data to Skia pixels. | 179 * Method for converting raw data to Skia pixels. |
170 * @param dstRow Row in which to write the resulting pixels. | 180 * @param dstRow Row in which to write the resulting pixels. |
171 * @param src Row of src data, in format specified by SrcConfig | 181 * @param src Row of src data, in format specified by SrcConfig |
172 * @param dstWidth Width in pixels of the destination | 182 * @param dstWidth Width in pixels of the destination |
173 * @param bpp if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel | 183 * @param bpp if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel |
174 * else, deltaSrc is bitsPerPixel | 184 * else, deltaSrc is bitsPerPixel |
175 * @param deltaSrc bpp * sampleX | 185 * @param deltaSrc bpp * sampleX |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // fBPP is bitsPerPixel | 279 // fBPP is bitsPerPixel |
270 const int fDstBPP; // Bytes per pixel for the destination
color type | 280 const int fDstBPP; // Bytes per pixel for the destination
color type |
271 | 281 |
272 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidt
h, int dstOffset, | 282 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidt
h, int dstOffset, |
273 int dstWidth, int srcBPP, int dstBPP); | 283 int dstWidth, int srcBPP, int dstBPP); |
274 | 284 |
275 int onSetSampleX(int) override; | 285 int onSetSampleX(int) override; |
276 | 286 |
277 }; | 287 }; |
278 #endif // SkSwizzler_DEFINED | 288 #endif // SkSwizzler_DEFINED |
OLD | NEW |