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(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 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 |
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 Loading... |
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); |
OLD | NEW |