| 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 "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
| 9 #include "SkBmpMaskCodec.h" | 9 #include "SkBmpMaskCodec.h" |
| 10 #include "SkBmpRLECodec.h" | 10 #include "SkBmpRLECodec.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 case 1: | 425 case 1: |
| 426 case 2: | 426 case 2: |
| 427 case 4: | 427 case 4: |
| 428 case 8: | 428 case 8: |
| 429 // However, we cannot in RLE format since we may need to leave some | 429 // However, we cannot in RLE format since we may need to leave some |
| 430 // pixels as transparent. Similarly, we also cannot for ICO images | 430 // pixels as transparent. Similarly, we also cannot for ICO images |
| 431 // since we may need to apply a transparent mask. | 431 // since we may need to apply a transparent mask. |
| 432 if (kRLE_BmpInputFormat != inputFormat && !inIco) { | 432 if (kRLE_BmpInputFormat != inputFormat && !inIco) { |
| 433 colorType = kIndex_8_SkColorType; | 433 colorType = kIndex_8_SkColorType; |
| 434 } | 434 } |
| 435 |
| 436 // Mask bmps must have 16, 24, or 32 bits per pixel. |
| 437 if (kBitMask_BmpInputFormat == inputFormat) { |
| 438 SkCodecPrintf("Error: invalid input value of bits per pixel for
mask bmp.\n"); |
| 439 return false; |
| 440 } |
| 435 case 24: | 441 case 24: |
| 436 case 32: | 442 case 32: |
| 437 break; | 443 break; |
| 438 default: | 444 default: |
| 439 SkCodecPrintf("Error: invalid input value for bits per pixel.\n"); | 445 SkCodecPrintf("Error: invalid input value for bits per pixel.\n"); |
| 440 return false; | 446 return false; |
| 441 } | 447 } |
| 442 | 448 |
| 443 // Check that input bit masks are valid and create the masks object | 449 // Check that input bit masks are valid and create the masks object |
| 444 SkAutoTDelete<SkMasks> | 450 SkAutoTDelete<SkMasks> |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 586 } |
| 581 | 587 |
| 582 bool SkBmpCodec::skipRows(int count) { | 588 bool SkBmpCodec::skipRows(int count) { |
| 583 const size_t bytesToSkip = count * fSrcRowBytes; | 589 const size_t bytesToSkip = count * fSrcRowBytes; |
| 584 return this->stream()->skip(bytesToSkip) == bytesToSkip; | 590 return this->stream()->skip(bytesToSkip) == bytesToSkip; |
| 585 } | 591 } |
| 586 | 592 |
| 587 bool SkBmpCodec::onSkipScanlines(int count) { | 593 bool SkBmpCodec::onSkipScanlines(int count) { |
| 588 return this->skipRows(count); | 594 return this->skipRows(count); |
| 589 } | 595 } |
| OLD | NEW |