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