639df89148
A experimental/Intersection A experimental/Intersection/Intersections.h A experimental/Intersection/DataTypes.cpp A experimental/Intersection/QuadraticReduceOrder.cpp A experimental/Intersection/IntersectionUtilities.cpp A experimental/Intersection/CubicIntersection_Tests.h A experimental/Intersection/LineParameteters_Test.cpp A experimental/Intersection/ReduceOrder.cpp A experimental/Intersection/QuadraticIntersection.cpp A experimental/Intersection/Extrema.h A experimental/Intersection/CubicIntersection_TestData.h A experimental/Intersection/QuadraticParameterization_Test.cpp A experimental/Intersection/TestUtilities.cpp A experimental/Intersection/CubicRoots.cpp A experimental/Intersection/QuadraticParameterization.cpp A experimental/Intersection/QuadraticSubDivide.cpp A experimental/Intersection/LineIntersection_Test.cpp A experimental/Intersection/LineIntersection.cpp A experimental/Intersection/CubicParameterizationCode.cpp A experimental/Intersection/LineParameters.h A experimental/Intersection/CubicIntersection.h A experimental/Intersection/CubeRoot.cpp A experimental/Intersection/SkAntiEdge.h A experimental/Intersection/ConvexHull_Test.cpp A experimental/Intersection/CubicBezierClip_Test.cpp A experimental/Intersection/CubicIntersection_Tests.cpp A experimental/Intersection/CubicBezierClip.cpp A experimental/Intersection/CubicIntersectionT.cpp A experimental/Intersection/Inline_Tests.cpp A experimental/Intersection/ReduceOrder_Test.cpp A experimental/Intersection/QuadraticIntersection_TestData.h A experimental/Intersection/DataTypes.h A experimental/Intersection/Extrema.cpp A experimental/Intersection/EdgeApp.cpp A experimental/Intersection/CubicIntersection_TestData.cpp A experimental/Intersection/IntersectionUtilities.h A experimental/Intersection/CubicReduceOrder.cpp A experimental/Intersection/CubicCoincidence.cpp A experimental/Intersection/CubicIntersection_Test.cpp A experimental/Intersection/CubicIntersection.cpp A experimental/Intersection/QuadraticUtilities.h A experimental/Intersection/SkAntiEdge.cpp A experimental/Intersection/TestUtilities.h A experimental/Intersection/CubicParameterization_Test.cpp A experimental/Intersection/LineIntersection.h A experimental/Intersection/CubicSubDivide.cpp A experimental/Intersection/CubicParameterization.cpp A experimental/Intersection/QuadraticBezierClip_Test.cpp A experimental/Intersection/QuadraticBezierClip.cpp A experimental/Intersection/BezierClip_Test.cpp A experimental/Intersection/ConvexHull.cpp A experimental/Intersection/BezierClip.cpp A experimental/Intersection/QuadraticIntersection_TestData.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@3005 2bbb7eff-a529-9590-31e7-b0007b416f81
80 lines
2.4 KiB
C++
80 lines
2.4 KiB
C++
/*
|
|
* SkAntiEdge.h
|
|
* core
|
|
*
|
|
* Created by Cary Clark on 5/6/11.
|
|
* Copyright 2011 __MyCompanyName__. All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef SkAntiEdge_DEFINED
|
|
#define SkAntiEdge_DEFINED
|
|
|
|
#include "SkFixed.h"
|
|
#include "SkTDArray.h"
|
|
|
|
struct SkBitmap;
|
|
struct SkPoint;
|
|
|
|
struct SkAntiEdge {
|
|
SkAntiEdge* fNext; // list in walking order (y, then x, then diag)
|
|
SkAntiEdge* fPrev; // reverse in walking order
|
|
SkAntiEdge* fLink; // list in connected order, top to bottom
|
|
|
|
SkFixed fFirstX; // starting X
|
|
SkFixed fFirstY; // starting Y
|
|
SkFixed fLastX; // ending X
|
|
SkFixed fLastY; // ending Y
|
|
SkFixed fX0; // computed edge current value (may be off end)
|
|
SkFixed fY0;
|
|
SkFixed fX; // edge current value (always on edge)
|
|
SkFixed fY;
|
|
SkFixed fDX; // change in X per unit step in Y
|
|
SkFixed fDY; // change in Y per unit step in X
|
|
SkFixed fWalkX; // unit step position (integer after initial step)
|
|
SkFixed fWalkY;
|
|
uint16_t fPartialY; // initial partial coverage in Y (0 .. SkFixed1]
|
|
int16_t fWindingSum; // winding including contributions to the left
|
|
int8_t fWinding; // 1 or -1 (could be 2 bits)
|
|
bool fFinished : 1;
|
|
unsigned fDXFlipped : 1; // used as bool and to adjust calculations (0/1)
|
|
bool fLinkSet : 1; // set if edge has been attached to another edge
|
|
|
|
void calcLine();
|
|
bool setLine(const SkPoint& p0, const SkPoint& p1);
|
|
uint16_t advanceX(SkFixed left);
|
|
uint16_t advanceFlippedX(SkFixed left);
|
|
void advanceY(SkFixed top);
|
|
// FIXME: mark DEBUG
|
|
void pointInLine(SkFixed x, SkFixed y);
|
|
void pointOnLine(SkFixed x, SkFixed y);
|
|
void validate();
|
|
};
|
|
|
|
class SkAntiEdgeBuilder {
|
|
public:
|
|
void process(const SkPoint* points, int ptCount,
|
|
uint8_t* result, int pixelCol, int pixelRow);
|
|
private:
|
|
int build(const SkPoint pts[], int count);
|
|
void calc();
|
|
void link();
|
|
void sort();
|
|
void sort(SkTDArray<SkAntiEdge*>&);
|
|
void split();
|
|
void split(SkAntiEdge* edge, SkFixed y);
|
|
void walk(uint8_t* result, int rowBytes, int height);
|
|
SkAntiEdge fHeadEdge;
|
|
SkAntiEdge fTailEdge;
|
|
SkTDArray<SkAntiEdge> fEdges;
|
|
SkTDArray<SkAntiEdge*> fList;
|
|
};
|
|
|
|
void SkAntiEdge_Test();
|
|
void CreateSweep(SkBitmap* , float width);
|
|
void CreateHorz(SkBitmap* );
|
|
void CreateVert(SkBitmap* );
|
|
void CreateAngle(SkBitmap* sweep, float angle);
|
|
|
|
#endif
|