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