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

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

Issue 1417993006: Fix bug in sampled decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 dstHeight, 0); 208 dstHeight, 0);
209 return SkCodec::kIncompleteInput; 209 return SkCodec::kIncompleteInput;
210 } 210 }
211 void* pixelPtr = pixels; 211 void* pixelPtr = pixels;
212 for (int y = 0; y < dstHeight; y++) { 212 for (int y = 0; y < dstHeight; y++) {
213 if (1 != fCodec->getScanlines(pixelPtr, 1, rowBytes)) { 213 if (1 != fCodec->getScanlines(pixelPtr, 1, rowBytes)) {
214 fCodec->fillIncompleteImage(info, pixels, rowBytes, options. fZeroInitialized, 214 fCodec->fillIncompleteImage(info, pixels, rowBytes, options. fZeroInitialized,
215 dstHeight, y + 1); 215 dstHeight, y + 1);
216 return SkCodec::kIncompleteInput; 216 return SkCodec::kIncompleteInput;
217 } 217 }
218 int linesToSkip = SkTMin(sampleY - 1, dstHeight - y - 1); 218 if (y < dstHeight - 1) {
msarett 2015/11/05 17:57:19 I think the intent here was to not skip past the e
219 if (!fCodec->skipScanlines(linesToSkip)) { 219 if (!fCodec->skipScanlines(sampleY - 1)) {
220 fCodec->fillIncompleteImage(info, pixels, rowBytes, options. fZeroInitialized, 220 fCodec->fillIncompleteImage(info, pixels, rowBytes,
221 dstHeight, y + 1); 221 options.fZeroInitialized, dstHeight, y + 1);
222 return SkCodec::kIncompleteInput; 222 return SkCodec::kIncompleteInput;
223 }
223 } 224 }
224 pixelPtr = SkTAddOffset<void>(pixelPtr, rowBytes); 225 pixelPtr = SkTAddOffset<void>(pixelPtr, rowBytes);
225 } 226 }
226 return SkCodec::kSuccess; 227 return SkCodec::kSuccess;
227 } 228 }
228 case SkCodec::kNone_SkScanlineOrder: { 229 case SkCodec::kNone_SkScanlineOrder: {
229 const int linesNeeded = subsetHeight - samplingOffsetY; 230 const int linesNeeded = subsetHeight - samplingOffsetY;
230 SkAutoMalloc storage(linesNeeded * rowBytes); 231 SkAutoMalloc storage(linesNeeded * rowBytes);
231 uint8_t* storagePtr = static_cast<uint8_t*>(storage.get()); 232 uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());
232 233
(...skipping 14 matching lines...) Expand all
247 // fCodec has already handled filling uninitialized memory. 248 // fCodec has already handled filling uninitialized memory.
248 return SkCodec::kIncompleteInput; 249 return SkCodec::kIncompleteInput;
249 } 250 }
250 return SkCodec::kSuccess; 251 return SkCodec::kSuccess;
251 } 252 }
252 default: 253 default:
253 SkASSERT(false); 254 SkASSERT(false);
254 return SkCodec::kUnimplemented; 255 return SkCodec::kUnimplemented;
255 } 256 }
256 } 257 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698