Mike Klein | 0aa0508 | 2018-12-12 12:37:56 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 Google Inc. |
| 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.h" |
Mike Reed | 1af9b48 | 2019-01-07 11:01:57 -0500 | [diff] [blame] | 9 | #include "SkFont.h" |
Mike Klein | 0aa0508 | 2018-12-12 12:37:56 -0500 | [diff] [blame] | 10 | #include "SkPath.h" |
| 11 | |
| 12 | // This GM shows off a flaw in delta-based rasterizers (DAA, CCPR, etc.). |
| 13 | // See also the bottom of dashing4 and skia:6886. |
| 14 | |
| 15 | static const int K = 50; |
| 16 | |
| 17 | DEF_SIMPLE_GM(daa, canvas, K+350, K) { |
| 18 | SkPaint paint; |
| 19 | paint.setAntiAlias(true); |
| 20 | |
| 21 | paint.setColor(SK_ColorBLACK); |
| 22 | canvas->drawString("Should be a green square with no red showing through.", |
Mike Reed | 1af9b48 | 2019-01-07 11:01:57 -0500 | [diff] [blame] | 23 | K*1.5f, K/2, SkFont(), paint); |
Mike Klein | 0aa0508 | 2018-12-12 12:37:56 -0500 | [diff] [blame] | 24 | |
| 25 | paint.setColor(SK_ColorRED); |
| 26 | canvas->drawRect({0,0,K,K}, paint); |
| 27 | |
| 28 | SkPath path; |
| 29 | SkPoint tri1[] = {{0,0},{K,K},{0,K},{0,0}}; |
| 30 | SkPoint tri2[] = {{0,0},{K,K},{K,0},{0,0}}; |
| 31 | path.addPoly(tri1, SK_ARRAY_COUNT(tri1), false); |
| 32 | path.addPoly(tri2, SK_ARRAY_COUNT(tri2), false); |
| 33 | |
| 34 | paint.setColor(SK_ColorGREEN); |
| 35 | canvas->drawPath(path, paint); |
| 36 | } |