cubic2, tMin, tMax, 1, i);
}
-// this flavor centers potential intersections recursively. In contrast, '2' may inadvertently
+// this flavor centers potential intersections recursively. In contrast, '2' may inadvertently
// chase intersections near quadratic ends, requiring odd hacks to find them.
static bool intersect3(const Cubic& cubic1, double t1s, double t1e, const Cubic& cubic2,
double t2s, double t2e, double precisionScale, Intersections& i) {
{{0,1}, {1,2}, {1,0}, {6,1}},
{{0,1}, {1,6}, {1,0}, {2,1}},
-{{0,1}, {0,5}, {1,0}, {4,0}},
+{{0,1}, {0,5}, {1,0}, {4,0}},
{{0,1}, {0,4}, {1,0}, {5,0}},
{{0,1}, {3,4}, {1,0}, {3,0}},
#include "SkPoint.h"
-#define ONE_OFF_DEBUG 0
+#define ONE_OFF_DEBUG 0
// FIXME: move these into SkTypes.h
template <typename T> inline T SkTMax(T a, T b) {
double inv = 1 / denom;
return approximately_equal(x * inv, a.x * inv) && approximately_equal(y * inv, a.y * inv);
}
-
+
bool approximatelyEqualHalf(const _Point& a) const {
double denom = SkTMax(fabs(x), SkTMax(fabs(y), SkTMax(fabs(a.x), fabs(a.y))));
if (denom == 0) {
bool approximatelyZero() const {
return approximately_zero(x) && approximately_zero(y);
}
-
+
SkPoint asSkPoint() const {
SkPoint pt = {SkDoubleToScalar(x), SkDoubleToScalar(y)};
return pt;
}
static void showShapeOpPath(const SkPath& one, const SkPath& two, const SkPath& a, const SkPath& b,
- const SkPath& scaledOne, const SkPath& scaledTwo, const ShapeOp shapeOp,
+ const SkPath& scaledOne, const SkPath& scaledTwo, const ShapeOp shapeOp,
const SkMatrix& scale) {
SkASSERT((unsigned) shapeOp < sizeof(opStrs) / sizeof(opStrs[0]));
showPath(a, "minuend:");
SkASSERT(iEnd2 < fUsed);
double cs2 = fT[fSwap ^ 1][i2];
double ce2 = fT[fSwap ^ 1][iEnd2];
- bool s2in = between(cs2, s2, ce2) || startPt.approximatelyEqual(fPt[i2])
+ bool s2in = between(cs2, s2, ce2) || startPt.approximatelyEqual(fPt[i2])
|| startPt.approximatelyEqual(fPt[iEnd2]);
bool e2in = between(cs2, e2, ce2) || endPt.approximatelyEqual(fPt[i2])
|| endPt.approximatelyEqual(fPt[iEnd2]);
fIsCoincident[0] |= bit;
fIsCoincident[1] |= bit;
}
-
+
void insertCoincidentPair(double s1, double e1, double s2, double e2,
const _Point& startPt, const _Point& endPt);
return insert(one, two, pt);
}
}
-
+
bool intersected() const {
return fUsed > 0;
}
* Copyright 2013 __MyCompanyName__. All rights reserved.
*
*/
-
bool done(const Angle* angle) const {
return done(SkMin32(angle->start(), angle->end()));
}
-
+
SkPoint dxdy(int index) const {
return (*SegmentDXDYAtT[fVerb])(fPts, fTs[index].fT);
}
#include "SkTypes.h"
-// These functions dump 0, 1, and 2d arrays of data in a format that's
+// These functions dump 0, 1, and 2d arrays of data in a format that's
// compatible with Mathematica for quick visualization
SkDEBUGFAIL("Need to specialize SkDebugDumpMathematica for your type, sorry.");
}
-template<class T>
+template<class T>
inline void SkDebugDumpMathematica(const char *name, const T *array, int size) {
SkDebugf(name);
SkDebugf(" = {");
SkDebugf("};\n");
}
-template<class T>
+template<class T>
inline void SkDebugDumpMathematica(const char *name, const T *array, int width, int height) {
SkDebugf(name);
SkDebugf(" = {\n");
SkDebugf("\n};\n");
}
-template<class T>
+template<class T>
inline void SkDebugDumpMathematica( const char *name, const T val ) {
SkDebugf(name);
SkDebugf(" = ");
SkDebugf(";\n");
}
-template<>
+template<>
inline void SkDebugDumpMathematica<uint8_t>( const uint8_t val ) {
SkDebugf("%u", val);
}
-template<>
+template<>
inline void SkDebugDumpMathematica<unsigned int>( const unsigned int val ) {
SkDebugf("%u", val);
}
-template<>
+template<>
inline void SkDebugDumpMathematica<int>( const int val ) {
SkDebugf("%d", val);
}
-template<>
+template<>
inline void SkDebugDumpMathematica<size_t>( const size_t val ) {
SkDebugf("%u", val);
}
-template<>
+template<>
void SkDebugDumpMathematica<const char *>( const char * val ) {
SkDebugf("%s", val);
}
-template<>
+template<>
inline void SkDebugDumpMathematica<float>( float val ) {
SkDebugf("%f", val);
}
/**
* This function generates a mask that we like to have known at compile
- * time. When the number of stages is bumped or the way bits are defined in
- * GrDrawState.h changes this function should be rerun to generate the new mask.
- * (We attempted to force the compiler to generate the mask using recursive
- * templates but always wound up with static initializers under gcc, even if
+ * time. When the number of stages is bumped or the way bits are defined in
+ * GrDrawState.h changes this function should be rerun to generate the new mask.
+ * (We attempted to force the compiler to generate the mask using recursive
+ * templates but always wound up with static initializers under gcc, even if
* they were just a series of immediate->memory moves.)
*
*/
*
* Order of vertex components:
* Position
- * Tex Coord
+ * Tex Coord
* Color
* Coverage
*/
/**
* The format of vertices is represented as a bitfield of flags.
* Flags that indicate the layout of vertex data. Vertices always contain
- * positions and may also contain texture coordinates, per-vertex colors,
+ * positions and may also contain texture coordinates, per-vertex colors,
* and per-vertex coverage. Each stage can use any texture coordinates as
- * its input texture coordinates or it may use the positions as texture
+ * its input texture coordinates or it may use the positions as texture
* coordinates.
*
* If no texture coordinates are specified for a stage then the stage is
* disabled.
*
- * The order in memory is always (position, texture coords, color, coverage)
- * with any unused fields omitted.
+ * The order in memory is always (position, texture coords, color, coverage)
+ * with any unused fields omitted.
*/
/**
/**
* Helper function to compute the size of each vertex and the offsets of
- * texture coordinates and color.
+ * texture coordinates and color.
*
* @param vertexLayout the layout to query
* @param texCoordOffset after return it is the offset of the
* have changed. They should be reestablished before the next drawIndexed
* or drawNonIndexed. This cannot be called between reserving and releasing
* geometry.
- *
+ *
* A subclass may override this to perform more optimal rect rendering. Its
* draws should be funneled through one of the public GrDrawTarget draw methods
* (e.g. drawNonIndexed, drawIndexedInstances, ...). The base class draws a two
* triangle fan using drawNonIndexed from reserved vertex space.
- *
+ *
* @param rect the rect to draw
* @param matrix optional matrix applied to rect (before viewMatrix)
* @param srcRects specifies rect for explicit texture coordinates.
* if srcRect is non-NULL then that rect will be used
* as the coordinates for the given stage.
* @param srcMatrix optional matrix applied to srcRect. If
- * srcRect is non-NULL and srcMatrix is non-NULL
- * then srcRect will be transformed by srcMatrix.
+ * srcRect is non-NULL and srcMatrix is non-NULL
+ * then srcRect will be transformed by srcMatrix.
* srcMatrix can be NULL when no srcMatrix is desired.
- * @param stage the stage to be given explicit texture coordinates.
+ * @param stage the stage to be given explicit texture coordinates.
* Ignored if srcRect is NULL.
*/
virtual void drawRect(const GrRect& rect,
const GrGLInterface* SkNativeGLContext::createGLContext() {
SkASSERT(NULL == fContext);
-
+
CGLPixelFormatAttribute attributes[] = {
#if 0
kCGLPFAOpenGLProfile, kCGLOGLPVersion_3_2_Core,
};
CGLPixelFormatObj pixFormat;
GLint npix;
-
+
CGLChoosePixelFormat(attributes, &pixFormat, &npix);
-
+
if (NULL == pixFormat) {
SkDebugf("CGLChoosePixelFormat failed.");
return NULL;
}
-
+
CGLCreateContext(pixFormat, NULL, &fContext);
CGLReleasePixelFormat(pixFormat);
-
+
if (NULL == fContext) {
SkDebugf("CGLCreateContext failed.");
return NULL;
}
-
+
CGLSetCurrentContext(fContext);
const GrGLInterface* interface = GrGLCreateNativeInterface();