4431e7757c
Mike K: please sanity check Test.cpp and skia_test.cpp Feel free to look at the rest, but I don't expect any in depth review of path ops innards. Path Ops first iteration used QuickSort to order segments radiating from an intersection to compute the winding rule. This revision uses a circular sort instead. Breaking out the circular sort into its own long-lived structure (SkOpAngle) allows doing less work and provides a home for caching additional sorting data. The circle sort is more stable than the former sort, has a robust ordering and fewer exceptions. It finds unsortable ordering less often. It is less reliant on the initial curve tangent, using convex hulls instead whenever it can. Additional debug validation makes sure that the computed structures are self-consistent. A new visualization tool helps verify that the angle ordering is correct. The 70+M tests pass with this change on Windows, Mac, Linux 32 and Linux 64 in debug and release. R=mtklein@google.com, reed@google.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/131103009 git-svn-id: http://skia.googlecode.com/svn/trunk@14183 2bbb7eff-a529-9590-31e7-b0007b416f81
32 lines
1.3 KiB
C++
32 lines
1.3 KiB
C++
/*
|
|
* Copyright 2013 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
#include "PathOpsExtendedTest.h"
|
|
|
|
DEF_TEST(PathOpsInverse, reporter) {
|
|
SkPath one, two;
|
|
for (int op = kDifference_PathOp; op <= kReverseDifference_PathOp; ++op) {
|
|
for (int oneFill = SkPath::kWinding_FillType; oneFill <= SkPath::kInverseEvenOdd_FillType;
|
|
++oneFill) {
|
|
for (int oneDir = SkPath::kCW_Direction; oneDir != SkPath::kCCW_Direction; ++oneDir) {
|
|
one.reset();
|
|
one.setFillType((SkPath::FillType) oneFill);
|
|
one.addRect(0, 0, 6, 6, (SkPath::Direction) oneDir);
|
|
for (int twoFill = SkPath::kWinding_FillType;
|
|
twoFill <= SkPath::kInverseEvenOdd_FillType; ++twoFill) {
|
|
for (int twoDir = SkPath::kCW_Direction; twoDir != SkPath::kCCW_Direction;
|
|
++twoDir) {
|
|
two.reset();
|
|
two.setFillType((SkPath::FillType) twoFill);
|
|
two.addRect(3, 3, 9, 9, (SkPath::Direction) twoDir);
|
|
testPathOp(reporter, one, two, (SkPathOp) op, "inverseTest");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|