Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/codec/SkSampledCodec.cpp

Issue 2407543002: Simplify rowsDecoded returned by incrementalDecode (Closed)
Patch Set: Use fRowsWrittenToOutput in decodeAllRows (fix rebase issues) Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkPngCodec.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 260
261 // Count the rows that we decoded, and also did not skip. 261 SkASSERT(rowsDecoded <= info.height());
262 const int trueRowsDecoded = (rowsDecoded + sampleY - 1) / sampleY;
263 this->codec()->fillIncompleteImage(info, pixels, rowBytes, options.f ZeroInitialized, 262 this->codec()->fillIncompleteImage(info, pixels, rowBytes, options.f ZeroInitialized,
264 info.height(), trueRowsDecoded); 263 info.height(), rowsDecoded);
265 return SkCodec::kIncompleteInput; 264 return SkCodec::kIncompleteInput;
266 } else if (startResult != SkCodec::kUnimplemented) { 265 } else if (startResult != SkCodec::kUnimplemented) {
267 return startResult; 266 return startResult;
268 } // kUnimplemented means use the old method. 267 } // kUnimplemented means use the old method.
269 } 268 }
270 269
271 // Start the scanline decode. 270 // Start the scanline decode.
272 SkCodec::Result result = this->codec()->startScanlineDecode(nativeInfo, 271 SkCodec::Result result = this->codec()->startScanlineDecode(nativeInfo,
273 &sampledOptions, options.fColorPtr, options.fColorCount); 272 &sampledOptions, options.fColorPtr, options.fColorCount);
274 if (SkCodec::kSuccess != result) { 273 if (SkCodec::kSuccess != result) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void* rowPtr = SkTAddOffset<void>(pixels, rowBytes * get_dst_coo rd(srcY, sampleY)); 348 void* rowPtr = SkTAddOffset<void>(pixels, rowBytes * get_dst_coo rd(srcY, sampleY));
350 SkSampler::Fill(fillInfo, rowPtr, rowBytes, fillValue, options.f ZeroInitialized); 349 SkSampler::Fill(fillInfo, rowPtr, rowBytes, fillValue, options.f ZeroInitialized);
351 } 350 }
352 return SkCodec::kIncompleteInput; 351 return SkCodec::kIncompleteInput;
353 } 352 }
354 default: 353 default:
355 SkASSERT(false); 354 SkASSERT(false);
356 return SkCodec::kUnimplemented; 355 return SkCodec::kUnimplemented;
357 } 356 }
358 } 357 }
OLDNEW
« no previous file with comments | « src/codec/SkPngCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698