| 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 "SkColorPriv.h" |    9 #include "SkColorPriv.h" | 
|   10 #include "SkStream.h" |   10 #include "SkStream.h" | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   96 SkWbmpCodec::SkWbmpCodec(const SkImageInfo& info, SkStream* stream) |   96 SkWbmpCodec::SkWbmpCodec(const SkImageInfo& info, SkStream* stream) | 
|   97     : INHERITED(info, stream) {} |   97     : INHERITED(info, stream) {} | 
|   98  |   98  | 
|   99 SkEncodedFormat SkWbmpCodec::onGetEncodedFormat() const { |   99 SkEncodedFormat SkWbmpCodec::onGetEncodedFormat() const { | 
|  100     return kWBMP_SkEncodedFormat; |  100     return kWBMP_SkEncodedFormat; | 
|  101 } |  101 } | 
|  102  |  102  | 
|  103 SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info, |  103 SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info, | 
|  104                                          void* pixels, |  104                                          void* pixels, | 
|  105                                          size_t rowBytes, |  105                                          size_t rowBytes, | 
|  106                                          const Options&, |  106                                          const Options& options, | 
|  107                                          SkPMColor ctable[], |  107                                          SkPMColor ctable[], | 
|  108                                          int* ctableCount) { |  108                                          int* ctableCount) { | 
|  109     SkCodec::RewindState rewindState = this->rewindIfNeeded(); |  109     SkCodec::RewindState rewindState = this->rewindIfNeeded(); | 
|  110     if (rewindState == kCouldNotRewind_RewindState) { |  110     if (rewindState == kCouldNotRewind_RewindState) { | 
|  111         return kCouldNotRewind; |  111         return kCouldNotRewind; | 
|  112     } else if (rewindState == kRewound_RewindState) { |  112     } else if (rewindState == kRewound_RewindState) { | 
|  113         (void)read_header(this->stream(), NULL); |  113         (void)read_header(this->stream(), NULL); | 
|  114     } |  114     } | 
 |  115     if (options.fSubset) { | 
 |  116         // Subsets are not supported. | 
 |  117         return kUnimplemented; | 
 |  118     } | 
|  115     if (info.dimensions() != this->getInfo().dimensions()) { |  119     if (info.dimensions() != this->getInfo().dimensions()) { | 
|  116         return kInvalidScale; |  120         return kInvalidScale; | 
|  117     } |  121     } | 
|  118     ExpandProc proc = NULL; |  122     ExpandProc proc = NULL; | 
|  119     switch (info.colorType()) { |  123     switch (info.colorType()) { | 
|  120         case kGray_8_SkColorType: |  124         case kGray_8_SkColorType: | 
|  121             proc = expand_bits_to_T<uint8_t, bit_to_grayscale>; |  125             proc = expand_bits_to_T<uint8_t, bit_to_grayscale>; | 
|  122             break; |  126             break; | 
|  123         case kN32_SkColorType: |  127         case kN32_SkColorType: | 
|  124             proc = expand_bits_to_T<SkPMColor, bit_to_pmcolor>; |  128             proc = expand_bits_to_T<SkPMColor, bit_to_pmcolor>; | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  157     SkAutoTDelete<SkStream> streamDeleter(stream); |  161     SkAutoTDelete<SkStream> streamDeleter(stream); | 
|  158     SkISize size; |  162     SkISize size; | 
|  159     if (!read_header(stream, &size)) { |  163     if (!read_header(stream, &size)) { | 
|  160         return NULL; |  164         return NULL; | 
|  161     } |  165     } | 
|  162     SkImageInfo info = |  166     SkImageInfo info = | 
|  163             SkImageInfo::Make(size.width(), size.height(), kGray_8_SkColorType, |  167             SkImageInfo::Make(size.width(), size.height(), kGray_8_SkColorType, | 
|  164                               kOpaque_SkAlphaType); |  168                               kOpaque_SkAlphaType); | 
|  165     return SkNEW_ARGS(SkWbmpCodec, (info, streamDeleter.detach())); |  169     return SkNEW_ARGS(SkWbmpCodec, (info, streamDeleter.detach())); | 
|  166 } |  170 } | 
| OLD | NEW |