| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 for (int y = 0; y < count; ++y) { | 174 for (int y = 0; y < count; ++y) { |
| 175 if (!this->readRow(fSrcBuffer.get())) { | 175 if (!this->readRow(fSrcBuffer.get())) { |
| 176 return y; | 176 return y; |
| 177 } | 177 } |
| 178 fSwizzler->swizzle(dstRow, fSrcBuffer.get()); | 178 fSwizzler->swizzle(dstRow, fSrcBuffer.get()); |
| 179 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes); | 179 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes); |
| 180 } | 180 } |
| 181 return count; | 181 return count; |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool SkWbmpCodec::onSkipScanlines(int count) { |
| 185 const size_t bytesToSkip = count * fSrcRowBytes; |
| 186 return this->stream()->skip(bytesToSkip) == bytesToSkip; |
| 187 } |
| 188 |
| 184 SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, | 189 SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, |
| 185 const Options& options, SkPMColor inputColorTable[], int* inputColorCoun
t) { | 190 const Options& options, SkPMColor inputColorTable[], int* inputColorCoun
t) { |
| 186 if (options.fSubset) { | 191 if (options.fSubset) { |
| 187 // Subsets are not supported. | 192 // Subsets are not supported. |
| 188 return kUnimplemented; | 193 return kUnimplemented; |
| 189 } | 194 } |
| 190 | 195 |
| 191 if (!valid_alpha(dstInfo.alphaType(), this->getInfo().alphaType())) { | 196 if (!valid_alpha(dstInfo.alphaType(), this->getInfo().alphaType())) { |
| 192 return kInvalidConversion; | 197 return kInvalidConversion; |
| 193 } | 198 } |
| 194 | 199 |
| 195 // Fill in the color table | 200 // Fill in the color table |
| 196 setup_color_table(dstInfo.colorType(), inputColorTable, inputColorCount); | 201 setup_color_table(dstInfo.colorType(), inputColorTable, inputColorCount); |
| 197 | 202 |
| 198 // Copy the color table to a pointer that can be owned by the scanline decod
er | 203 // Copy the color table to a pointer that can be owned by the scanline decod
er |
| 199 if (kIndex_8_SkColorType == dstInfo.colorType()) { | 204 if (kIndex_8_SkColorType == dstInfo.colorType()) { |
| 200 fColorTable.reset(new SkColorTable(inputColorTable, 2)); | 205 fColorTable.reset(new SkColorTable(inputColorTable, 2)); |
| 201 } | 206 } |
| 202 | 207 |
| 203 // Initialize the swizzler | 208 // Initialize the swizzler |
| 204 fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
get()), options)); | 209 fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
get()), options)); |
| 205 if (nullptr == fSwizzler.get()) { | 210 if (nullptr == fSwizzler.get()) { |
| 206 return kInvalidConversion; | 211 return kInvalidConversion; |
| 207 } | 212 } |
| 208 | 213 |
| 209 fSrcBuffer.reset(fSrcRowBytes); | 214 fSrcBuffer.reset(fSrcRowBytes); |
| 210 | 215 |
| 211 return kSuccess; | 216 return kSuccess; |
| 212 } | 217 } |
| OLD | NEW |