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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class SkMaskSwizzler : public SkSampler { | 21 class SkMaskSwizzler : public SkSampler { |
22 public: | 22 public: |
23 | 23 |
24 /* | 24 /* |
25 * Create a new swizzler | 25 * Create a new swizzler |
26 * @param masks Unowned pointer to helper class | 26 * @param masks Unowned pointer to helper class |
27 */ | 27 */ |
28 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& dstInfo, | 28 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& dstInfo, |
29 const SkImageInfo& srcInfo, | 29 const SkImageInfo& srcInfo, |
30 SkMasks* masks, | 30 SkMasks* masks, |
31 uint32_t bitsPerPixel); | 31 uint32_t bitsPerPixel, |
| 32 int subsetLeft, |
| 33 int subsetWidth); |
32 | 34 |
33 /* | 35 /* |
34 * Swizzle a row | 36 * Swizzle a row |
35 */ | 37 */ |
36 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); | 38 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); |
37 | 39 |
38 private: | 40 private: |
39 | 41 |
40 /* | 42 /* |
41 * Row procedure used for swizzle | 43 * Row procedure used for swizzle |
42 */ | 44 */ |
43 typedef SkSwizzler::ResultAlpha (*RowProc)( | 45 typedef SkSwizzler::ResultAlpha (*RowProc)(void* dstRow, const uint8_t* srcR
ow, int width, |
44 void* dstRow, const uint8_t* srcRow, int width, | |
45 SkMasks* masks, uint32_t startX, uint32_t sampleX); | 46 SkMasks* masks, uint32_t startX, uint32_t sampleX); |
46 | 47 |
47 /* | 48 SkMaskSwizzler(SkMasks* masks, RowProc proc, int srcWidth, int srcOffset); |
48 * Constructor for mask swizzler | |
49 */ | |
50 SkMaskSwizzler(int width, SkMasks* masks, RowProc proc); | |
51 | 49 |
52 int onSetSampleX(int) override; | 50 int onSetSampleX(int) override; |
53 | 51 |
54 int onGetScaledWidth() override { | 52 int onGetScaledWidth() override { |
55 return fDstWidth; | 53 return fDstWidth; |
56 } | 54 } |
57 | 55 |
58 SkMasks* fMasks; // unowned | 56 SkMasks* fMasks; // unowned |
59 const RowProc fRowProc; | 57 const RowProc fRowProc; |
60 | 58 |
61 // FIXME: Can this class share more with SkSwizzler? These variables are all
the same. | 59 // FIXME: Can this class share more with SkSwizzler? These variables are all
the same. |
62 const int fSrcWidth; // Width of the source - i.e. before any s
ampling. | 60 const int fSrcWidth; // Width of the source - i.e. before any s
ampling. |
63 int fDstWidth; // Width of dst, which may differ with sam
pling. | 61 int fDstWidth; // Width of dst, which may differ with sam
pling. |
64 int fSampleX; | 62 int fSampleX; |
| 63 int fSrcOffset; |
65 int fX0; | 64 int fX0; |
66 }; | 65 }; |
67 | 66 |
68 #endif | 67 #endif |
OLD | NEW |