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

Side by Side Diff: tools/chrome_fuzz.cpp

Issue 1834303003: Delete SkFlattenable::Type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 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 | « tests/SerializationTest.cpp ('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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "SkCanvas.h" 5 #include "SkCanvas.h"
6 #include "SkFlattenableSerialization.h" 6 #include "SkFlattenableSerialization.h"
7 #include "SkImageFilter.h" 7 #include "SkImageFilter.h"
8 #include "SkOSFile.h" 8 #include "SkOSFile.h"
9 #include "SkString.h" 9 #include "SkString.h"
10 10
(...skipping 13 matching lines...) Expand all
24 testdata->resize(len); 24 testdata->resize(len);
25 (void) sk_fread(testdata->writable_str(), len, file); 25 (void) sk_fread(testdata->writable_str(), len, file);
26 return true; 26 return true;
27 } 27 }
28 28
29 static void run_test_case(const SkString& testdata, const SkBitmap& bitmap, 29 static void run_test_case(const SkString& testdata, const SkBitmap& bitmap,
30 SkCanvas* canvas) { 30 SkCanvas* canvas) {
31 // This call shouldn't crash or cause ASAN to flag any memory issues 31 // This call shouldn't crash or cause ASAN to flag any memory issues
32 // If nothing bad happens within this call, everything is fine 32 // If nothing bad happens within this call, everything is fine
33 SkFlattenable* flattenable = SkValidatingDeserializeFlattenable( 33 SkFlattenable* flattenable = SkValidatingDeserializeFlattenable(
34 testdata.c_str(), testdata.size(), SkImageFilter::GetFlattenableType()); 34 testdata.c_str(), testdata.size());
35 35
36 // Adding some info, but the test passed if we got here without any trouble 36 // Adding some info, but the test passed if we got here without any trouble
37 if (flattenable != nullptr) { 37 if (flattenable != nullptr) {
38 SkDebugf("Valid stream detected.\n"); 38 SkDebugf("Valid stream detected.\n");
39 // Let's see if using the filters can cause any trouble... 39 // Let's see if using the filters can cause any trouble...
40 SkPaint paint; 40 SkPaint paint;
41 paint.setImageFilter(static_cast<SkImageFilter*>(flattenable))->unref(); 41 paint.setImageFilter(static_cast<SkImageFilter*>(flattenable))->unref();
42 canvas->save(); 42 canvas->save();
43 canvas->clipRect(SkRect::MakeXYWH( 43 canvas->clipRect(SkRect::MakeXYWH(
44 0, 0, SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize))); 44 0, 0, SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize)));
(...skipping 27 matching lines...) Expand all
72 SkCanvas canvas(bitmap); 72 SkCanvas canvas(bitmap);
73 canvas.clear(0x00000000); 73 canvas.clear(0x00000000);
74 for (int i = 1; i < argc; i++) 74 for (int i = 1; i < argc; i++)
75 if (!read_and_run_test_case(argv[i], bitmap, &canvas)) 75 if (!read_and_run_test_case(argv[i], bitmap, &canvas))
76 ret = 2; 76 ret = 2;
77 // Cluster-Fuzz likes "#EOF" as the last line of output to help distinguish 77 // Cluster-Fuzz likes "#EOF" as the last line of output to help distinguish
78 // successful runs from crashes. 78 // successful runs from crashes.
79 SkDebugf("#EOF\n"); 79 SkDebugf("#EOF\n");
80 return ret; 80 return ret;
81 } 81 }
OLDNEW
« no previous file with comments | « tests/SerializationTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698