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" 9 #include "SkFont.h" 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.", 23 K*1.5f, K/2, SkFont(), paint); 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 } 37