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 #ifndef SkSwizzler_DEFINED | 8 #ifndef SkSwizzler_DEFINED |
9 #define SkSwizzler_DEFINED | 9 #define SkSwizzler_DEFINED |
10 | 10 |
11 #include "SkCodec.h" | 11 #include "SkCodec.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
14 | 14 |
15 class SkSwizzler : public SkNoncopyable { | 15 class SkSwizzler : public SkNoncopyable { |
16 public: | 16 public: |
17 /** | 17 /** |
18 * Enum describing the config of the source data. | 18 * Enum describing the config of the source data. |
19 */ | 19 */ |
20 enum SrcConfig { | 20 enum SrcConfig { |
21 kUnknown, // Invalid type. | 21 kUnknown, // Invalid type. |
| 22 kBit, // A single bit to distinguish between white and black |
22 kGray, | 23 kGray, |
23 kIndex1, | 24 kIndex1, |
24 kIndex2, | 25 kIndex2, |
25 kIndex4, | 26 kIndex4, |
26 kIndex, | 27 kIndex, |
27 kRGB, | 28 kRGB, |
28 kBGR, | 29 kBGR, |
29 kRGBX, | 30 kRGBX, |
30 kBGRX, | 31 kBGRX, |
31 kRGBA, | 32 kRGBA, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 */ | 70 */ |
70 static ResultAlpha GetResult(uint8_t zeroAlpha, uint8_t maxAlpha); | 71 static ResultAlpha GetResult(uint8_t zeroAlpha, uint8_t maxAlpha); |
71 | 72 |
72 /* | 73 /* |
73 * | 74 * |
74 * Returns bits per pixel for source config | 75 * Returns bits per pixel for source config |
75 * | 76 * |
76 */ | 77 */ |
77 static int BitsPerPixel(SrcConfig sc) { | 78 static int BitsPerPixel(SrcConfig sc) { |
78 switch (sc) { | 79 switch (sc) { |
| 80 case kBit: |
79 case kIndex1: | 81 case kIndex1: |
80 return 1; | 82 return 1; |
81 case kIndex2: | 83 case kIndex2: |
82 return 2; | 84 return 2; |
83 case kIndex4: | 85 case kIndex4: |
84 return 4; | 86 return 4; |
85 case kGray: | 87 case kGray: |
86 case kIndex: | 88 case kIndex: |
87 return 8; | 89 return 8; |
88 case kRGB_565: | 90 case kRGB_565: |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // else | 198 // else |
197 // deltaSrc is bitsPerPixel | 199 // deltaSrc is bitsPerPixel |
198 const SkImageInfo fDstInfo; | 200 const SkImageInfo fDstInfo; |
199 int fCurrY; | 201 int fCurrY; |
200 | 202 |
201 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, | 203 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, |
202 const SkImageInfo& info); | 204 const SkImageInfo& info); |
203 | 205 |
204 }; | 206 }; |
205 #endif // SkSwizzler_DEFINED | 207 #endif // SkSwizzler_DEFINED |
OLD | NEW |