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

Side by Side Diff: fuzz/fuzz.cpp

Issue 2045293002: Add support for multiple frames in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Various fixes 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
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void* dst = bitmap.getAddr(0, 0); 193 void* dst = bitmap.getAddr(0, 0);
194 size_t rowBytes = bitmap.rowBytes(); 194 size_t rowBytes = bitmap.rowBytes();
195 uint32_t height = decodeInfo.height(); 195 uint32_t height = decodeInfo.height();
196 switch (codec->getScanlineOrder()) { 196 switch (codec->getScanlineOrder()) {
197 case SkCodec::kTopDown_SkScanlineOrder: 197 case SkCodec::kTopDown_SkScanlineOrder:
198 case SkCodec::kBottomUp_SkScanlineOrder: 198 case SkCodec::kBottomUp_SkScanlineOrder:
199 // We do not need to check the return value. On an incomple te 199 // We do not need to check the return value. On an incomple te
200 // image, memory will be filled with a default value. 200 // image, memory will be filled with a default value.
201 codec->getScanlines(dst, height, rowBytes); 201 codec->getScanlines(dst, height, rowBytes);
202 break; 202 break;
203 case SkCodec::kOutOfOrder_SkScanlineOrder: {
204 for (int y = 0; y < decodeInfo.height(); y++) {
205 int dstY = codec->outputScanline(y);
206 void* dstPtr = bitmap.getAddr(0, dstY);
207 // We complete the loop, even if this call begins to fai l
208 // due to an incomplete image. This ensures any uniniti alized
209 // memory will be filled with the proper value.
210 codec->getScanlines(dstPtr, 1, bitmap.rowBytes());
211 }
212 break;
213 }
214 } 203 }
215 SkDebugf("[terminated] Success!\n"); 204 SkDebugf("[terminated] Success!\n");
216 break; 205 break;
217 } 206 }
218 case 2: { //kStripe_Mode 207 case 2: { //kStripe_Mode
219 const int height = decodeInfo.height(); 208 const int height = decodeInfo.height();
220 // This value is chosen arbitrarily. We exercise more cases by choo sing a value that 209 // This value is chosen arbitrarily. We exercise more cases by choo sing a value that
221 // does not align with image blocks. 210 // does not align with image blocks.
222 const int stripeHeight = 37; 211 const int stripeHeight = 37;
223 const int numStripes = (height + stripeHeight - 1) / stripeHeight; 212 const int numStripes = (height + stripeHeight - 1) / stripeHeight;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (min > max) { 440 if (min > max) {
452 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); 441 SkDebugf("Check mins and maxes (%f, %f)\n", min, max);
453 this->signalBoring(); 442 this->signalBoring();
454 } 443 }
455 float f = std::abs(this->nextF()); 444 float f = std::abs(this->nextF());
456 if (!std::isnormal(f) && f != 0.0) { 445 if (!std::isnormal(f) && f != 0.0) {
457 this->signalBoring(); 446 this->signalBoring();
458 } 447 }
459 return min + fmod(f, (max - min + 1)); 448 return min + fmod(f, (max - min + 1));
460 } 449 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698