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, |
28 SkMasks* masks, | 29 SkMasks* masks, |
29 uint32_t bitsPerPixel); | 30 uint32_t bitsPerPixel); |
30 | 31 |
31 /* | 32 /* |
32 * | 33 * |
33 * Swizzle the next row | 34 * Swizzle the row with the specified y value |
34 * | 35 * |
35 */ | 36 */ |
36 SkSwizzler::ResultAlpha next(void* dst, const uint8_t* src); | 37 SkSwizzler::ResultAlpha next(const uint8_t* SK_RESTRICT src, int y); |
37 | 38 |
38 private: | 39 private: |
39 | 40 |
40 /* | 41 /* |
41 * | 42 * |
42 * Row procedure used for swizzle | 43 * Row procedure used for swizzle |
43 * | 44 * |
44 */ | 45 */ |
45 typedef SkSwizzler::ResultAlpha (*RowProc)( | 46 typedef SkSwizzler::ResultAlpha (*RowProc)( |
46 void* dstRow, const uint8_t* srcRow, int width, | 47 void* dstRow, const uint8_t* srcRow, int width, |
47 SkMasks* masks); | 48 SkMasks* masks); |
48 | 49 |
49 /* | 50 /* |
50 * | 51 * |
51 * Constructor for mask swizzler | 52 * Constructor for mask swizzler |
52 * | 53 * |
53 */ | 54 */ |
54 SkMaskSwizzler(const SkImageInfo& info, SkMasks* masks, RowProc proc); | 55 SkMaskSwizzler(const SkImageInfo& info, void* dst, size_t dstRowBytes, |
| 56 SkMasks* masks, RowProc proc); |
55 | 57 |
56 // Fields | 58 // Fields |
57 const SkImageInfo& fImageInfo; | 59 const SkImageInfo& fDstInfo; |
58 SkMasks* fMasks; // unowned | 60 void* fDst; |
| 61 size_t fDstRowBytes; |
| 62 SkMasks* fMasks; // unowned |
59 const RowProc fRowProc; | 63 const RowProc fRowProc; |
60 }; | 64 }; |
OLD | NEW |