blob: 3b049f733427ef4058e95d837cce1443d0276043 [file] [log] [blame]
Mike Klein0aa05082018-12-12 12:37:56 -05001/*
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 Reed1af9b482019-01-07 11:01:57 -05009#include "SkFont.h"
Mike Klein0aa05082018-12-12 12:37:56 -050010#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
15static const int K = 50;
16
17DEF_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 Reed1af9b482019-01-07 11:01:57 -050023 K*1.5f, K/2, SkFont(), paint);
Mike Klein0aa05082018-12-12 12:37:56 -050024
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}