| 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 "SkMath.h" | 10 #include "SkMath.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 | 251 |
| 252 sampler->setSampleY(sampleY); | 252 sampler->setSampleY(sampleY); |
| 253 | 253 |
| 254 int rowsDecoded; | 254 int rowsDecoded; |
| 255 const SkCodec::Result incResult = this->codec()->incrementalDecode(&
rowsDecoded); | 255 const SkCodec::Result incResult = this->codec()->incrementalDecode(&
rowsDecoded); |
| 256 if (incResult == SkCodec::kSuccess) { | 256 if (incResult == SkCodec::kSuccess) { |
| 257 return SkCodec::kSuccess; | 257 return SkCodec::kSuccess; |
| 258 } | 258 } |
| 259 SkASSERT(incResult == SkCodec::kIncompleteInput); | 259 SkASSERT(incResult == SkCodec::kIncompleteInput); |
| 260 const int lastRowInOutput = (rowsDecoded - startY) / sampleY; | 260 |
| 261 // FIXME: Should this be info or nativeInfo? Does it make a differen
ce? | 261 // Count the rows that we decoded, and also did not skip. |
| 262 const int trueRowsDecoded = (rowsDecoded + sampleY - 1) / sampleY; |
| 262 this->codec()->fillIncompleteImage(info, pixels, rowBytes, options.f
ZeroInitialized, | 263 this->codec()->fillIncompleteImage(info, pixels, rowBytes, options.f
ZeroInitialized, |
| 263 info.height(), lastRowInOutput); | 264 info.height(), trueRowsDecoded); |
| 264 return SkCodec::kIncompleteInput; | 265 return SkCodec::kIncompleteInput; |
| 265 } else if (startResult != SkCodec::kUnimplemented) { | 266 } else if (startResult != SkCodec::kUnimplemented) { |
| 266 return startResult; | 267 return startResult; |
| 267 } // kUnimplemented means use the old method. | 268 } // kUnimplemented means use the old method. |
| 268 } | 269 } |
| 269 | 270 |
| 270 // Start the scanline decode. | 271 // Start the scanline decode. |
| 271 SkCodec::Result result = this->codec()->startScanlineDecode(nativeInfo, | 272 SkCodec::Result result = this->codec()->startScanlineDecode(nativeInfo, |
| 272 &sampledOptions, options.fColorPtr, options.fColorCount); | 273 &sampledOptions, options.fColorPtr, options.fColorCount); |
| 273 if (SkCodec::kSuccess != result) { | 274 if (SkCodec::kSuccess != result) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 void* rowPtr = SkTAddOffset<void>(pixels, rowBytes * get_dst_coo
rd(srcY, sampleY)); | 349 void* rowPtr = SkTAddOffset<void>(pixels, rowBytes * get_dst_coo
rd(srcY, sampleY)); |
| 349 SkSampler::Fill(fillInfo, rowPtr, rowBytes, fillValue, options.f
ZeroInitialized); | 350 SkSampler::Fill(fillInfo, rowPtr, rowBytes, fillValue, options.f
ZeroInitialized); |
| 350 } | 351 } |
| 351 return SkCodec::kIncompleteInput; | 352 return SkCodec::kIncompleteInput; |
| 352 } | 353 } |
| 353 default: | 354 default: |
| 354 SkASSERT(false); | 355 SkASSERT(false); |
| 355 return SkCodec::kUnimplemented; | 356 return SkCodec::kUnimplemented; |
| 356 } | 357 } |
| 357 } | 358 } |
| OLD | NEW |