| OLD | NEW |
| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 SkDebugf("[terminated] Mode not implemented yet\n"); | 351 SkDebugf("[terminated] Mode not implemented yet\n"); |
| 352 } | 352 } |
| 353 | 353 |
| 354 dump_png(bitmap); | 354 dump_png(bitmap); |
| 355 return 0; | 355 return 0; |
| 356 } | 356 } |
| 357 | 357 |
| 358 int fuzz_skp(SkData* bytes) { | 358 int fuzz_skp(SkData* bytes) { |
| 359 SkMemoryStream stream(bytes); | 359 SkMemoryStream stream(bytes); |
| 360 SkDebugf("Decoding\n"); | 360 SkDebugf("Decoding\n"); |
| 361 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(&stream)); | 361 sk_sp<SkPicture> pic(SkPicture::MakeFromStream(&stream)); |
| 362 if (!pic) { | 362 if (!pic) { |
| 363 SkDebugf("[terminated] Couldn't decode as a picture.\n"); | 363 SkDebugf("[terminated] Couldn't decode as a picture.\n"); |
| 364 return 3; | 364 return 3; |
| 365 } | 365 } |
| 366 SkDebugf("Rendering\n"); | 366 SkDebugf("Rendering\n"); |
| 367 SkBitmap bitmap; | 367 SkBitmap bitmap; |
| 368 if (!FLAGS_dump.isEmpty()) { | 368 if (!FLAGS_dump.isEmpty()) { |
| 369 SkIRect size = pic->cullRect().roundOut(); | 369 SkIRect size = pic->cullRect().roundOut(); |
| 370 bitmap.allocN32Pixels(size.width(), size.height()); | 370 bitmap.allocN32Pixels(size.width(), size.height()); |
| 371 } | 371 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 if (min > max) { | 415 if (min > max) { |
| 416 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); | 416 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); |
| 417 this->signalBoring(); | 417 this->signalBoring(); |
| 418 } | 418 } |
| 419 float f = std::abs(this->nextF()); | 419 float f = std::abs(this->nextF()); |
| 420 if (!std::isnormal(f) && f != 0.0) { | 420 if (!std::isnormal(f) && f != 0.0) { |
| 421 this->signalBoring(); | 421 this->signalBoring(); |
| 422 } | 422 } |
| 423 return min + fmod(f, (max - min + 1)); | 423 return min + fmod(f, (max - min + 1)); |
| 424 } | 424 } |
| OLD | NEW |