OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 return "ICO"; | 87 return "ICO"; |
88 case kJPEG_Format: | 88 case kJPEG_Format: |
89 return "JPEG"; | 89 return "JPEG"; |
90 case kPNG_Format: | 90 case kPNG_Format: |
91 return "PNG"; | 91 return "PNG"; |
92 case kWBMP_Format: | 92 case kWBMP_Format: |
93 return "WBMP"; | 93 return "WBMP"; |
94 case kWEBP_Format: | 94 case kWEBP_Format: |
95 return "WEBP"; | 95 return "WEBP"; |
96 default: | 96 default: |
97 SkASSERT(!"Invalid format type!"); | 97 SkDEBUGFAIL("Invalid format type!"); |
98 } | 98 } |
99 return "Unknown Format"; | 99 return "Unknown Format"; |
100 } | 100 } |
101 | 101 |
102 SkImageDecoder::Peeker* SkImageDecoder::setPeeker(Peeker* peeker) { | 102 SkImageDecoder::Peeker* SkImageDecoder::setPeeker(Peeker* peeker) { |
103 SkRefCnt_SafeAssign(fPeeker, peeker); | 103 SkRefCnt_SafeAssign(fPeeker, peeker); |
104 return peeker; | 104 return peeker; |
105 } | 105 } |
106 | 106 |
107 SkImageDecoder::Chooser* SkImageDecoder::setChooser(Chooser* chooser) { | 107 SkImageDecoder::Chooser* SkImageDecoder::setChooser(Chooser* chooser) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // Since Config is SkBitmap::kARGB_8888_Config, SkBitmapToImageInfo | 426 // Since Config is SkBitmap::kARGB_8888_Config, SkBitmapToImageInfo |
427 // will always succeed. | 427 // will always succeed. |
428 SkAssertResult(SkBitmapToImageInfo(bm, info)); | 428 SkAssertResult(SkBitmapToImageInfo(bm, info)); |
429 | 429 |
430 if (NULL == target) { | 430 if (NULL == target) { |
431 return true; | 431 return true; |
432 } | 432 } |
433 | 433 |
434 if (target->fRowBytes != SkToU32(bm.rowBytes())) { | 434 if (target->fRowBytes != SkToU32(bm.rowBytes())) { |
435 if (target->fRowBytes < SkImageMinRowBytes(*info)) { | 435 if (target->fRowBytes < SkImageMinRowBytes(*info)) { |
436 SkASSERT(!"Desired row bytes is too small"); | 436 SkDEBUGFAIL("Desired row bytes is too small"); |
437 return false; | 437 return false; |
438 } | 438 } |
439 bm.setConfig(bm.config(), bm.width(), bm.height(), target->fRowBytes); | 439 bm.setConfig(bm.config(), bm.width(), bm.height(), target->fRowBytes); |
440 } | 440 } |
441 | 441 |
442 // SkMemoryStream.rewind() will always return true. | 442 // SkMemoryStream.rewind() will always return true. |
443 SkAssertResult(stream.rewind()); | 443 SkAssertResult(stream.rewind()); |
444 return decode_pixels_to_8888(decoder.get(), &stream, &bm, target->fAddr); | 444 return decode_pixels_to_8888(decoder.get(), &stream, &bm, target->fAddr); |
445 } | 445 } |
446 | 446 |
(...skipping 13 matching lines...) Expand all Loading... |
460 if (kUnknown_Format == *format) { | 460 if (kUnknown_Format == *format) { |
461 if (stream->rewind()) { | 461 if (stream->rewind()) { |
462 *format = GetStreamFormat(stream); | 462 *format = GetStreamFormat(stream); |
463 } | 463 } |
464 } | 464 } |
465 } | 465 } |
466 delete codec; | 466 delete codec; |
467 } | 467 } |
468 return success; | 468 return success; |
469 } | 469 } |
OLD | NEW |