Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / gm / crbug_1174186.cpp
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"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkMatrix.h"
11 #include "include/core/SkRect.h"
12
13 // Outsetting of very thin, nearly line, quads for AA would go haywire and draw far outside of the
14 // quad. Artifacts seemed to occur more when coord values are large, hence the large GM size. At the
15 // time of GM creation this was fixed by dropping AA, which makes these quads practically never draw
16 // as it's very unlikely a pixel center would fall inside the geometry.
17 DEF_SIMPLE_GM(crbug_1174186, canvas, 1200, 1200) {
18     auto m = SkMatrix::MakeAll(
19             SkBits2Float(0x24480629), SkBits2Float(0xbf3555c2), SkBits2Float(0x4377d67b),
20             SkBits2Float(0x23a61d51), SkBits2Float(0x3f34b400), SkBits2Float(0x4453f572),
21             SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x3f800000));
22
23     SkPoint pts[] = {{SkBits2Float(0x3f7ffff2), SkBits2Float(0x43483d60)},
24                      {SkBits2Float(0x00000000), SkBits2Float(0x43483d60)},
25                      {SkBits2Float(0x00000000), SkBits2Float(0x4311a628)},
26                      {SkBits2Float(0x3f800000), SkBits2Float(0x43130f8c)}};
27     SkColor color = SK_ColorGREEN;
28     canvas->translate(-500, 0);
29     for (int i = 0; i < 10; ++i) {
30         for (int flags = 0; flags < static_cast<int>(SkCanvas::kAll_QuadAAFlags); ++flags) {
31             SkCanvas::QuadAAFlags aaFlags = static_cast<SkCanvas::QuadAAFlags>(flags);
32             canvas->save();
33             canvas->concat(m);
34             canvas->experimental_DrawEdgeAAQuad(SkRect::MakeWH(1000, 1000), pts, aaFlags, color,
35                                                 SkBlendMode::kSrcOver);
36             canvas->restore();
37             canvas->translate(5.1f, 0);
38             SkColor rgb = color & 0x00FFFFFF;
39             color = 0xFF000000 | (rgb << 4) | (rgb >> 20);
40         }
41     }
42 }