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 const SkCodec::Options& options); |
32 | 33 |
33 /* | 34 /* |
34 * Swizzle a row | 35 * Swizzle a row |
35 */ | 36 */ |
36 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); | 37 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); |
37 | 38 |
38 /** | 39 /** |
39 * Implement fill using a custom width. | 40 * Implement fill using a custom width. |
40 */ | 41 */ |
41 void fill(const SkImageInfo& info, void* dst, size_t rowBytes, uint32_t colo
rOrIndex, | 42 void fill(const SkImageInfo& info, void* dst, size_t rowBytes, uint32_t colo
rOrIndex, |
42 SkCodec::ZeroInitialized zeroInit) override { | 43 SkCodec::ZeroInitialized zeroInit) override { |
43 const SkImageInfo fillInfo = info.makeWH(fDstWidth, info.height()); | 44 const SkImageInfo fillInfo = info.makeWH(fDstWidth, info.height()); |
44 SkSampler::Fill(fillInfo, dst, rowBytes, colorOrIndex, zeroInit); | 45 SkSampler::Fill(fillInfo, dst, rowBytes, colorOrIndex, zeroInit); |
45 } | 46 } |
46 | 47 |
47 private: | 48 private: |
48 | 49 |
49 /* | 50 /* |
50 * Row procedure used for swizzle | 51 * Row procedure used for swizzle |
51 */ | 52 */ |
52 typedef SkSwizzler::ResultAlpha (*RowProc)( | 53 typedef SkSwizzler::ResultAlpha (*RowProc)(void* dstRow, const uint8_t* srcR
ow, int width, |
53 void* dstRow, const uint8_t* srcRow, int width, | |
54 SkMasks* masks, uint32_t startX, uint32_t sampleX); | 54 SkMasks* masks, uint32_t startX, uint32_t sampleX); |
55 | 55 |
56 /* | 56 SkMaskSwizzler(SkMasks* masks, RowProc proc, int srcWidth, int srcOffset); |
57 * Constructor for mask swizzler | |
58 */ | |
59 SkMaskSwizzler(int width, SkMasks* masks, RowProc proc); | |
60 | 57 |
61 int onSetSampleX(int) override; | 58 int onSetSampleX(int) override; |
62 | 59 |
63 SkMasks* fMasks; // unowned | 60 SkMasks* fMasks; // unowned |
64 const RowProc fRowProc; | 61 const RowProc fRowProc; |
65 | 62 |
66 // FIXME: Can this class share more with SkSwizzler? These variables are all
the same. | 63 // FIXME: Can this class share more with SkSwizzler? These variables are all
the same. |
67 const int fSrcWidth; // Width of the source - i.e. before any s
ampling. | 64 const int fSrcWidth; // Width of the source - i.e. before any s
ampling. |
68 int fDstWidth; // Width of dst, which may differ with sam
pling. | 65 int fDstWidth; // Width of dst, which may differ with sam
pling. |
69 int fSampleX; | 66 int fSampleX; |
| 67 int fSrcOffset; |
70 int fX0; | 68 int fX0; |
71 }; | 69 }; |
72 | 70 |
73 #endif | 71 #endif |
OLD | NEW |