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