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

Side by Side Diff: fuzz/fuzz.cpp

Issue 1997703003: Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Fixes for ICO/SampledCodec Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "Fuzz.h" 8 #include "Fuzz.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 SkDebugf("[terminated] Could not start scanline decoder\n"); 180 SkDebugf("[terminated] Could not start scanline decoder\n");
181 return 7; 181 return 7;
182 } 182 }
183 183
184 void* dst = bitmap.getAddr(0, 0); 184 void* dst = bitmap.getAddr(0, 0);
185 size_t rowBytes = bitmap.rowBytes(); 185 size_t rowBytes = bitmap.rowBytes();
186 uint32_t height = decodeInfo.height(); 186 uint32_t height = decodeInfo.height();
187 switch (codec->getScanlineOrder()) { 187 switch (codec->getScanlineOrder()) {
188 case SkCodec::kTopDown_SkScanlineOrder: 188 case SkCodec::kTopDown_SkScanlineOrder:
189 case SkCodec::kBottomUp_SkScanlineOrder: 189 case SkCodec::kBottomUp_SkScanlineOrder:
190 case SkCodec::kNone_SkScanlineOrder:
191 // We do not need to check the return value. On an incomple te 190 // We do not need to check the return value. On an incomple te
192 // image, memory will be filled with a default value. 191 // image, memory will be filled with a default value.
193 codec->getScanlines(dst, height, rowBytes); 192 codec->getScanlines(dst, height, rowBytes);
194 break; 193 break;
195 case SkCodec::kOutOfOrder_SkScanlineOrder: { 194 case SkCodec::kOutOfOrder_SkScanlineOrder: {
196 for (int y = 0; y < decodeInfo.height(); y++) { 195 for (int y = 0; y < decodeInfo.height(); y++) {
197 int dstY = codec->outputScanline(y); 196 int dstY = codec->outputScanline(y);
198 void* dstPtr = bitmap.getAddr(0, dstY); 197 void* dstPtr = bitmap.getAddr(0, dstY);
199 // We complete the loop, even if this call begins to fai l 198 // We complete the loop, even if this call begins to fai l
200 // due to an incomplete image. This ensures any uniniti alized 199 // due to an incomplete image. This ensures any uniniti alized
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (min > max) { 416 if (min > max) {
418 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); 417 SkDebugf("Check mins and maxes (%f, %f)\n", min, max);
419 this->signalBoring(); 418 this->signalBoring();
420 } 419 }
421 float f = std::abs(this->nextF()); 420 float f = std::abs(this->nextF());
422 if (!std::isnormal(f) && f != 0.0) { 421 if (!std::isnormal(f) && f != 0.0) {
423 this->signalBoring(); 422 this->signalBoring();
424 } 423 }
425 return min + fmod(f, (max - min + 1)); 424 return min + fmod(f, (max - min + 1));
426 } 425 }
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | include/codec/SkCodec.h » ('j') | src/codec/SkCodec.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698