| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 template <RowProc Proc> | 161 template <RowProc Proc> |
| 162 static void SkipLeading8888ZerosThen(void* SK_RESTRICT dstRow, | 162 static void SkipLeading8888ZerosThen(void* SK_RESTRICT dstRow, |
| 163 const uint8_t* SK_RESTRICT src, | 163 const uint8_t* SK_RESTRICT src, |
| 164 int dstWidth, int bpp, int deltaSrc, in
t offset, | 164 int dstWidth, int bpp, int deltaSrc, in
t offset, |
| 165 const SkPMColor ctable[]); | 165 const SkPMColor ctable[]); |
| 166 | 166 |
| 167 template <RowProc Proc> | 167 template <RowProc Proc> |
| 168 static void SkipLeadingGrayAlphaZerosThen(void* dst, const uint8_t* src, int
width, int bpp, | 168 static void SkipLeadingGrayAlphaZerosThen(void* dst, const uint8_t* src, int
width, int bpp, |
| 169 int deltaSrc, int offset, const Sk
PMColor ctable[]); | 169 int deltaSrc, int offset, const Sk
PMColor ctable[]); |
| 170 | 170 |
| 171 // May be NULL. We have not implemented optimized functions for all support
ed transforms. | 171 // Always non-NULL. Supports all sample sizes. |
| 172 const RowProc fFastProc; | |
| 173 // Always non-NULL. Supports sampling. | |
| 174 const RowProc fSlowProc; | 172 const RowProc fSlowProc; |
| 175 // The actual RowProc we are using. This depends on if fFastProc is non-NUL
L and | 173 |
| 176 // whether or not we are sampling. | 174 // Optimized functions are supported for some conversions at various sample
sizes. |
| 175 // If a RowProc is NULL, it indicates that the particular conversion at the |
| 176 // particular sample size does not have a fast version. |
| 177 struct FastProcs { |
| 178 FastProcs() |
| 179 : fSampleSize1(nullptr) |
| 180 , fSampleSize2(nullptr) |
| 181 , fSampleSize4(nullptr) |
| 182 , fSampleSize8(nullptr) |
| 183 {} |
| 184 |
| 185 RowProc fSampleSize1; |
| 186 RowProc fSampleSize2; |
| 187 RowProc fSampleSize4; |
| 188 RowProc fSampleSize8; |
| 189 }; |
| 190 const FastProcs fFastProcs; |
| 191 |
| 192 // The actual RowProc we are using. This will be equal to one of the fFastP
rocs |
| 193 // if the appropriate proc is non-NULL. Otherwise, this will be fSlowProc. |
| 177 RowProc fActualProc; | 194 RowProc fActualProc; |
| 178 | 195 |
| 179 const SkPMColor* fColorTable; // Unowned pointer | 196 const SkPMColor* fColorTable; // Unowned pointer |
| 180 | 197 |
| 181 // Subset Swizzles | 198 // Subset Swizzles |
| 182 // There are two types of subset swizzles that we support. We do not | 199 // There are two types of subset swizzles that we support. We do not |
| 183 // support both at the same time. | 200 // support both at the same time. |
| 184 // TODO: If we want to support partial scanlines for gifs (which may | 201 // TODO: If we want to support partial scanlines for gifs (which may |
| 185 // use frame subsets), we will need to support both subsetting | 202 // use frame subsets), we will need to support both subsetting |
| 186 // modes at the same time. | 203 // modes at the same time. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 int fAllocatedWidth; | 272 int fAllocatedWidth; |
| 256 | 273 |
| 257 int fSampleX; // Step between X samples | 274 int fSampleX; // Step between X samples |
| 258 const int fSrcBPP; // Bits/bytes per pixel for the SrcCon
fig | 275 const int fSrcBPP; // Bits/bytes per pixel for the SrcCon
fig |
| 259 // if bitsPerPixel % 8 == 0 | 276 // if bitsPerPixel % 8 == 0 |
| 260 // fBPP is bytesPerPixel | 277 // fBPP is bytesPerPixel |
| 261 // else | 278 // else |
| 262 // fBPP is bitsPerPixel | 279 // fBPP is bitsPerPixel |
| 263 const int fDstBPP; // Bytes per pixel for the destination
color type | 280 const int fDstBPP; // Bytes per pixel for the destination
color type |
| 264 | 281 |
| 265 SkSwizzler(RowProc fastProc, RowProc proc, const SkPMColor* ctable, int srcO
ffset, | 282 SkSwizzler(RowProc proc, const FastProcs& fastProcs, const SkPMColor* ctable
, int srcOffset, |
| 266 int srcWidth, int dstOffset, int dstWidth, int srcBPP, int dstBPP); | 283 int srcWidth, int dstOffset, int dstWidth, int srcBPP, int dstBPP); |
| 267 | 284 |
| 268 int onSetSampleX(int) override; | 285 int onSetSampleX(int) override; |
| 269 | 286 |
| 270 }; | 287 }; |
| 271 #endif // SkSwizzler_DEFINED | 288 #endif // SkSwizzler_DEFINED |
| OLD | NEW |