126 {
127 SkASSERT(0 < bytesPerPixel && bytesPerPixel <= 4);
128
129
130 if (bytesPerPixel < 4) {
131 int bitsPerPixel = 8*bytesPerPixel;
132 masks.red &= (1 << bitsPerPixel) - 1;
133 masks.green &= (1 << bitsPerPixel) - 1;
134 masks.blue &= (1 << bitsPerPixel) - 1;
135 masks.alpha &= (1 << bitsPerPixel) - 1;
136 }
137
138
139 if (((masks.red & masks.green) |
140 (masks.red & masks.blue ) |
141 (masks.red & masks.alpha) |
142 (masks.green & masks.blue ) |
143 (masks.green & masks.alpha) |
144 (masks.blue & masks.alpha) ) != 0) {
145 return nullptr;
146 }
147
152}
static SkMasks::MaskInfo process_mask(uint32_t mask)
constexpr SkMasks(const MaskInfo red, const MaskInfo green, const MaskInfo blue, const MaskInfo alpha)