xref: /aosp_15_r20/external/skia/gm/crbug_1073670.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #include "tools/fonts/FontToolUtils.h"
15 
16 DEF_SIMPLE_GM(crbug_1073670, canvas, 250, 250) {
17     SkPoint pts[] = {{0, 0}, {0, 250}};
18     SkColor colors[] = {0xFFFF0000, 0xFF0000FF};
19     auto sh = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkTileMode::kClamp);
20     SkPaint p;
21     p.setShader(sh);
22 
23     SkFont f = ToolUtils::DefaultPortableFont();
24     f.setSize(325);
25     f.setEdging(SkFont::Edging::kAntiAlias);
26 
27     canvas->drawString("Gradient", 10, 250, f, p);
28 }
29