shape ops work in progress

add copyrights everywhere
start working on quadratic line segments (for quad intersection)

git-svn-id: http://skia.googlecode.com/svn/trunk@5286 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
caryclark@google.com 2012-08-27 14:11:33 +00:00
parent 98a9e1f958
commit 9e49fb63d3
76 changed files with 454 additions and 5 deletions

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Simplify.h"
namespace UnitTest {

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// http://metamerist.com/cbrt/CubeRoot.cpp
//

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "LineParameters.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CubicIntersection_TestData.h"
#include "Intersection_Tests.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "Extrema.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersections.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "CubicIntersection_TestData.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#define IN_TEST 1
#include "CubicIntersection_TestData.h"
#include <limits>

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#if !defined(IN_TEST)
#define IN_TEST 1
#endif

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CubicUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <vector>
/* Given:

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "Parameterization_Test.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Extrema.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CubicIntersection_TestData.h"
#include "Intersection_Tests.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CubicUtilities.h"
#include "DataTypes.h"
#include "QuadraticUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
double cube_root(double x);

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef CurveIntersection_DEFINE
#define CurveIntersection_DEFINE

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
#include <sys/types.h>

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __DataTypes_h__
#define __DataTypes_h__

View File

@ -12,13 +12,13 @@ public:
SkSampleView() {
this->setVisibleP(true);
this->setClipToBounds(false);
useOld = true;
};
protected:
virtual void onDraw(SkCanvas* canvas) {
static int step = 0; // useNew triggers error at 23275
// error is not easy to debug in its current state
static double seconds;
static bool useOld = false;
if (step == -1) {
timeval t;
gettimeofday(&t, NULL);
@ -40,7 +40,14 @@ protected:
inval(NULL);
}
}
virtual Click* onFindClickHandler(SkScalar , SkScalar ) {
useOld ^= true;
return NULL;
}
private:
bool useOld;
typedef SkView INHERITED;
};

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,5 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "ShapeOps.h"
#include "SkBitmap.h"
#include "SkStream.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "EdgeWalker_Test.h"
#include "Intersection_Tests.h"
#include "SkBitmap.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
#include "Extrema.h"

View File

@ -1,2 +1,8 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
int findExtrema(double a, double b, double c, double d, double tValues[2]);
int findExtrema(double a, double b, double c, double tValue[1]);

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#if 0
// snippets that one day may be useful, unused for now...

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// inline utilities
/* Returns 0 if negative, 1 if zero, 2 if positive

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CubicIntersection_TestData.h"
#include "Intersection_Tests.h"
#include "SkTypes.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#if !defined(IN_TEST)
#define IN_TEST 1
#endif

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef Intersections_DEFINE
#define Intersections_DEFINE

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CubicUtilities.h"
#include "Intersections.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "Intersection_Tests.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersections.h"
#include "LineIntersection.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef LineIntersection_DEFINE
#define LineIntersection_DEFINE

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveUtilities.h"
#include "Intersection_Tests.h"
#include "LineIntersection.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
/* This rejects coincidence with two muls, two adds, and one cmp.

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
// Sources

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Intersection_Tests.h"
#include "LineParameters.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersections.h"
#include "LineUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "EdgeWalker_Test.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "LineUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
bool implicitLine(const _Line& line, double& slope, double& axisIntercept);

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
// utilities used only for unit testing

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "LineParameters.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "QuadraticIntersection_TestData.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "Extrema.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersections.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "CurveUtilities.h"
#include "Intersection_Tests.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#if !defined(IN_TEST)
#define IN_TEST 1
#endif

View File

@ -0,0 +1,8 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "QuadraticLineSegments.h"

View File

@ -0,0 +1,7 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "QuadraticUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "Parameterization_Test.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Extrema.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "QuadraticIntersection_TestData.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "IntersectionUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "QuadraticUtilities.h"
#include <math.h>

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
void dxdy_at_t(const Quadratic& , double t, double& x, double& y);

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkPath.h"
void contourBounds(const SkPath& path, SkTDArray<SkRect>& boundsArray);

View File

@ -11,6 +11,12 @@ namespace SimplifyAddIntersectingTsTest {
#include "Simplify.cpp"
} // end of SimplifyAddIntersectingTsTest namespace
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Intersection_Tests.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef TSearch_DEFINED
#define TSearch_DEFINED

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CurveIntersection.h"
#include "TestUtilities.h"

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DataTypes.h"
bool controls_inside(const Cubic& );

View File

@ -1,3 +1,9 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
add unit test for quadratic horizontal intersection
add unit test for cubic horizontal intersection with left/right
add unit test for ActiveEdge::calcLeft (can currently loop forever)

View File

@ -34,6 +34,8 @@
'../experimental/Intersection/QuadraticBezierClip.cpp',
'../experimental/Intersection/QuadraticBounds.cpp',
'../experimental/Intersection/QuadraticIntersection.cpp',
'../experimental/Intersection/QuadraticLineSegments.cpp',
'../experimental/Intersection/QuadraticParameterization.cpp',
'../experimental/Intersection/QuadraticReduceOrder.cpp',
'../experimental/Intersection/QuadraticSubDivide.cpp',
'../experimental/Intersection/QuadraticUtilities.cpp',
@ -51,8 +53,7 @@
'../experimental/Intersection/LineIntersection.h',
'../experimental/Intersection/LineParameters.h',
'../experimental/Intersection/LineUtilities.h',
'../experimental/Intersection/QuadraticParameterization.cpp',
'../experimental/Intersection/QuadraticSubDivide.cpp',
'../experimental/Intersection/QuadraticLineSegments.h',
'../experimental/Intersection/QuadraticUtilities.h',
'../experimental/Intersection/ShapeOps.h',
'../experimental/Intersection/Simplify.h',

View File

@ -59,6 +59,7 @@
'../experimental/Intersection/QuadraticIntersection.cpp',
'../experimental/Intersection/QuadraticIntersection_Test.cpp',
'../experimental/Intersection/QuadraticIntersection_TestData.cpp',
'../experimental/Intersection/QuadraticLineSegments.cpp',
'../experimental/Intersection/QuadraticParameterization.cpp',
'../experimental/Intersection/QuadraticParameterization_Test.cpp',
'../experimental/Intersection/QuadraticReduceOrder.cpp',
@ -88,6 +89,7 @@
'../experimental/Intersection/LineUtilities.h',
'../experimental/Intersection/Parameterization_Test.h',
'../experimental/Intersection/QuadraticIntersection_TestData.h',
'../experimental/Intersection/QuadraticLineSegments.h',
'../experimental/Intersection/QuadraticUtilities.h',
'../experimental/Intersection/ShapeOps.h',
'../experimental/Intersection/Simplify.h',