Debian Codegraph @

gm/crbug_1073670.cpp

raw
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/SkGradient.h"
14 #include "tools/fonts/FontToolUtils.h"
15
16 DEF_SIMPLE_GM(crbug_1073670, canvas, 250, 250) {
17 const SkPoint pts[] = {{0, 0}, {0, 250}};
18 const SkColor4f colors[] = {{1,0,0,1}, {0,0,1,1}};
19 auto sh = SkShaders::LinearGradient(pts, {{colors, {}, 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 }