OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // Author: cevans@google.com (Chris Evans) | 9 // Author: cevans@google.com (Chris Evans) |
10 | 10 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 if (offset > 0 && (size_t)offset > pos_ && (size_t)offset < len_) { | 156 if (offset > 0 && (size_t)offset > pos_ && (size_t)offset < len_) { |
157 pos_ = offset; | 157 pos_ = offset; |
158 } | 158 } |
159 // Deliberately off-by-one; a load of BMPs seem to have their last byte | 159 // Deliberately off-by-one; a load of BMPs seem to have their last byte |
160 // missing. | 160 // missing. |
161 if (!rle && (pos_ + (rowLen * height_) > len_ + 1)) { | 161 if (!rle && (pos_ + (rowLen * height_) > len_ + 1)) { |
162 return false; | 162 return false; |
163 } | 163 } |
164 | 164 |
165 output_ = callback->SetSize(width_, height_); | 165 output_ = callback->SetSize(width_, height_); |
166 if (NULL == output_) { | 166 if (nullptr == output_) { |
167 return true; // meaning we succeeded, but they want us to stop now | 167 return true; // meaning we succeeded, but they want us to stop now |
168 } | 168 } |
169 | 169 |
170 if (rle && (bpp_ == 4 || bpp_ == 8)) { | 170 if (rle && (bpp_ == 4 || bpp_ == 8)) { |
171 DoRLEDecode(); | 171 DoRLEDecode(); |
172 } else { | 172 } else { |
173 DoStandardDecode(); | 173 DoStandardDecode(); |
174 } | 174 } |
175 return true; | 175 return true; |
176 } | 176 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 mask >>= 1; | 360 mask >>= 1; |
361 } | 361 } |
362 while (mask != 0 && !(mask & 0x80)) { | 362 while (mask != 0 && !(mask & 0x80)) { |
363 mask <<= 1; | 363 mask <<= 1; |
364 ret++; | 364 ret++; |
365 } | 365 } |
366 return ret; | 366 return ret; |
367 } | 367 } |
368 | 368 |
369 } // namespace image_codec | 369 } // namespace image_codec |
OLD | NEW |