add more test cases to DAA gm
These explicitly hit the double up edge screw case we use all the time, with a couple variations in number of draws and in the winding. Bug: skia:6886 Change-Id: I0a22d9a48254fe80c874dcfc46e2af6eb1c21f17 Reviewed-on: https://skia-review.googlesource.com/c/190667 Commit-Queue: Mike Klein <mtklein@google.com> Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com> Auto-Submit: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
d6841487eb
commit
1edcea99ab
122
gm/daa.cpp
122
gm/daa.cpp
@ -12,25 +12,119 @@
|
||||
// This GM shows off a flaw in delta-based rasterizers (DAA, CCPR, etc.).
|
||||
// See also the bottom of dashing4 and skia:6886.
|
||||
|
||||
static const int K = 50;
|
||||
static const int K = 49;
|
||||
|
||||
DEF_SIMPLE_GM(daa, canvas, K+350, K) {
|
||||
DEF_SIMPLE_GM(daa, canvas, K+350, 5*K) {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Should be a green square with no red showing through.",
|
||||
K*1.5f, K/2, SkFont(), paint);
|
||||
{
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Should be a green square with no red showing through.",
|
||||
K*1.5f, K*0.5f, SkFont(), paint);
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
canvas->drawRect({0,0,K,K}, paint);
|
||||
paint.setColor(SK_ColorRED);
|
||||
canvas->drawRect({0,0,K,K}, paint);
|
||||
|
||||
SkPath path;
|
||||
SkPoint tri1[] = {{0,0},{K,K},{0,K},{0,0}};
|
||||
SkPoint tri2[] = {{0,0},{K,K},{K,0},{0,0}};
|
||||
path.addPoly(tri1, SK_ARRAY_COUNT(tri1), false);
|
||||
path.addPoly(tri2, SK_ARRAY_COUNT(tri2), false);
|
||||
SkPath path;
|
||||
SkPoint tri1[] = {{0,0},{K,K},{0,K},{0,0}};
|
||||
SkPoint tri2[] = {{0,0},{K,K},{K,0},{0,0}};
|
||||
path.addPoly(tri1, SK_ARRAY_COUNT(tri1), false);
|
||||
path.addPoly(tri2, SK_ARRAY_COUNT(tri2), false);
|
||||
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
canvas->drawPath(path, paint);
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
|
||||
canvas->translate(0,K);
|
||||
{
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Adjacent rects, two draws. Blue then green, no red?",
|
||||
K*1.5f, K*0.5f, SkFont(), paint);
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
canvas->drawRect({0,0,K,K}, paint);
|
||||
|
||||
{
|
||||
SkPath path;
|
||||
SkPoint rect1[] = {{0,0},{0,K},{K*0.5f,K},{K*0.5f,0}};
|
||||
path.addPoly(rect1, SK_ARRAY_COUNT(rect1), false);
|
||||
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
|
||||
{
|
||||
SkPath path;
|
||||
SkPoint rect2[] = {{K*0.5f,0},{K*0.5f,K},{K,K},{K,0}};
|
||||
path.addPoly(rect2, SK_ARRAY_COUNT(rect2), false);
|
||||
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
}
|
||||
|
||||
canvas->translate(0,K);
|
||||
{
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Adjacent rects, wound together. All green?",
|
||||
K*1.5f, K*0.5f, SkFont(), paint);
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
canvas->drawRect({0,0,K,K}, paint);
|
||||
|
||||
{
|
||||
SkPath path;
|
||||
SkPoint rect1[] = {{0,0},{0,K},{K*0.5f,K},{K*0.5f,0}};
|
||||
SkPoint rect2[] = {{K*0.5f,0},{K*0.5f,K},{K,K},{K,0}};
|
||||
|
||||
path.addPoly(rect1, SK_ARRAY_COUNT(rect1), false);
|
||||
path.addPoly(rect2, SK_ARRAY_COUNT(rect2), false);
|
||||
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
}
|
||||
|
||||
canvas->translate(0,K);
|
||||
{
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Adjacent rects, wound opposite. All green?",
|
||||
K*1.5f, K*0.5f, SkFont(), paint);
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
canvas->drawRect({0,0,K,K}, paint);
|
||||
|
||||
{
|
||||
SkPath path;
|
||||
SkPoint rect1[] = {{0,0},{0,K},{K*0.5f,K},{K*0.5f,0}};
|
||||
SkPoint rect2[] = {{K*0.5f,0},{K,0},{K,K},{K*0.5f,K}};
|
||||
|
||||
path.addPoly(rect1, SK_ARRAY_COUNT(rect1), false);
|
||||
path.addPoly(rect2, SK_ARRAY_COUNT(rect2), false);
|
||||
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
}
|
||||
|
||||
canvas->translate(0,K);
|
||||
{
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("One poly, wound opposite. All green?",
|
||||
K*1.5f, K*0.5f, SkFont(), paint);
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
canvas->drawRect({0,0,K,K}, paint);
|
||||
|
||||
{
|
||||
SkPath path;
|
||||
SkPoint poly[] = {{K*0.5f,0},{0,0},{0,K},{K*0.5f,K},{K*0.5f,0},{K,0},{K,K},{K*0.5f,K}};
|
||||
|
||||
path.addPoly(poly, SK_ARRAY_COUNT(poly), false);
|
||||
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user