chromium/third_party/skia/src/pathops/SkPathOpsTSect.cpp

/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "src/pathops/SkPathOpsTSect.h"

#include "include/private/base/SkMacros.h"
#include "include/private/base/SkTArray.h"
#include "src/base/SkTSort.h"
#include "src/pathops/SkIntersections.h"
#include "src/pathops/SkPathOpsConic.h"
#include "src/pathops/SkPathOpsCubic.h"
#include "src/pathops/SkPathOpsLine.h"
#include "src/pathops/SkPathOpsQuad.h"

#include <cfloat>
#include <algorithm>
#include <array>
#include <cmath>

usingnamespaceskia_private;

#define COINCIDENT_SPAN_COUNT

void SkTCoincident::setPerp(const SkTCurve& c1, double t,
        const SkDPoint& cPt, const SkTCurve& c2) {}

void SkTSpan::addBounded(SkTSpan* span, SkArenaAlloc* heap) {}

SkTSpan* SkTSect::addFollowing(
        SkTSpan* prior) {}

void SkTSect::addForPerp(SkTSpan* span, double t) {}

double SkTSpan::closestBoundedT(const SkDPoint& pt) const {}

#ifdef SK_DEBUG

bool SkTSpan::debugIsBefore(const SkTSpan* span) const {}
#endif

bool SkTSpan::contains(double t) const {}

const SkTSect* SkTSpan::debugOpp() const {}

SkTSpan* SkTSpan::findOppSpan(
        const SkTSpan* opp) const {}

// returns 0 if no hull intersection
//         1 if hulls intersect
//         2 if hulls only share a common endpoint
//        -1 if linear and further checking is required

int SkTSpan::hullCheck(const SkTSpan* opp,
        bool* start, bool* oppStart) {}

// OPTIMIZE ? If at_most_end_pts_in_common detects that one quad is near linear,
// use line intersection to guess a better split than 0.5
// OPTIMIZE Once at_most_end_pts_in_common detects linear, mark span so all future splits are linear

int SkTSpan::hullsIntersect(SkTSpan* opp,
        bool* start, bool* oppStart) {}

void SkTSpan::init(const SkTCurve& c) {}

bool SkTSpan::initBounds(const SkTCurve& c) {}

bool SkTSpan::linearsIntersect(SkTSpan* span) {}

double SkTSpan::linearT(const SkDPoint& pt) const {}

int SkTSpan::linearIntersects(const SkTCurve& q2) const {}

bool SkTSpan::onlyEndPointsInCommon(const SkTSpan* opp,
        bool* start, bool* oppStart, bool* ptsInCommon) {}

SkTSpan* SkTSpan::oppT(double t) const {}

bool SkTSpan::removeAllBounded() {}

bool SkTSpan::removeBounded(const SkTSpan* opp) {}

bool SkTSpan::splitAt(SkTSpan* work, double t, SkArenaAlloc* heap) {}

void SkTSpan::validate() const {}

void SkTSpan::validateBounded() const {}

void SkTSpan::validatePerpT(double oppT) const {}

void SkTSpan::validatePerpPt(double t, const SkDPoint& pt) const {}

SkTSect::SkTSect(const SkTCurve& c
        SkDEBUGPARAMS(SkOpGlobalState* debugGlobalState)
        PATH_OPS_DEBUG_T_SECT_PARAMS(int id))
    :{}

SkTSpan* SkTSect::addOne() {}

bool SkTSect::binarySearchCoin(SkTSect* sect2, double tStart,
        double tStep, double* resultT, double* oppT, SkTSpan** oppFirst) {}

// OPTIMIZE ? keep a sorted list of sizes in the form of a doubly-linked list in quad span
//            so that each quad sect has a pointer to the largest, and can update it as spans
//            are split

SkTSpan* SkTSect::boundsMax() {}

bool SkTSect::coincidentCheck(SkTSect* sect2) {}

void SkTSect::coincidentForce(SkTSect* sect2,
        double start1s, double start1e) {}

bool SkTSect::coincidentHasT(double t) {}

int SkTSect::collapsed() const {}

void SkTSect::computePerpendiculars(SkTSect* sect2,
        SkTSpan* first, SkTSpan* last) {}

int SkTSect::countConsecutiveSpans(SkTSpan* first,
        SkTSpan** lastPtr) const {}

bool SkTSect::hasBounded(const SkTSpan* span) const {}

bool SkTSect::deleteEmptySpans() {}

bool SkTSect::extractCoincident(
        SkTSect* sect2,
        SkTSpan* first, SkTSpan* last,
        SkTSpan** result) {}

SkTSpan* SkTSect::findCoincidentRun(
        SkTSpan* first, SkTSpan** lastPtr) {}

int SkTSect::intersects(SkTSpan* span,
        SkTSect* opp,
        SkTSpan* oppSpan, int* oppResult) {}

template<typename SkTCurve>
static bool is_parallel(const SkDLine& thisLine, const SkTCurve& opp) {}

// while the intersection points are sufficiently far apart:
// construct the tangent lines from the intersections
// find the point where the tangent line intersects the opposite curve

int SkTSect::linesIntersect(SkTSpan* span,
        SkTSect* opp,
        SkTSpan* oppSpan, SkIntersections* i) {}

bool SkTSect::markSpanGone(SkTSpan* span) {}

bool SkTSect::matchedDirection(double t, const SkTSect* sect2,
        double t2) const {}

void SkTSect::matchedDirCheck(double t, const SkTSect* sect2,
        double t2, bool* calcMatched, bool* oppMatched) const {}

void SkTSect::mergeCoincidence(SkTSect* sect2) {}

SkTSpan* SkTSect::prev(
        SkTSpan* span) const {}

void SkTSect::recoverCollapsed() {}

void SkTSect::removeAllBut(const SkTSpan* keep,
        SkTSpan* span, SkTSect* opp) {}

bool SkTSect::removeByPerpendicular(SkTSect* opp) {}

bool SkTSect::removeCoincident(SkTSpan* span, bool isBetween) {}

void SkTSect::removedEndCheck(SkTSpan* span) {}

bool SkTSect::removeSpan(SkTSpan* span) {}

void SkTSect::removeSpanRange(SkTSpan* first,
        SkTSpan* last) {}

bool SkTSect::removeSpans(SkTSpan* span,
        SkTSect* opp) {}

SkTSpan* SkTSect::spanAtT(double t,
        SkTSpan** priorSpan) {}

SkTSpan* SkTSect::tail() {}

/* Each span has a range of opposite spans it intersects. After the span is split in two,
    adjust the range to its new size */

bool SkTSect::trim(SkTSpan* span,
        SkTSect* opp) {}

bool SkTSect::unlinkSpan(SkTSpan* span) {}

bool SkTSect::updateBounded(SkTSpan* first,
        SkTSpan* last, SkTSpan* oppFirst) {}

void SkTSect::validate() const {}

void SkTSect::validateBounded() const {}

int SkTSect::EndsEqual(const SkTSect* sect1,
        const SkTSect* sect2, SkIntersections* intersections) {}

struct SkClosestRecord {};

struct SkClosestSect {};

// returns true if the rect is too small to consider

void SkTSect::BinarySearch(SkTSect* sect1,
        SkTSect* sect2, SkIntersections* intersections) {}

int SkIntersections::intersect(const SkDQuad& q1, const SkDQuad& q2) {}

int SkIntersections::intersect(const SkDConic& c, const SkDQuad& q) {}

int SkIntersections::intersect(const SkDConic& c1, const SkDConic& c2) {}

int SkIntersections::intersect(const SkDCubic& c, const SkDQuad& q) {}

int SkIntersections::intersect(const SkDCubic& cu, const SkDConic& co) {}

int SkIntersections::intersect(const SkDCubic& c1, const SkDCubic& c2) {}