OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 #include "SkCodec_libbmp.h" | 8 #include "SkCodec_libbmp.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 return false; | 563 return false; |
564 } | 564 } |
565 | 565 |
566 // After reading the color table, skip to the start of the pixel array | 566 // After reading the color table, skip to the start of the pixel array |
567 if (stream()->skip(fOffset - colorBytes) != fOffset - colorBytes) { | 567 if (stream()->skip(fOffset - colorBytes) != fOffset - colorBytes) { |
568 SkDebugf("Error: unable to skip to image data.\n"); | 568 SkDebugf("Error: unable to skip to image data.\n"); |
569 return false; | 569 return false; |
570 } | 570 } |
571 | 571 |
572 // Set the color table and return true on success | 572 // Set the color table and return true on success |
573 fColorTable.reset(SkNEW_ARGS(SkColorTable, (colorTable, maxColors))); | 573 if (maxColors > 0) { |
| 574 fColorTable.reset(SkNEW_ARGS(SkColorTable, (colorTable, maxColors))); |
| 575 } |
574 return true; | 576 return true; |
575 } | 577 } |
576 | 578 |
577 /* | 579 /* |
578 * | 580 * |
579 * Performs the bitmap decoding for bit masks input format | 581 * Performs the bitmap decoding for bit masks input format |
580 * | 582 * |
581 */ | 583 */ |
582 SkCodec::Result SkBmpCodec::decodeMask(const SkImageInfo& dstInfo, | 584 SkCodec::Result SkBmpCodec::decodeMask(const SkImageInfo& dstInfo, |
583 void* dst, size_t dstRowBytes) { | 585 void* dst, size_t dstRowBytes) { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 } | 1002 } |
1001 dstRow = SkTAddOffset<SkPMColor>(dstRow, dstRowBytes); | 1003 dstRow = SkTAddOffset<SkPMColor>(dstRow, dstRowBytes); |
1002 } | 1004 } |
1003 } | 1005 } |
1004 } | 1006 } |
1005 */ | 1007 */ |
1006 | 1008 |
1007 // Finished decoding the entire image | 1009 // Finished decoding the entire image |
1008 return kSuccess; | 1010 return kSuccess; |
1009 } | 1011 } |
OLD | NEW |