Flutter Engine
The Flutter Engine
crbug_1139750.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
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"
12
13DEF_SIMPLE_GM_BG(crbug_1139750, canvas, 50, 50, SK_ColorWHITE) {
14 // Draw a round-rect with a (slightly) non-square scale. This forces the GPU backend to use
15 // the elliptical round-rect op. We set the stroke width to exactly double the radii, which
16 // makes the inner radii exactly zero. The shader uses the inverse inner radii to compute the
17 // coverage ramp, so this would end up producing infinity, and the geometry would disappear.
18 SkPaint p;
19 p.setAntiAlias(true);
20 p.setStyle(SkPaint::kStroke_Style);
21 p.setStrokeWidth(2);
22
23 SkRect r = SkRect::MakeXYWH(1, 1, 19, 19);
24 SkRRect rr = SkRRect::MakeRectXY(r, 1, 1);
25
26 canvas->translate(10, 10);
27 canvas->scale(1.47619f, 1.52381f);
28 canvas->drawRRect(rr, p);
29}
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition: SkRRect.h:180
DEF_SIMPLE_GM_BG(crbug_1139750, canvas, 50, 50, SK_ColorWHITE)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659