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

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

Issue 32623002: change ERROR label to BAD_CONFIG -- avoid windows complaint (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 if (canonical) { 293 if (canonical) {
294 *canonical = alphaType; 294 *canonical = alphaType;
295 } 295 }
296 return true; 296 return true;
297 } 297 }
298 298
299 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes, 299 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes,
300 SkAlphaType alphaType) { 300 SkAlphaType alphaType) {
301 if ((width | height) < 0) { 301 if ((width | height) < 0) {
302 goto ERROR; 302 goto BAD_CONFIG;
303 } 303 }
304 if (rowBytes == 0) { 304 if (rowBytes == 0) {
305 rowBytes = SkBitmap::ComputeRowBytes(config, width); 305 rowBytes = SkBitmap::ComputeRowBytes(config, width);
306 if (0 == rowBytes && kNo_Config != config) { 306 if (0 == rowBytes && kNo_Config != config) {
307 goto ERROR; 307 goto BAD_CONFIG;
308 } 308 }
309 } 309 }
310 310
311 if (!validate_alphaType(config, alphaType, &alphaType)) { 311 if (!validate_alphaType(config, alphaType, &alphaType)) {
312 goto ERROR; 312 goto BAD_CONFIG;
313 } 313 }
314 314
315 this->freePixels(); 315 this->freePixels();
316 316
317 fConfig = SkToU8(config); 317 fConfig = SkToU8(config);
318 fAlphaType = SkToU8(alphaType); 318 fAlphaType = SkToU8(alphaType);
319 fWidth = width; 319 fWidth = width;
320 fHeight = height; 320 fHeight = height;
321 fRowBytes = SkToU32(rowBytes); 321 fRowBytes = SkToU32(rowBytes);
322 322
323 fBytesPerPixel = (uint8_t)ComputeBytesPerPixel(config); 323 fBytesPerPixel = (uint8_t)ComputeBytesPerPixel(config);
324 324
325 SkDEBUGCODE(this->validate();) 325 SkDEBUGCODE(this->validate();)
326 return true; 326 return true;
327 327
328 // if we got here, we had an error, so we reset the bitmap to empty 328 // if we got here, we had an error, so we reset the bitmap to empty
329 ERROR: 329 BAD_CONFIG:
330 this->reset(); 330 this->reset();
331 return false; 331 return false;
332 } 332 }
333 333
334 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { 334 bool SkBitmap::setAlphaType(SkAlphaType alphaType) {
335 if (!validate_alphaType(this->config(), alphaType, &alphaType)) { 335 if (!validate_alphaType(this->config(), alphaType, &alphaType)) {
336 return false; 336 return false;
337 } 337 }
338 fAlphaType = SkToU8(alphaType); 338 fAlphaType = SkToU8(alphaType);
339 return true; 339 return true;
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 if (NULL != uri) { 1696 if (NULL != uri) {
1697 str->appendf(" uri:\"%s\"", uri); 1697 str->appendf(" uri:\"%s\"", uri);
1698 } else { 1698 } else {
1699 str->appendf(" pixelref:%p", pr); 1699 str->appendf(" pixelref:%p", pr);
1700 } 1700 }
1701 } 1701 }
1702 1702
1703 str->append(")"); 1703 str->append(")");
1704 } 1704 }
1705 #endif 1705 #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