| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 kCMYK4BitRLE_BitmapCompressionMethod = 13 | 90 kCMYK4BitRLE_BitmapCompressionMethod = 13 |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 /* | 93 /* |
| 94 * | 94 * |
| 95 * Checks the start of the stream to see if the image is a bitmap | 95 * Checks the start of the stream to see if the image is a bitmap |
| 96 * | 96 * |
| 97 */ | 97 */ |
| 98 bool SkBmpCodec::IsBmp(SkStream* stream) { | 98 bool SkBmpCodec::IsBmp(SkStream* stream) { |
| 99 // TODO: Support "IC", "PT", "CI", "CP", "BA" | 99 // TODO: Support "IC", "PT", "CI", "CP", "BA" |
| 100 // TODO: ICO files may contain a BMP and need to use this decoder | |
| 101 const char bmpSig[] = { 'B', 'M' }; | 100 const char bmpSig[] = { 'B', 'M' }; |
| 102 char buffer[sizeof(bmpSig)]; | 101 char buffer[sizeof(bmpSig)]; |
| 103 return stream->read(buffer, sizeof(bmpSig)) == sizeof(bmpSig) && | 102 return stream->read(buffer, sizeof(bmpSig)) == sizeof(bmpSig) && |
| 104 !memcmp(buffer, bmpSig, sizeof(bmpSig)); | 103 !memcmp(buffer, bmpSig, sizeof(bmpSig)); |
| 105 } | 104 } |
| 106 | 105 |
| 107 /* | 106 /* |
| 108 * | 107 * |
| 109 * Assumes IsBmp was called and returned true | 108 * Assumes IsBmp was called and returned true |
| 110 * Creates a bmp decoder | 109 * Creates a bmp decoder |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 uint32_t alphaBit = | 1183 uint32_t alphaBit = |
| 1185 (srcBuffer.get()[quotient] >> shift) & 0x1; | 1184 (srcBuffer.get()[quotient] >> shift) & 0x1; |
| 1186 dstRow[x] &= alphaBit - 1; | 1185 dstRow[x] &= alphaBit - 1; |
| 1187 } | 1186 } |
| 1188 } | 1187 } |
| 1189 } | 1188 } |
| 1190 | 1189 |
| 1191 // Finished decoding the entire image | 1190 // Finished decoding the entire image |
| 1192 return kSuccess; | 1191 return kSuccess; |
| 1193 } | 1192 } |
| OLD | NEW |