Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: src/core/SkBitmap.cpp

Issue 159533002: fix test for empty config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ((int64_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.width() < 0 || info.height() < 0) {
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) {
273 rowBytes = (size_t)mrb; 273 rowBytes = (size_t)mrb;
274 } else if (rowBytes < info.minRowBytes()) { 274 } else if (rowBytes < info.minRowBytes()) {
275 return reset_return_false(this); 275 return reset_return_false(this);
276 } 276 }
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 /////////////////////////////////////////////////////////////////////////////// 1684 ///////////////////////////////////////////////////////////////////////////////
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698