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

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

Issue 2343153003: Fix filling of incomplete images in SkSampledCodec (Closed)
Patch Set: Created 4 years, 3 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 | « infra/bots/assets/skimage/VERSION ('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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « infra/bots/assets/skimage/VERSION ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698