| 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 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 | 9 |
| 10 #include "Sk2DPathEffect.h" | 10 #include "Sk2DPathEffect.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 SkPath path; | 73 SkPath path; |
| 74 path.addCircle(0, 0, SkIntToScalar(5)); | 74 path.addCircle(0, 0, SkIntToScalar(5)); |
| 75 | 75 |
| 76 return SkPath2DPathEffect::Create(m, path); | 76 return SkPath2DPathEffect::Create(m, path); |
| 77 } | 77 } |
| 78 | 78 |
| 79 static void path_effect(SkPaint* paint) { | 79 static void path_effect(SkPaint* paint) { |
| 80 paint->setPathEffect(make_tile_effect())->unref(); | 80 paint->setPathEffect(make_tile_effect())->unref(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static sk_sp<SkShader> make_shader(const SkRect& bounds) { | 83 static SkShader* make_shader(const SkRect& bounds) { |
| 84 const SkPoint pts[] = { | 84 const SkPoint pts[] = { |
| 85 { bounds.left(), bounds.top() }, | 85 { bounds.left(), bounds.top() }, |
| 86 { bounds.right(), bounds.bottom() }, | 86 { bounds.right(), bounds.bottom() }, |
| 87 }; | 87 }; |
| 88 const SkColor colors[] = { | 88 const SkColor colors[] = { |
| 89 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK, | 89 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK, |
| 90 SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, | 90 SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, |
| 91 }; | 91 }; |
| 92 return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(col
ors), | 92 return SkGradientShader::CreateLinear(pts, |
| 93 SkShader::kClamp_TileMode); | 93 colors, nullptr, SK_ARRAY_COUNT(colors
), |
| 94 SkShader::kClamp_TileMode); |
| 94 } | 95 } |
| 95 | 96 |
| 96 static void color_filter(SkPaint* paint) { | 97 static void color_filter(SkPaint* paint) { |
| 97 SkRect r; | 98 SkRect r; |
| 98 r.setWH(SkIntToScalar(kWidth), 50); | 99 r.setWH(SkIntToScalar(kWidth), 50); |
| 99 paint->setShader(make_shader(r)); | 100 paint->setShader(make_shader(r))->unref(); |
| 100 paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(0xF0F0F0, 0)
)->unref(); | 101 paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(0xF0F0F0, 0)
)->unref(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 static void kitchen_sink(SkPaint* paint) { | 104 static void kitchen_sink(SkPaint* paint) { |
| 104 color_filter(paint); | 105 color_filter(paint); |
| 105 path_effect(paint); | 106 path_effect(paint); |
| 106 mask_filter(paint); | 107 mask_filter(paint); |
| 107 | 108 |
| 108 } | 109 } |
| 109 | 110 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 SkAutoTUnref<const SkTextBlob> fBlob; | 250 SkAutoTUnref<const SkTextBlob> fBlob; |
| 250 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; | 251 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; |
| 251 | 252 |
| 252 typedef GM INHERITED; | 253 typedef GM INHERITED; |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 ////////////////////////////////////////////////////////////////////////////// | 256 ////////////////////////////////////////////////////////////////////////////// |
| 256 | 257 |
| 257 DEF_GM(return new TextBlobLooperGM;) | 258 DEF_GM(return new TextBlobLooperGM;) |
| 258 } | 259 } |
| OLD | NEW |