Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@9948 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkBitmapFilter.cpp b/src/core/SkBitmapFilter.cpp
index 79c0a98..441ad05 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -29,23 +29,23 @@
int sx = SkScalarFloorToInt(srcPt.fX);
int sy = SkScalarFloorToInt(srcPt.fY);
-
+
SkFixed weight = 0;
SkFixed fr = 0, fg = 0, fb = 0, fa = 0;
-
+
int y0 = SkClampMax(int(ceil(sy-s.getBitmapFilter()->width() + 0.5f)), maxY);
int y1 = SkClampMax(int(floor(sy+s.getBitmapFilter()->width() + 0.5f)), maxY);
int x0 = SkClampMax(int(ceil(sx-s.getBitmapFilter()->width() + 0.5f)), maxX);
int x1 = SkClampMax(int(floor(sx+s.getBitmapFilter()->width() + 0.5f)), maxX);
-
+
for (int src_y = y0; src_y <= y1; src_y++) {
SkFixed yweight = s.getBitmapFilter()->lookup((srcPt.fY - src_y));
-
+
for (int src_x = x0; src_x <= x1 ; src_x++) {
SkFixed xweight = s.getBitmapFilter()->lookup((srcPt.fX - src_x));
-
+
SkFixed combined_weight = SkFixedMul(xweight, yweight);
-
+
SkPMColor c = *s.fBitmap->getAddr32(src_x, src_y);
fr += combined_weight * SkGetPackedR32(c);
fg += combined_weight * SkGetPackedG32(c);
@@ -75,9 +75,9 @@
SkPMColor *SK_RESTRICT colors, int count) {
const int maxX = s.fBitmap->width() - 1;
const int maxY = s.fBitmap->height() - 1;
-
+
SkPoint srcPt;
-
+
s.fInvProc(*s.fInvMatrix, SkIntToScalar(x),
SkIntToScalar(y), &srcPt);
srcPt.fY -= SK_ScalarHalf;
@@ -129,7 +129,7 @@
*colors++ = SkPackARGB32(a, r, g, b);
x++;
- }
+ }
}
SK_CONF_DECLARE(const char *, c_bitmapFilter, "bitmap.filter", "mitchell", "Which bitmap filter to use [mitchell, sinc, gaussian, triangle, box]");
@@ -148,7 +148,7 @@
} else {
SkASSERT(!!!"Unknown filter type");
}
-
+
return NULL;
}
@@ -176,11 +176,11 @@
if (0xFF != paint.getAlpha()) {
return NULL;
}
-
+
if (fInvType & (SkMatrix::kAffine_Mask | SkMatrix::kScale_Mask)) {
fBitmapFilter = allocateBitmapFilter();
}
-
+
if (fInvType & SkMatrix::kAffine_Mask) {
return highQualityFilter;
} else if (fInvType & SkMatrix::kScale_Mask) {
@@ -213,10 +213,10 @@
float sx = x / scale - 0.5f;
int x0 = SkClampMax(int(ceil(sx-filter->width() + 0.5f)), src->width()-1);
int x1 = SkClampMax(int(floor(sx+filter->width() + 0.5f)), src->width()-1);
-
+
SkFixed total_weight = 0;
SkFixed fr = 0, fg = 0, fb = 0, fa = 0;
-
+
for (int src_x = x0 ; src_x <= x1 ; src_x++) {
SkFixed weight = filter->lookup(sx - src_x);
SkPMColor c = *src->getAddr32(src_x,y);
@@ -244,22 +244,22 @@
static void downScaleHoriz(const SkBitmap *src, SkBitmap *dst, float scale, SkBitmapFilter *filter) {
SkFixed *sums = SkNEW_ARRAY(SkFixed, dst->width() * dst->height() * 4);
SkFixed *weights = SkNEW_ARRAY(SkFixed, dst->width() * dst->height());
-
+
SkAutoTDeleteArray<SkFixed> ada1(sums);
SkAutoTDeleteArray<SkFixed> ada2(weights);
memset(sums, 0, dst->width() * dst->height() * sizeof(SkFixed) * 4);
memset(weights, 0, dst->width() * dst->height() * sizeof(SkFixed));
-
+
for (int y = 0 ; y < src->height() ; y++) {
for (int x = 0 ; x < src->width() ; x++) {
// splat each source pixel into the destination image
float dx = (x + 0.5f) * scale;
int x0 = SkClampMax(int(ceil(dx-filter->width() + 0.5f)), dst->width()-1);
int x1 = SkClampMax(int(floor(dx+filter->width() + 0.5f)), dst->width()-1);
-
+
SkPMColor c = *src->getAddr32(x,y);
-
+
for (int dst_x = x0 ; dst_x <= x1 ; dst_x++) {
SkFixed weight = filter->lookup(dx - dst_x);
sums[4*(y*dst->width() + dst_x) + 0] += weight*SkGetPackedR32(c);
@@ -270,7 +270,7 @@
}
}
}
-
+
divideByWeights(sums, weights, dst);
}
@@ -280,10 +280,10 @@
float sy = y / scale - 0.5f;
int y0 = SkClampMax(int(ceil(sy-filter->width() + 0.5f)), src->height()-1);
int y1 = SkClampMax(int(floor(sy+filter->width() + 0.5f)), src->height()-1);
-
+
SkFixed total_weight = 0;
SkFixed fr = 0, fg = 0, fb = 0, fa = 0;
-
+
for (int src_y = y0 ; src_y <= y1 ; src_y++) {
SkFixed weight = filter->lookup(sy - src_y);
SkPMColor c = *src->getAddr32(x,src_y);
@@ -311,7 +311,7 @@
static void downScaleVert(const SkBitmap *src, SkBitmap *dst, float scale, SkBitmapFilter *filter) {
SkFixed *sums = SkNEW_ARRAY(SkFixed, dst->width() * dst->height() * 4);
SkFixed *weights = SkNEW_ARRAY(SkFixed, dst->width() * dst->height());
-
+
SkAutoTDeleteArray<SkFixed> ada1(sums);
SkAutoTDeleteArray<SkFixed> ada2(weights);
@@ -337,21 +337,21 @@
}
}
}
-
+
divideByWeights(sums, weights, dst);
}
void SkBitmap::scale(SkBitmap *dst) const {
-
+
SkBitmap horiz_temp;
-
+
horiz_temp.setConfig(SkBitmap::kARGB_8888_Config, dst->width(), height());
horiz_temp.allocPixels();
-
+
SkBitmapFilter *filter = allocateBitmapFilter();
-
+
float horiz_scale = float(dst->width()) / width();
-
+
if (horiz_scale == 1) {
this->copyPixelsTo(horiz_temp.getPixels(), getSize());
} else if (horiz_scale > 1) {
@@ -359,9 +359,9 @@
} else if (horiz_scale < 1) {
downScaleHoriz(this, &horiz_temp, horiz_scale, filter);
}
-
+
float vert_scale = float(dst->height()) / height();
-
+
if (vert_scale == 1) {
horiz_temp.copyPixelsTo(dst->getPixels(), dst->getSize());
} else if (vert_scale > 1) {
@@ -369,6 +369,6 @@
} else if (vert_scale < 1) {
downScaleVert(&horiz_temp, dst, vert_scale, filter);
}
-
+
SkDELETE(filter);
}
diff --git a/src/core/SkBitmapFilter.h b/src/core/SkBitmapFilter.h
index bb14290..c6fee2c 100644
--- a/src/core/SkBitmapFilter.h
+++ b/src/core/SkBitmapFilter.h
@@ -24,23 +24,23 @@
: fWidth(width), fInvWidth(1.f/width) {
precomputed = false;
}
-
+
SkFixed lookup( float x ) const {
if (!precomputed) {
precomputeTable();
}
int filter_idx = int(fabsf(x * invWidth() * SKBITMAP_FILTER_TABLE_SIZE));
return fFilterTable[ SkTMin(filter_idx, SKBITMAP_FILTER_TABLE_SIZE-1) ];
- }
-
+ }
+
float lookupFloat( float x ) const {
if (!precomputed) {
precomputeTable();
}
int filter_idx = int(fabsf(x * invWidth() * SKBITMAP_FILTER_TABLE_SIZE));
return fFilterTableFloat[ SkTMin(filter_idx, SKBITMAP_FILTER_TABLE_SIZE-1) ];
- }
-
+ }
+
float width() const { return fWidth; }
float invWidth() const { return fInvWidth; }
virtual float evaluate(float x) const = 0;
@@ -48,7 +48,7 @@
protected:
float fWidth;
float fInvWidth;
-
+
mutable bool precomputed;
mutable SkFixed fFilterTable[SKBITMAP_FILTER_TABLE_SIZE];
mutable float fFilterTableFloat[SKBITMAP_FILTER_TABLE_SIZE];
@@ -69,9 +69,9 @@
class SkMitchellFilter: public SkBitmapFilter {
public:
SkMitchellFilter(float b, float c, float width=2.0f)
- : SkBitmapFilter(width), B(b), C(c) {
+ : SkBitmapFilter(width), B(b), C(c) {
}
-
+
virtual float evaluate(float x) const SK_OVERRIDE {
x = fabsf(x);
if (x > 2.f) {
@@ -92,9 +92,9 @@
class SkGaussianFilter: public SkBitmapFilter {
public:
SkGaussianFilter(float a, float width=2.0f)
- : SkBitmapFilter(width), alpha(a), expWidth(expf(-alpha * width * width)) {
+ : SkBitmapFilter(width), alpha(a), expWidth(expf(-alpha * width * width)) {
}
-
+
virtual float evaluate(float x) const SK_OVERRIDE {
return SkTMax(0.f, float(expf(-alpha*x*x) - expWidth));
}
@@ -105,9 +105,9 @@
class SkTriangleFilter: public SkBitmapFilter {
public:
SkTriangleFilter(float width=1)
- : SkBitmapFilter(width) {
+ : SkBitmapFilter(width) {
}
-
+
virtual float evaluate(float x) const SK_OVERRIDE {
return SkTMax(0.f, fWidth - fabsf(x));
}
@@ -117,9 +117,9 @@
class SkBoxFilter: public SkBitmapFilter {
public:
SkBoxFilter(float width=0.5f)
- : SkBitmapFilter(width) {
+ : SkBitmapFilter(width) {
}
-
+
virtual float evaluate(float x) const SK_OVERRIDE {
return 1;
}
@@ -130,9 +130,9 @@
class SkSincFilter: public SkBitmapFilter {
public:
SkSincFilter(float t, float width=3.f)
- : SkBitmapFilter(width), tau(t) {
+ : SkBitmapFilter(width), tau(t) {
}
-
+
virtual float evaluate(float x) const SK_OVERRIDE {
x = sk_float_abs(x * fInvWidth);
if (x < 1e-5f) return 1.f;
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 69de2ca..1f75533 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -114,7 +114,7 @@
// are ignored
ShaderProc32 getShaderProc32() const { return fShaderProc32; }
ShaderProc16 getShaderProc16() const { return fShaderProc16; }
-
+
SkBitmapFilter* getBitmapFilter() const { return fBitmapFilter; }
#ifdef SK_DEBUG
@@ -142,7 +142,7 @@
MatrixProc chooseMatrixProc(bool trivial_matrix);
bool chooseProcs(const SkMatrix& inv, const SkPaint&);
ShaderProc32 chooseShaderProc32();
-
+
void buildFilterCoefficients(SkFixed dst[4], float t) const;
SkBitmapFilter *fBitmapFilter;
@@ -206,6 +206,6 @@
SkPMColor *SK_RESTRICT colors, int count);
void highQualityFilter(const SkBitmapProcState &s, int x, int y,
SkPMColor *SK_RESTRICT colors, int count);
-
+
#endif
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index a12f961..cd6aa2e 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1208,7 +1208,7 @@
/* given a quad-curve and a point (x,y), chop the quad at that point and place
the new off-curve point and endpoint into 'dest'. The new end point is used
(rather than (x,y)) to compensate for numerical inaccuracies.
- Should only return false if the computed pos is the start of the curve
+ Should only return false if the computed pos is the start of the curve
(i.e. root == 0)
*/
static bool truncate_last_curve(const SkPoint quad[3], SkScalar x, SkScalar y, SkPoint* dest)