Flutter Engine
The Flutter Engine
crbug_1174186.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 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"
11#include "include/core/SkRect.h"
13
14// Outsetting of very thin, nearly line, quads for AA would go haywire and draw far outside of the
15// quad. Artifacts seemed to occur more when coord values are large, hence the large GM size. At the
16// time of GM creation this was fixed by dropping AA, which makes these quads practically never draw
17// as it's very unlikely a pixel center would fall inside the geometry.
18DEF_SIMPLE_GM(crbug_1174186, canvas, 1200, 1200) {
19 auto m = SkMatrix::MakeAll(
20 SkBits2Float(0x24480629), SkBits2Float(0xbf3555c2), SkBits2Float(0x4377d67b),
21 SkBits2Float(0x23a61d51), SkBits2Float(0x3f34b400), SkBits2Float(0x4453f572),
22 SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x3f800000));
23
24 SkPoint pts[] = {{SkBits2Float(0x3f7ffff2), SkBits2Float(0x43483d60)},
25 {SkBits2Float(0x00000000), SkBits2Float(0x43483d60)},
26 {SkBits2Float(0x00000000), SkBits2Float(0x4311a628)},
27 {SkBits2Float(0x3f800000), SkBits2Float(0x43130f8c)}};
29 canvas->translate(-500, 0);
30 for (int i = 0; i < 10; ++i) {
31 for (int flags = 0; flags < static_cast<int>(SkCanvas::kAll_QuadAAFlags); ++flags) {
33 canvas->save();
34 canvas->concat(m);
35 canvas->experimental_DrawEdgeAAQuad(SkRect::MakeWH(1000, 1000), pts, aaFlags, color,
37 canvas->restore();
38 canvas->translate(5.1f, 0);
39 SkColor rgb = color & 0x00FFFFFF;
40 color = 0xFF000000 | (rgb << 4) | (rgb >> 20);
41 }
42 }
43}
@ kSrcOver
r = s + (1-sa)*d
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
static float SkBits2Float(uint32_t bits)
Definition: SkFloatBits.h:48
@ kAll_QuadAAFlags
Definition: SkCanvas.h:1665
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Definition: SkMatrix.h:179
DEF_SIMPLE_GM(crbug_1174186, canvas, 1200, 1200)
DlColor color
FlutterSemanticsFlag flags
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609