| 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 "SkMasks.h" | 9 #include "SkMasks.h" |
| 9 #include "SkTypes.h" | 10 #include "SkTypes.h" |
| 10 | 11 |
| 11 /* | 12 /* |
| 12 * | 13 * |
| 13 * Used to convert 1-7 bit color components into 8-bit color components | 14 * Used to convert 1-7 bit color components into 8-bit color components |
| 14 * | 15 * |
| 15 */ | 16 */ |
| 16 const static uint8_t n_bit_to_8_bit_lookup_table[] = { | 17 const static uint8_t n_bit_to_8_bit_lookup_table[] = { |
| 17 // 1 bit | 18 // 1 bit |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Count trailing zeros on masks | 100 // Count trailing zeros on masks |
| 100 for (; (tempMask & 1) == 0; tempMask >>= 1) { | 101 for (; (tempMask & 1) == 0; tempMask >>= 1) { |
| 101 shift++; | 102 shift++; |
| 102 } | 103 } |
| 103 // Count the size of the mask | 104 // Count the size of the mask |
| 104 for (; tempMask & 1; tempMask >>= 1) { | 105 for (; tempMask & 1; tempMask >>= 1) { |
| 105 size++; | 106 size++; |
| 106 } | 107 } |
| 107 // Check that the mask is continuous | 108 // Check that the mask is continuous |
| 108 if (tempMask != 0) { | 109 if (tempMask != 0) { |
| 109 SkDebugf("Warning: Bit masks is not continuous.\n"); | 110 SkCodecPrintf("Warning: Bit masks is not continuous.\n"); |
| 110 } | 111 } |
| 111 // Truncate masks greater than 8 bits | 112 // Truncate masks greater than 8 bits |
| 112 if (size > 8) { | 113 if (size > 8) { |
| 113 shift += size - 8; | 114 shift += size - 8; |
| 114 size = 8; | 115 size = 8; |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 // Save the calculated values | 119 // Save the calculated values |
| 119 const SkMasks::MaskInfo info = { mask, shift, size }; | 120 const SkMasks::MaskInfo info = { mask, shift, size }; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 152 } |
| 152 | 153 |
| 153 | 154 |
| 154 SkMasks::SkMasks(const MaskInfo red, const MaskInfo green, | 155 SkMasks::SkMasks(const MaskInfo red, const MaskInfo green, |
| 155 const MaskInfo blue, const MaskInfo alpha) | 156 const MaskInfo blue, const MaskInfo alpha) |
| 156 : fRed(red) | 157 : fRed(red) |
| 157 , fGreen(green) | 158 , fGreen(green) |
| 158 , fBlue(blue) | 159 , fBlue(blue) |
| 159 , fAlpha(alpha) | 160 , fAlpha(alpha) |
| 160 {} | 161 {} |
| OLD | NEW |