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