| 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 #ifndef SkMaskSwizzler_DEFINED | 7 #ifndef SkMaskSwizzler_DEFINED |
| 8 #define SkMaskSwizzler_DEFINED | 8 #define SkMaskSwizzler_DEFINED |
| 9 | 9 |
| 10 #include "SkMasks.h" | 10 #include "SkMasks.h" |
| 11 #include "SkSwizzler.h" | 11 #include "SkSwizzler.h" |
| 12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 13 | 13 |
| 14 /* | 14 /* |
| 15 * | 15 * |
| 16 * Used to swizzle images whose pixel components are extracted by bit masks | 16 * Used to swizzle images whose pixel components are extracted by bit masks |
| 17 * Currently only used by bmp | 17 * Currently only used by bmp |
| 18 * | 18 * |
| 19 */ | 19 */ |
| 20 class SkMaskSwizzler { | 20 class SkMaskSwizzler { |
| 21 public: | 21 public: |
| 22 | 22 |
| 23 /* | 23 /* |
| 24 * Create a new swizzler | 24 * Create a new swizzler |
| 25 * @param masks Unowned pointer to helper class | 25 * @param masks Unowned pointer to helper class |
| 26 */ | 26 */ |
| 27 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& imageInfo, | 27 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& dstInfo, |
| 28 const SkImageInfo& srcInfo, |
| 28 SkMasks* masks, | 29 SkMasks* masks, |
| 29 uint32_t bitsPerPixel); | 30 uint32_t bitsPerPixel); |
| 30 | 31 |
| 31 /* | 32 /* |
| 32 * Swizzle a row | 33 * Swizzle a row |
| 33 */ | 34 */ |
| 34 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); | 35 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 | 38 |
| 38 /* | 39 /* |
| 39 * Row procedure used for swizzle | 40 * Row procedure used for swizzle |
| 40 */ | 41 */ |
| 41 typedef SkSwizzler::ResultAlpha (*RowProc)( | 42 typedef SkSwizzler::ResultAlpha (*RowProc)( |
| 42 void* dstRow, const uint8_t* srcRow, int width, | 43 void* dstRow, const uint8_t* srcRow, int width, |
| 43 SkMasks* masks); | 44 SkMasks* masks, uint32_t startX, uint32_t sampleX); |
| 44 | 45 |
| 45 /* | 46 /* |
| 46 * Constructor for mask swizzler | 47 * Constructor for mask swizzler |
| 47 */ | 48 */ |
| 48 SkMaskSwizzler(const SkImageInfo& info, SkMasks* masks, RowProc proc); | 49 SkMaskSwizzler(const SkImageInfo& info, SkMasks* masks, RowProc proc, |
| 50 uint32_t sampleX); |
| 49 | 51 |
| 50 // Fields | 52 // Fields |
| 51 const SkImageInfo& fDstInfo; | 53 const SkImageInfo& fDstInfo; |
| 52 SkMasks* fMasks; // unowned | 54 SkMasks* fMasks; // unowned |
| 53 const RowProc fRowProc; | 55 const RowProc fRowProc; |
| 56 const uint32_t fSampleX; |
| 57 const uint32_t fStartX; |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 #endif | 60 #endif |
| OLD | NEW |