blob: d60857f76ad2fc849f1477b8c17491f9d8ed9be6 [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=319f6b124458dcc0f9ce4d7bbde65810
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Path_ConvertToNonInverseFillType, 256, 256, true, 0) {
Mike Reed7d34dc72019-11-26 12:17:17 -05006#define nameValue(fill) { SkPathFillType::fill, #fill }
Hal Canary87515122019-03-15 14:22:51 -04007
8void draw(SkCanvas* canvas) {
9 struct {
Mike Reed7d34dc72019-11-26 12:17:17 -050010 SkPathFillType fill;
Hal Canary87515122019-03-15 14:22:51 -040011 const char* name;
12 } fills[] = {
Mike Reed7d34dc72019-11-26 12:17:17 -050013 nameValue(kWinding),
14 nameValue(kEvenOdd),
15 nameValue(kInverseWinding),
16 nameValue(kInverseEvenOdd),
Hal Canary87515122019-03-15 14:22:51 -040017 };
18 for (unsigned i = 0; i < SK_ARRAY_COUNT(fills); ++i) {
Mike Reed7d34dc72019-11-26 12:17:17 -050019 if (fills[i].fill != (SkPathFillType) i) {
Hal Canary87515122019-03-15 14:22:51 -040020 SkDebugf("fills array order does not match FillType enum order");
21 break;
22 }
23 SkDebugf("ConvertToNonInverseFillType(%s) == %s\n", fills[i].name,
Mike Reed7d34dc72019-11-26 12:17:17 -050024 fills[(int) SkPathFillType_ConvertToNonInverse(fills[i].fill)].name);
Hal Canary87515122019-03-15 14:22:51 -040025 }
26}
27} // END FIDDLE