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