OLD | NEW |
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 Loading... |
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((int)SkPath1DPathEffect::kMo
rph_Style + 1)); | 207 return static_cast<SkPath1DPathEffect::Style>(R(SkPath1DPathEffect::kStyleCo
unt)); |
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 Loading... |
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 | |
533 paint.setTypeface(typeface); | 532 paint.setTypeface(typeface); |
534 #endif | |
535 SkLayerRasterizer::Builder rasterizerBuilder; | 533 SkLayerRasterizer::Builder rasterizerBuilder; |
536 SkPaint paintForRasterizer; | 534 SkPaint paintForRasterizer; |
537 if (R(2) == 1) { | 535 if (R(2) == 1) { |
538 paintForRasterizer = make_paint(); | 536 paintForRasterizer = make_paint(); |
539 } | 537 } |
540 rasterizerBuilder.addLayer(paintForRasterizer); | 538 rasterizerBuilder.addLayer(paintForRasterizer); |
541 SkAutoTUnref<SkRasterizer> rasterizer(rasterizerBuilder.detachRasterizer()); | 539 SkAutoTUnref<SkRasterizer> rasterizer(rasterizerBuilder.detachRasterizer()); |
542 paint.setRasterizer(rasterizer); | 540 paint.setRasterizer(rasterizer); |
543 paint.setImageFilter(make_image_filter()); | 541 paint.setImageFilter(make_image_filter()); |
544 SkAutoDataUnref data(make_3Dlut(nullptr, make_bool(), make_bool(), make_bool
())); | 542 SkAutoDataUnref data(make_3Dlut(nullptr, make_bool(), make_bool(), make_bool
())); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 } | 816 } |
819 | 817 |
820 private: | 818 private: |
821 typedef SkView INHERITED; | 819 typedef SkView INHERITED; |
822 }; | 820 }; |
823 | 821 |
824 ////////////////////////////////////////////////////////////////////////////// | 822 ////////////////////////////////////////////////////////////////////////////// |
825 | 823 |
826 static SkView* MyFactory() { return new ImageFilterFuzzView; } | 824 static SkView* MyFactory() { return new ImageFilterFuzzView; } |
827 static SkViewRegister reg(MyFactory); | 825 static SkViewRegister reg(MyFactory); |
OLD | NEW |