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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 * @param deltaSrc bpp * sampleX | 147 * @param deltaSrc bpp * sampleX |
148 * @param ctable Colors (used for kIndex source). | 148 * @param ctable Colors (used for kIndex source). |
149 * @param offset The offset before the first pixel to sample. | 149 * @param offset The offset before the first pixel to sample. |
150 Is in bytes or bits based on what deltaSrc is in. | 150 Is in bytes or bits based on what deltaSrc is in. |
151 */ | 151 */ |
152 typedef void (*RowProc)(void* SK_RESTRICT dstRow, | 152 typedef void (*RowProc)(void* SK_RESTRICT dstRow, |
153 const uint8_t* SK_RESTRICT src, | 153 const uint8_t* SK_RESTRICT src, |
154 int dstWidth, int bpp, int deltaSrc, int offset, | 154 int dstWidth, int bpp, int deltaSrc, int offset, |
155 const SkPMColor ctable[]); | 155 const SkPMColor ctable[]); |
156 | 156 |
157 const RowProc fRowProc; | 157 // May be NULL. We will not always be able to used an optimized function. |
| 158 RowProc fFastProc; |
| 159 // Always non-NULL. We use this if fFastProc is NULL. |
| 160 const RowProc fProc; |
158 const SkPMColor* fColorTable; // Unowned pointer | 161 const SkPMColor* fColorTable; // Unowned pointer |
159 | 162 |
160 // Subset Swizzles | 163 // Subset Swizzles |
161 // There are two types of subset swizzles that we support. We do not | 164 // There are two types of subset swizzles that we support. We do not |
162 // support both at the same time. | 165 // support both at the same time. |
163 // TODO: If we want to support partial scanlines for gifs (which may | 166 // TODO: If we want to support partial scanlines for gifs (which may |
164 // use frame subsets), we will need to support both subsetting | 167 // use frame subsets), we will need to support both subsetting |
165 // modes at the same time. | 168 // modes at the same time. |
166 // (1) Partial Scanlines | 169 // (1) Partial Scanlines |
167 // The client only wants to write a subset of the source pixels | 170 // The client only wants to write a subset of the source pixels |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 int fAllocatedWidth; | 237 int fAllocatedWidth; |
235 | 238 |
236 int fSampleX; // Step between X samples | 239 int fSampleX; // Step between X samples |
237 const int fSrcBPP; // Bits/bytes per pixel for the SrcCon
fig | 240 const int fSrcBPP; // Bits/bytes per pixel for the SrcCon
fig |
238 // if bitsPerPixel % 8 == 0 | 241 // if bitsPerPixel % 8 == 0 |
239 // fBPP is bytesPerPixel | 242 // fBPP is bytesPerPixel |
240 // else | 243 // else |
241 // fBPP is bitsPerPixel | 244 // fBPP is bitsPerPixel |
242 const int fDstBPP; // Bytes per pixel for the destination
color type | 245 const int fDstBPP; // Bytes per pixel for the destination
color type |
243 | 246 |
244 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidt
h, int dstOffset, | 247 SkSwizzler(RowProc fastProc, RowProc proc, const SkPMColor* ctable, int srcO
ffset, |
245 int dstWidth, int srcBPP, int dstBPP); | 248 int srcWidth, int dstOffset, int dstWidth, int srcBPP, int dstBPP); |
246 | 249 |
247 int onSetSampleX(int) override; | 250 int onSetSampleX(int) override; |
248 | 251 |
249 }; | 252 }; |
250 #endif // SkSwizzler_DEFINED | 253 #endif // SkSwizzler_DEFINED |
OLD | NEW |