| 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 |
#include "src/base/SkFloatBits.h" |
| 13 |
|
| 14 |
// This quad would, depending on which aa flags are used, would degenerate when inset. We'd replace |
| 15 |
// and duplicate some of the inset points to make a triangle. However, one of the triangle points |
| 16 |
// would be far outside the original quad. |
| 17 |
DEF_SIMPLE_GM(crbug_1167277, canvas, 230, 320) { |
| 18 |
canvas->translate(-1250, -900); |
| 19 |
// Matrix, clip, and quad values taken from Chrome repro scenario. |
| 20 |
SkMatrix ctm = SkMatrix::MakeAll( |
| 21 |
SkBits2Float(0xbf8fcfae), SkBits2Float(0xbeae25ee), SkBits2Float(0x449ca6db), |
| 22 |
SkBits2Float(0x3c9dc40f), SkBits2Float(0xbf950e35), SkBits2Float(0x4487da43), |
| 23 |
SkBits2Float(0xb8d4d6bc), SkBits2Float(0xb92fbb29), SkBits2Float(0x3f6f605c)); |
| 24 |
SkRect rect = {SkBits2Float(0x00000000), SkBits2Float(0x00000000), |
| 25 |
SkBits2Float(0x41880000), SkBits2Float(0x43440000)}; |
| 26 |
SkPoint clip[4] = {{SkBits2Float(0x3ef434a2), SkBits2Float(0x43440004)}, |
| 27 |
{SkBits2Float(0x00000000), SkBits2Float(0x43440009)}, |
| 28 |
{SkBits2Float(0x38ef605d), SkBits2Float(0x38ef605d)}, |
| 29 |
{SkBits2Float(0x3ef436e3), SkBits2Float(0x396f5d30)}}; |
| 30 |
SkColor color = SK_ColorGREEN; |
| 31 |
for (int flags = 0; flags < static_cast<int>(SkCanvas::kAll_QuadAAFlags); ++flags) { |
| 32 |
SkCanvas::QuadAAFlags aaFlags = static_cast<SkCanvas::QuadAAFlags>(flags); |
| 33 |
canvas->save(); |
| 34 |
canvas->concat(ctm); |
| 35 |
canvas->experimental_DrawEdgeAAQuad(rect, clip, aaFlags, color, SkBlendMode::kSrcOver); |
| 36 |
canvas->restore(); |
| 37 |
canvas->translate(5, 0); |
| 38 |
SkColor rgb = color & 0x00FFFFFF; |
| 39 |
color = 0xFF000000 | (rgb << 4) | (rgb >> 20); |
| 40 |
} |
| 41 |
} |
| 42 |
|