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

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 1713383002: fix misc asserts and checks found by fuzzer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « include/effects/SkDashPathEffect.h ('k') | src/core/SkCanvas.cpp » ('j') | 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 2013 Google Inc. 2 * Copyright 2013 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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "Sk1DPathEffect.h" 8 #include "Sk1DPathEffect.h"
9 #include "Sk2DPathEffect.h" 9 #include "Sk2DPathEffect.h"
10 #include "SkAlphaThresholdFilter.h" 10 #include "SkAlphaThresholdFilter.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 static SkFilterQuality make_filter_quality() { 198 static SkFilterQuality make_filter_quality() {
199 return static_cast<SkFilterQuality>(R(kHigh_SkFilterQuality+1)); 199 return static_cast<SkFilterQuality>(R(kHigh_SkFilterQuality+1));
200 } 200 }
201 201
202 static SkTypeface::Style make_typeface_style() { 202 static SkTypeface::Style make_typeface_style() {
203 return static_cast<SkTypeface::Style>(R(SkTypeface::kBoldItalic+1)); 203 return static_cast<SkTypeface::Style>(R(SkTypeface::kBoldItalic+1));
204 } 204 }
205 205
206 static SkPath1DPathEffect::Style make_path_1d_path_effect_style() { 206 static SkPath1DPathEffect::Style make_path_1d_path_effect_style() {
207 return static_cast<SkPath1DPathEffect::Style>(R(SkPath1DPathEffect::kStyleCo unt)); 207 return static_cast<SkPath1DPathEffect::Style>(R((int)SkPath1DPathEffect::kMo rph_Style + 1));
208 } 208 }
209 209
210 static SkColor make_color() { 210 static SkColor make_color() {
211 return (R(2) == 1) ? 0xFFC0F0A0 : 0xFF000090; 211 return (R(2) == 1) ? 0xFFC0F0A0 : 0xFF000090;
212 } 212 }
213 213
214 static SkDropShadowImageFilter::ShadowMode make_shadow_mode() { 214 static SkDropShadowImageFilter::ShadowMode make_shadow_mode() {
215 return (R(2) == 1) ? SkDropShadowImageFilter::kDrawShadowAndForeground_Shado wMode : 215 return (R(2) == 1) ? SkDropShadowImageFilter::kDrawShadowAndForeground_Shado wMode :
216 SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode; 216 SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode;
217 } 217 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 paint.setStrokeWidth(make_scalar()); 522 paint.setStrokeWidth(make_scalar());
523 paint.setStrokeMiter(make_scalar()); 523 paint.setStrokeMiter(make_scalar());
524 paint.setStrokeCap(make_paint_cap()); 524 paint.setStrokeCap(make_paint_cap());
525 paint.setStrokeJoin(make_paint_join()); 525 paint.setStrokeJoin(make_paint_join());
526 paint.setColorFilter(make_color_filter()); 526 paint.setColorFilter(make_color_filter());
527 paint.setXfermodeMode(make_xfermode()); 527 paint.setXfermodeMode(make_xfermode());
528 paint.setPathEffect(make_path_effect()); 528 paint.setPathEffect(make_path_effect());
529 paint.setMaskFilter(make_mask_filter()); 529 paint.setMaskFilter(make_mask_filter());
530 SkAutoTUnref<SkTypeface> typeface( 530 SkAutoTUnref<SkTypeface> typeface(
531 SkTypeface::CreateFromName(make_font_name().c_str(), make_typeface_style ())); 531 SkTypeface::CreateFromName(make_font_name().c_str(), make_typeface_style ()));
532 #if 0
532 paint.setTypeface(typeface); 533 paint.setTypeface(typeface);
534 #endif
533 SkLayerRasterizer::Builder rasterizerBuilder; 535 SkLayerRasterizer::Builder rasterizerBuilder;
534 SkPaint paintForRasterizer; 536 SkPaint paintForRasterizer;
535 if (R(2) == 1) { 537 if (R(2) == 1) {
536 paintForRasterizer = make_paint(); 538 paintForRasterizer = make_paint();
537 } 539 }
538 rasterizerBuilder.addLayer(paintForRasterizer); 540 rasterizerBuilder.addLayer(paintForRasterizer);
539 SkAutoTUnref<SkRasterizer> rasterizer(rasterizerBuilder.detachRasterizer()); 541 SkAutoTUnref<SkRasterizer> rasterizer(rasterizerBuilder.detachRasterizer());
540 paint.setRasterizer(rasterizer); 542 paint.setRasterizer(rasterizer);
541 paint.setImageFilter(make_image_filter()); 543 paint.setImageFilter(make_image_filter());
542 SkAutoDataUnref data(make_3Dlut(nullptr, make_bool(), make_bool(), make_bool ())); 544 SkAutoDataUnref data(make_3Dlut(nullptr, make_bool(), make_bool(), make_bool ()));
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 818 }
817 819
818 private: 820 private:
819 typedef SkView INHERITED; 821 typedef SkView INHERITED;
820 }; 822 };
821 823
822 ////////////////////////////////////////////////////////////////////////////// 824 //////////////////////////////////////////////////////////////////////////////
823 825
824 static SkView* MyFactory() { return new ImageFilterFuzzView; } 826 static SkView* MyFactory() { return new ImageFilterFuzzView; }
825 static SkViewRegister reg(MyFactory); 827 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkDashPathEffect.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698