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 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 enum SrcConfig { | 21 enum SrcConfig { |
22 kUnknown, // Invalid type. | 22 kUnknown, // Invalid type. |
23 kBit, // A single bit to distinguish between white and black | 23 kBit, // A single bit to distinguish between white and black |
24 kGray, | 24 kGray, |
25 kIndex1, | 25 kIndex1, |
26 kIndex2, | 26 kIndex2, |
27 kIndex4, | 27 kIndex4, |
28 kIndex, | 28 kIndex, |
29 kRGB, | 29 kRGB, |
30 kBGR, | 30 kBGR, |
31 kRGBX, | |
32 kBGRX, | 31 kBGRX, |
msarett
2016/01/14 20:52:24
kBGRX now really means BGR(anything) instead of BG
scroggo
2016/01/14 21:28:18
Can you add a comment stating that?
msarett
2016/01/14 22:25:20
Done.
| |
33 kRGBA, | 32 kRGBA, |
34 kBGRA, | 33 kBGRA, |
35 kRGB_565, | |
36 kCMYK, | 34 kCMYK, |
35 // These modes are used exclusively for sampling and subsetting. | |
scroggo
2016/01/14 21:28:18
Looks like the number means the number of bytes. T
msarett
2016/01/14 22:25:20
Happy to use the number of bits for consistency.
| |
36 // The pixels themselves do not need to be modified. | |
37 kNOOP1, | |
scroggo
2016/01/14 21:28:18
Why not kNoOp1 etc?
msarett
2016/01/14 22:25:20
sgtm
| |
38 kNOOP2, | |
39 kNOOP4, | |
37 }; | 40 }; |
38 | 41 |
39 /* | 42 /* |
40 * | 43 * |
41 * Returns bits per pixel for source config | 44 * Returns bits per pixel for source config |
42 * | 45 * |
43 */ | 46 */ |
44 static int BitsPerPixel(SrcConfig sc) { | 47 static int BitsPerPixel(SrcConfig sc) { |
45 switch (sc) { | 48 switch (sc) { |
46 case kBit: | 49 case kBit: |
47 case kIndex1: | 50 case kIndex1: |
48 return 1; | 51 return 1; |
49 case kIndex2: | 52 case kIndex2: |
50 return 2; | 53 return 2; |
51 case kIndex4: | 54 case kIndex4: |
52 return 4; | 55 return 4; |
53 case kGray: | 56 case kGray: |
54 case kIndex: | 57 case kIndex: |
58 case kNOOP1: | |
55 return 8; | 59 return 8; |
56 case kRGB_565: | 60 case kNOOP2: |
57 return 16; | 61 return 16; |
58 case kRGB: | 62 case kRGB: |
59 case kBGR: | 63 case kBGR: |
60 return 24; | 64 return 24; |
61 case kRGBX: | |
62 case kRGBA: | 65 case kRGBA: |
63 case kBGRX: | 66 case kBGRX: |
64 case kBGRA: | 67 case kBGRA: |
65 case kCMYK: | 68 case kCMYK: |
69 case kNOOP4: | |
66 return 32; | 70 return 32; |
67 default: | 71 default: |
68 SkASSERT(false); | 72 SkASSERT(false); |
69 return 0; | 73 return 0; |
70 } | 74 } |
71 } | 75 } |
72 | 76 |
73 /* | 77 /* |
74 * | 78 * |
75 * Returns bytes per pixel for source config | 79 * Returns bytes per pixel for source config |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 // fBPP is bitsPerPixel | 254 // fBPP is bitsPerPixel |
251 const int fDstBPP; // Bytes per pixel for the destination color type | 255 const int fDstBPP; // Bytes per pixel for the destination color type |
252 | 256 |
253 SkSwizzler(RowProc fastProc, RowProc proc, const SkPMColor* ctable, int srcO ffset, | 257 SkSwizzler(RowProc fastProc, RowProc proc, const SkPMColor* ctable, int srcO ffset, |
254 int srcWidth, int dstOffset, int dstWidth, int srcBPP, int dstBPP); | 258 int srcWidth, int dstOffset, int dstWidth, int srcBPP, int dstBPP); |
255 | 259 |
256 int onSetSampleX(int) override; | 260 int onSetSampleX(int) override; |
257 | 261 |
258 }; | 262 }; |
259 #endif // SkSwizzler_DEFINED | 263 #endif // SkSwizzler_DEFINED |
OLD | NEW |