Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@7385 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
e8625ac205
commit
4024f32d99
@ -318,7 +318,7 @@ class GiantDashBench : public SkBenchmark {
|
|||||||
SkScalar fStrokeWidth;
|
SkScalar fStrokeWidth;
|
||||||
SkPoint fPts[2];
|
SkPoint fPts[2];
|
||||||
SkAutoTUnref<SkPathEffect> fPathEffect;
|
SkAutoTUnref<SkPathEffect> fPathEffect;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum LineType {
|
enum LineType {
|
||||||
kHori_LineType,
|
kHori_LineType,
|
||||||
@ -345,7 +345,7 @@ public:
|
|||||||
SkScalar cx = 640 / 2; // center X
|
SkScalar cx = 640 / 2; // center X
|
||||||
SkScalar cy = 480 / 2; // center Y
|
SkScalar cy = 480 / 2; // center Y
|
||||||
SkMatrix matrix;
|
SkMatrix matrix;
|
||||||
|
|
||||||
switch (lt) {
|
switch (lt) {
|
||||||
case kHori_LineType:
|
case kHori_LineType:
|
||||||
matrix.setIdentity();
|
matrix.setIdentity();
|
||||||
@ -357,19 +357,19 @@ public:
|
|||||||
matrix.setRotate(45, cx, cy);
|
matrix.setRotate(45, cx, cy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkScalar overshoot = 100*1000;
|
const SkScalar overshoot = 100*1000;
|
||||||
const SkPoint pts[2] = {
|
const SkPoint pts[2] = {
|
||||||
{ -overshoot, cy }, { 640 + overshoot, cy }
|
{ -overshoot, cy }, { 640 + overshoot, cy }
|
||||||
};
|
};
|
||||||
matrix.mapPoints(fPts, pts, 2);
|
matrix.mapPoints(fPts, pts, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* onGetName() SK_OVERRIDE {
|
virtual const char* onGetName() SK_OVERRIDE {
|
||||||
return fName.c_str();
|
return fName.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||||
SkPaint p;
|
SkPaint p;
|
||||||
this->setupPaint(&p);
|
this->setupPaint(&p);
|
||||||
@ -379,7 +379,7 @@ protected:
|
|||||||
|
|
||||||
canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
|
canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef SkBenchmark INHERITED;
|
typedef SkBenchmark INHERITED;
|
||||||
};
|
};
|
||||||
|
@ -284,7 +284,7 @@ static bool intersect2(const Cubic& cubic1, double t1s, double t1e, const Cubic&
|
|||||||
cubic1, SkTMax(to1 - dt1, 0.), SkTMin(to1 + dt1, 1.), i);
|
cubic1, SkTMax(to1 - dt1, 0.), SkTMin(to1 + dt1, 1.), i);
|
||||||
i.swap();
|
i.swap();
|
||||||
--debugDepth;
|
--debugDepth;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t2Start = t2;
|
t2Start = t2;
|
||||||
|
@ -162,7 +162,7 @@ int cubicRootsReal(double A, double B, double C, double D, double s[3]) {
|
|||||||
*roots++ = -u - adiv3;
|
*roots++ = -u - adiv3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (R2MinusQ3 < 0) // we have 3 real roots
|
if (R2MinusQ3 < 0) // we have 3 real roots
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ inline bool approximately_equal(double x, double y) {
|
|||||||
return approximately_zero(x - y);
|
return approximately_zero(x - y);
|
||||||
#else
|
#else
|
||||||
// see http://visualstudiomagazine.com/blogs/tool-tracker/2011/11/compare-floating-point-numbers.aspx
|
// see http://visualstudiomagazine.com/blogs/tool-tracker/2011/11/compare-floating-point-numbers.aspx
|
||||||
// this allows very small (e.g. degenerate) values to compare unequally, but in this case,
|
// this allows very small (e.g. degenerate) values to compare unequally, but in this case,
|
||||||
// AlmostEqualUlps should be used instead.
|
// AlmostEqualUlps should be used instead.
|
||||||
if (x == y) {
|
if (x == y) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -21,7 +21,7 @@ and using the roots
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int add_valid_ts(double s[], int realRoots, double* t) {
|
int add_valid_ts(double s[], int realRoots, double* t) {
|
||||||
int foundRoots = 0;
|
int foundRoots = 0;
|
||||||
for (int index = 0; index < realRoots; ++index) {
|
for (int index = 0; index < realRoots; ++index) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
int reducedQuarticRoots(const double t4, const double t3, const double t2, const double t1,
|
int reducedQuarticRoots(const double t4, const double t3, const double t2, const double t1,
|
||||||
const double t0, const bool oneHint, double s[4]);
|
const double t0, const bool oneHint, double s[4]);
|
||||||
|
|
||||||
int quarticRootsReal(const double A, const double B, const double C, const double D,
|
int quarticRootsReal(const double A, const double B, const double C, const double D,
|
||||||
const double E, double s[4]);
|
const double E, double s[4]);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'mac_bundle' : 1,
|
'mac_bundle' : 1,
|
||||||
'include_dirs' : [
|
'include_dirs' : [
|
||||||
'../src/core',
|
'../src/core',
|
||||||
'../src/effects', #needed for BlurMask.h
|
'../src/effects', #needed for BlurMask.h
|
||||||
'../gm', # needed to pull gm.h
|
'../gm', # needed to pull gm.h
|
||||||
'../samplecode', # To pull SampleApp.h and SampleCode.h
|
'../samplecode', # To pull SampleApp.h and SampleCode.h
|
||||||
|
@ -114,7 +114,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool SK_WARN_UNUSED_RESULT
|
bool SK_WARN_UNUSED_RESULT
|
||||||
computeConservativeLocalClipBounds(SkRect* bounds) const;
|
computeConservativeLocalClipBounds(SkRect* bounds) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const SkBitmap* fBitmap; // required
|
const SkBitmap* fBitmap; // required
|
||||||
const SkMatrix* fMatrix; // required
|
const SkMatrix* fMatrix; // required
|
||||||
|
@ -686,7 +686,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
|
|||||||
path.lineTo(pts[1]);
|
path.lineTo(pts[1]);
|
||||||
|
|
||||||
SkRect cullRect = SkRect::Make(fRC->getBounds());
|
SkRect cullRect = SkRect::Make(fRC->getBounds());
|
||||||
|
|
||||||
if (paint.getPathEffect()->asPoints(&pointData, path, rec,
|
if (paint.getPathEffect()->asPoints(&pointData, path, rec,
|
||||||
*fMatrix, &cullRect)) {
|
*fMatrix, &cullRect)) {
|
||||||
// 'asPoints' managed to find some fast path
|
// 'asPoints' managed to find some fast path
|
||||||
|
@ -118,7 +118,7 @@ static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec,
|
|||||||
|
|
||||||
SkScalar dx = pts[1].x() - pts[0].x();
|
SkScalar dx = pts[1].x() - pts[0].x();
|
||||||
SkScalar dy = pts[1].y() - pts[0].y();
|
SkScalar dy = pts[1].y() - pts[0].y();
|
||||||
|
|
||||||
// just do horizontal lines for now (lazy)
|
// just do horizontal lines for now (lazy)
|
||||||
if (dy) {
|
if (dy) {
|
||||||
return false;
|
return false;
|
||||||
@ -126,11 +126,11 @@ static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec,
|
|||||||
|
|
||||||
SkScalar minX = pts[0].fX;
|
SkScalar minX = pts[0].fX;
|
||||||
SkScalar maxX = pts[1].fX;
|
SkScalar maxX = pts[1].fX;
|
||||||
|
|
||||||
if (maxX < bounds.fLeft || minX > bounds.fRight) {
|
if (maxX < bounds.fLeft || minX > bounds.fRight) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dx < 0) {
|
if (dx < 0) {
|
||||||
SkTSwap(minX, maxX);
|
SkTSwap(minX, maxX);
|
||||||
}
|
}
|
||||||
@ -147,14 +147,14 @@ static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec,
|
|||||||
maxX = bounds.fRight + SkScalarMod(maxX - bounds.fRight,
|
maxX = bounds.fRight + SkScalarMod(maxX - bounds.fRight,
|
||||||
intervalLength);
|
intervalLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkASSERT(maxX > minX);
|
SkASSERT(maxX > minX);
|
||||||
if (dx < 0) {
|
if (dx < 0) {
|
||||||
SkTSwap(minX, maxX);
|
SkTSwap(minX, maxX);
|
||||||
}
|
}
|
||||||
pts[0].fX = minX;
|
pts[0].fX = minX;
|
||||||
pts[1].fX = maxX;
|
pts[1].fX = maxX;
|
||||||
|
|
||||||
dstPath->moveTo(pts[0]);
|
dstPath->moveTo(pts[0]);
|
||||||
dstPath->lineTo(pts[1]);
|
dstPath->lineTo(pts[1]);
|
||||||
return true;
|
return true;
|
||||||
@ -243,7 +243,7 @@ bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
|||||||
if (cull_path(src, *rec, cullRect, fIntervalLength, &cullPathStorage)) {
|
if (cull_path(src, *rec, cullRect, fIntervalLength, &cullPathStorage)) {
|
||||||
srcPtr = &cullPathStorage;
|
srcPtr = &cullPathStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpecialLineRec lineRec;
|
SpecialLineRec lineRec;
|
||||||
bool specialLine = lineRec.init(src, dst, rec, fCount >> 1, fIntervalLength);
|
bool specialLine = lineRec.init(src, dst, rec, fCount >> 1, fIntervalLength);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ static void TestSort(skiatest::Reporter* reporter) {
|
|||||||
for (int i = 0; i < 10000; i++) {
|
for (int i = 0; i < 10000; i++) {
|
||||||
int count = rand.nextRangeU(1, SK_ARRAY_COUNT(randomArray));
|
int count = rand.nextRangeU(1, SK_ARRAY_COUNT(randomArray));
|
||||||
rand_array(rand, randomArray, count);
|
rand_array(rand, randomArray, count);
|
||||||
|
|
||||||
// Use qsort as the reference sort.
|
// Use qsort as the reference sort.
|
||||||
memcpy(sortedArray, randomArray, sizeof(randomArray));
|
memcpy(sortedArray, randomArray, sizeof(randomArray));
|
||||||
qsort(sortedArray, count, sizeof(sortedArray[0]), compare_int);
|
qsort(sortedArray, count, sizeof(sortedArray[0]), compare_int);
|
||||||
|
Loading…
Reference in New Issue
Block a user