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 #include "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkMasks.h" | 9 #include "SkMasks.h" |
10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 masks.red &= (1 << bitsPerPixel) - 1; | 132 masks.red &= (1 << bitsPerPixel) - 1; |
133 masks.green &= (1 << bitsPerPixel) - 1; | 133 masks.green &= (1 << bitsPerPixel) - 1; |
134 masks.blue &= (1 << bitsPerPixel) - 1; | 134 masks.blue &= (1 << bitsPerPixel) - 1; |
135 masks.alpha &= (1 << bitsPerPixel) - 1; | 135 masks.alpha &= (1 << bitsPerPixel) - 1; |
136 } | 136 } |
137 | 137 |
138 // Check that masks do not overlap | 138 // Check that masks do not overlap |
139 if (((masks.red & masks.green) | (masks.red & masks.blue) | | 139 if (((masks.red & masks.green) | (masks.red & masks.blue) | |
140 (masks.red & masks.alpha) | (masks.green & masks.blue) | | 140 (masks.red & masks.alpha) | (masks.green & masks.blue) | |
141 (masks.green & masks.alpha) | (masks.blue & masks.alpha)) != 0) { | 141 (masks.green & masks.alpha) | (masks.blue & masks.alpha)) != 0) { |
142 return NULL; | 142 return nullptr; |
143 } | 143 } |
144 | 144 |
145 // Collect information about the masks | 145 // Collect information about the masks |
146 const MaskInfo red = process_mask(masks.red, bitsPerPixel); | 146 const MaskInfo red = process_mask(masks.red, bitsPerPixel); |
147 const MaskInfo green = process_mask(masks.green, bitsPerPixel); | 147 const MaskInfo green = process_mask(masks.green, bitsPerPixel); |
148 const MaskInfo blue = process_mask(masks.blue, bitsPerPixel); | 148 const MaskInfo blue = process_mask(masks.blue, bitsPerPixel); |
149 const MaskInfo alpha = process_mask(masks.alpha, bitsPerPixel); | 149 const MaskInfo alpha = process_mask(masks.alpha, bitsPerPixel); |
150 | 150 |
151 return new SkMasks(red, green, blue, alpha); | 151 return new SkMasks(red, green, blue, alpha); |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 SkMasks::SkMasks(const MaskInfo red, const MaskInfo green, | 155 SkMasks::SkMasks(const MaskInfo red, const MaskInfo green, |
156 const MaskInfo blue, const MaskInfo alpha) | 156 const MaskInfo blue, const MaskInfo alpha) |
157 : fRed(red) | 157 : fRed(red) |
158 , fGreen(green) | 158 , fGreen(green) |
159 , fBlue(blue) | 159 , fBlue(blue) |
160 , fAlpha(alpha) | 160 , fAlpha(alpha) |
161 {} | 161 {} |
OLD | NEW |