| 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.h" | 8 #include "SkCodec.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool SkWbmpCodec::onRewind() { | 69 bool SkWbmpCodec::onRewind() { |
| 70 return read_header(this->stream(), NULL); | 70 return read_header(this->stream(), NULL); |
| 71 } | 71 } |
| 72 | 72 |
| 73 SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, | 73 SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, |
| 74 const SkPMColor* ctable, const Options& opts) { | 74 const SkPMColor* ctable, const Options& opts) { |
| 75 // TODO (msarett): Reenable support for 565 if it is desired | |
| 76 // skbug.com/3683 | |
| 77 | |
| 78 // Create the swizzler based on the desired color type | 75 // Create the swizzler based on the desired color type |
| 79 switch (info.colorType()) { | 76 switch (info.colorType()) { |
| 80 case kIndex_8_SkColorType: | 77 case kIndex_8_SkColorType: |
| 81 case kN32_SkColorType: | 78 case kN32_SkColorType: |
| 79 case kRGB_565_SkColorType: |
| 82 case kGray_8_SkColorType: | 80 case kGray_8_SkColorType: |
| 83 return SkSwizzler::CreateSwizzler( | 81 return SkSwizzler::CreateSwizzler( |
| 84 SkSwizzler::kBit, ctable, info, opts.fZeroInitialized); | 82 SkSwizzler::kBit, ctable, info, opts.fZeroInitialized); |
| 85 default: | 83 default: |
| 86 return NULL; | 84 return NULL; |
| 87 } | 85 } |
| 88 } | 86 } |
| 89 | 87 |
| 90 SkCodec::Result SkWbmpCodec::readRow(uint8_t* row) { | 88 SkCodec::Result SkWbmpCodec::readRow(uint8_t* row) { |
| 91 if (this->stream()->read(row, fSrcRowBytes) != fSrcRowBytes) { | 89 if (this->stream()->read(row, fSrcRowBytes) != fSrcRowBytes) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 SkScanlineDecoder* SkWbmpCodec::NewSDFromStream(SkStream* stream) { | 236 SkScanlineDecoder* SkWbmpCodec::NewSDFromStream(SkStream* stream) { |
| 239 SkAutoTDelete<SkWbmpCodec> codec(static_cast<SkWbmpCodec*>( | 237 SkAutoTDelete<SkWbmpCodec> codec(static_cast<SkWbmpCodec*>( |
| 240 SkWbmpCodec::NewFromStream(stream))); | 238 SkWbmpCodec::NewFromStream(stream))); |
| 241 if (!codec) { | 239 if (!codec) { |
| 242 return NULL; | 240 return NULL; |
| 243 } | 241 } |
| 244 | 242 |
| 245 // Return the new scanline decoder | 243 // Return the new scanline decoder |
| 246 return SkNEW_ARGS(SkWbmpScanlineDecoder, (codec.detach())); | 244 return SkNEW_ARGS(SkWbmpScanlineDecoder, (codec.detach())); |
| 247 } | 245 } |
| OLD | NEW |