Herb Derby | 438775b | 2020-04-24 12:10:43 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "gm/gm.h" |
| 9 | #include "include/core/SkCanvas.h" |
| 10 | #include "include/core/SkFont.h" |
| 11 | #include "include/core/SkPaint.h" |
| 12 | #include "include/core/SkPath.h" |
| 13 | #include "include/effects/SkGradientShader.h" |
| 14 | |
| 15 | DEF_SIMPLE_GM(crbug_1073670, canvas, 250, 250) { |
| 16 | SkPoint pts[] = {{0, 0}, {0, 250}}; |
| 17 | SkColor colors[] = {0xFFFF0000, 0xFF0000FF}; |
| 18 | auto sh = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkTileMode::kClamp); |
| 19 | SkPaint p; |
| 20 | p.setShader(sh); |
| 21 | |
| 22 | SkFont f; |
| 23 | f.setSize(325); |
| 24 | f.setEdging(SkFont::Edging::kAntiAlias); |
| 25 | |
| 26 | canvas->drawString("Gradient", 10, 250, f, p); |
| 27 | } |