| 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 14 matching lines...) Expand all  Loading... | 
| 25         SkPMColor* colorPtr, int* colorCount) { | 25         SkPMColor* colorPtr, int* colorCount) { | 
| 26     if (kIndex_8_SkColorType == colorType) { | 26     if (kIndex_8_SkColorType == colorType) { | 
| 27         colorPtr[0] = SK_ColorBLACK; | 27         colorPtr[0] = SK_ColorBLACK; | 
| 28         colorPtr[1] = SK_ColorWHITE; | 28         colorPtr[1] = SK_ColorWHITE; | 
| 29         *colorCount = 2; | 29         *colorCount = 2; | 
| 30     } | 30     } | 
| 31 } | 31 } | 
| 32 | 32 | 
| 33 static inline bool valid_color_type(SkColorType colorType, SkAlphaType alphaType
     ) { | 33 static inline bool valid_color_type(SkColorType colorType, SkAlphaType alphaType
     ) { | 
| 34     switch (colorType) { | 34     switch (colorType) { | 
| 35         case kN32_SkColorType: | 35         case kRGBA_8888_SkColorType: | 
|  | 36         case kBGRA_8888_SkColorType: | 
| 36         case kIndex_8_SkColorType: | 37         case kIndex_8_SkColorType: | 
| 37             return true; | 38             return true; | 
| 38         case kGray_8_SkColorType: | 39         case kGray_8_SkColorType: | 
| 39         case kRGB_565_SkColorType: | 40         case kRGB_565_SkColorType: | 
| 40             return kOpaque_SkAlphaType == alphaType; | 41             return kOpaque_SkAlphaType == alphaType; | 
| 41         default: | 42         default: | 
| 42             return false; | 43             return false; | 
| 43     } | 44     } | 
| 44 } | 45 } | 
| 45 | 46 | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 90     } | 91     } | 
| 91     return true; | 92     return true; | 
| 92 } | 93 } | 
| 93 | 94 | 
| 94 bool SkWbmpCodec::onRewind() { | 95 bool SkWbmpCodec::onRewind() { | 
| 95     return read_header(this->stream(), nullptr); | 96     return read_header(this->stream(), nullptr); | 
| 96 } | 97 } | 
| 97 | 98 | 
| 98 SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, const SkPMC
     olor* ctable, | 99 SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, const SkPMC
     olor* ctable, | 
| 99         const Options& opts) { | 100         const Options& opts) { | 
| 100     return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts); | 101     return SkSwizzler::CreateSwizzler(this->getEncodedInfo(), ctable, info, opts
     ); | 
| 101 } | 102 } | 
| 102 | 103 | 
| 103 bool SkWbmpCodec::readRow(uint8_t* row) { | 104 bool SkWbmpCodec::readRow(uint8_t* row) { | 
| 104     return this->stream()->read(row, fSrcRowBytes) == fSrcRowBytes; | 105     return this->stream()->read(row, fSrcRowBytes) == fSrcRowBytes; | 
| 105 } | 106 } | 
| 106 | 107 | 
| 107 SkWbmpCodec::SkWbmpCodec(const SkEncodedInfo& info, SkStream* stream) | 108 SkWbmpCodec::SkWbmpCodec(const SkEncodedInfo& info, SkStream* stream) | 
| 108     : INHERITED(info, stream) | 109     : INHERITED(info, stream) | 
| 109     , fSrcRowBytes(get_src_row_bytes(this->getInfo().width())) | 110     , fSrcRowBytes(get_src_row_bytes(this->getInfo().width())) | 
| 110     , fSwizzler(nullptr) | 111     , fSwizzler(nullptr) | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 209     } | 210     } | 
| 210 | 211 | 
| 211     // Initialize the swizzler | 212     // Initialize the swizzler | 
| 212     fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
     get()), options)); | 213     fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
     get()), options)); | 
| 213     SkASSERT(fSwizzler); | 214     SkASSERT(fSwizzler); | 
| 214 | 215 | 
| 215     fSrcBuffer.reset(fSrcRowBytes); | 216     fSrcBuffer.reset(fSrcRowBytes); | 
| 216 | 217 | 
| 217     return kSuccess; | 218     return kSuccess; | 
| 218 } | 219 } | 
| OLD | NEW | 
|---|