| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 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 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 return true; | 253 return true; |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool SkBitmap::setConfig(const SkImageInfo& info, size_t rowBytes) { | 256 bool SkBitmap::setConfig(const SkImageInfo& info, size_t rowBytes) { |
| 257 // require that rowBytes fit in 31bits | 257 // require that rowBytes fit in 31bits |
| 258 int64_t mrb = info.minRowBytes64(); | 258 int64_t mrb = info.minRowBytes64(); |
| 259 if ((int32_t)mrb != mrb) { | 259 if ((int32_t)mrb != mrb) { |
| 260 return reset_return_false(this); | 260 return reset_return_false(this); |
| 261 } | 261 } |
| 262 if ((ssize_t)rowBytes != (int32_t)rowBytes) { | 262 if ((int64_t)rowBytes != (int32_t)rowBytes) { |
| 263 return reset_return_false(this); | 263 return reset_return_false(this); |
| 264 } | 264 } |
| 265 | 265 |
| 266 if (info.isEmpty()) { | 266 if (info.isEmpty()) { |
| 267 return reset_return_false(this); | 267 return reset_return_false(this); |
| 268 } | 268 } |
| 269 | 269 |
| 270 if (kUnknown_SkColorType == info.colorType()) { | 270 if (kUnknown_SkColorType == info.colorType()) { |
| 271 rowBytes = 0; | 271 rowBytes = 0; |
| 272 } else if (0 == rowBytes) { | 272 } else if (0 == rowBytes) { |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 | 1685 |
| 1686 #ifdef SK_DEBUG | 1686 #ifdef SK_DEBUG |
| 1687 void SkImageInfo::validate() const { | 1687 void SkImageInfo::validate() const { |
| 1688 SkASSERT(fWidth >= 0); | 1688 SkASSERT(fWidth >= 0); |
| 1689 SkASSERT(fHeight >= 0); | 1689 SkASSERT(fHeight >= 0); |
| 1690 SkASSERT(SkColorTypeIsValid(fColorType)); | 1690 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1691 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1691 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1692 } | 1692 } |
| 1693 #endif | 1693 #endif |
| 1694 | 1694 |
| OLD | NEW |