diff options
author | skia.committer@gmail.com <skia.committer@gmail.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-21 07:15:03 +0000 |
---|---|---|
committer | skia.committer@gmail.com <skia.committer@gmail.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-21 07:15:03 +0000 |
commit | d454ec135eeef48edea7ebc47a61ff39bd654576 (patch) | |
tree | cb926da506ae44550788a000e8092dfa2d92b2a8 | |
parent | 46dc43da88a55c5623ba1d385df872509673ce20 (diff) |
Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@7803 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | bench/BlurRectBench.cpp | 2 | ||||
-rw-r--r-- | experimental/Intersection/CubicIntersection_Test.cpp | 2 | ||||
-rw-r--r-- | experimental/Intersection/DataTypes.h | 2 | ||||
-rw-r--r-- | experimental/Intersection/QuadraticImplicit.cpp | 4 | ||||
-rw-r--r-- | experimental/Intersection/Simplify.cpp | 2 | ||||
-rw-r--r-- | gm/blurrect.cpp | 36 | ||||
-rw-r--r-- | src/effects/SkBlurMask.cpp | 78 | ||||
-rw-r--r-- | src/effects/SkBlurMask.h | 6 |
8 files changed, 66 insertions, 66 deletions
diff --git a/bench/BlurRectBench.cpp b/bench/BlurRectBench.cpp index cbb624c112..8767deefa2 100644 --- a/bench/BlurRectBench.cpp +++ b/bench/BlurRectBench.cpp @@ -117,7 +117,7 @@ protected: memset(fSrcMask.fImage, 0xff, fSrcMask.computeTotalImageSize()); } - + SkMask fSrcMask; private: typedef BlurRectBench INHERITED; diff --git a/experimental/Intersection/CubicIntersection_Test.cpp b/experimental/Intersection/CubicIntersection_Test.cpp index 08bffd61bf..fe5679fd17 100644 --- a/experimental/Intersection/CubicIntersection_Test.cpp +++ b/experimental/Intersection/CubicIntersection_Test.cpp @@ -137,7 +137,7 @@ static const Cubic newTestSet[] = { {{1,2},{5,6},{1,0},{1,0}}, {{0,1},{0,1},{2,1},{6,5}}, -{{0,6},{1,2},{1,0},{1,0}}, +{{0,6},{1,2},{1,0},{1,0}}, {{0,1},{0,1},{6,0},{2,1}}, {{0,2},{0,1},{3,0},{1,0}}, diff --git a/experimental/Intersection/DataTypes.h b/experimental/Intersection/DataTypes.h index ae8d44d6ed..8226f09bd2 100644 --- a/experimental/Intersection/DataTypes.h +++ b/experimental/Intersection/DataTypes.h @@ -293,7 +293,7 @@ struct _Point { double lengthSquared() const { return x * x + y * y; } - + double roughlyEqual(const _Point& a) const { return roughly_equal(a.y, y) && roughly_equal(a.x, x); } diff --git a/experimental/Intersection/QuadraticImplicit.cpp b/experimental/Intersection/QuadraticImplicit.cpp index 2aed06f8fe..a13e39b2c1 100644 --- a/experimental/Intersection/QuadraticImplicit.cpp +++ b/experimental/Intersection/QuadraticImplicit.cpp @@ -380,7 +380,7 @@ static bool binarySearch(const Quadratic& quad1, const Quadratic& quad2, double& if (tStep < FLT_EPSILON_HALF) { break; } - calcMask = (1 << 0) | (1 << 2) | (1 << 3) | (1 << 5); + calcMask = (1 << 0) | (1 << 2) | (1 << 3) | (1 << 5); continue; } if (best_i == 0) { @@ -498,7 +498,7 @@ bool intersect2(const Quadratic& q1, const Quadratic& q2, Intersections& i) { continue; } SkASSERT(r1Count == 1 && r2Count == 1); - SkDebugf("*** [%d,%d] (%1.9g,%1.9g) %s (%1.9g,%1.9g)\n", cu1, cu2, + SkDebugf("*** [%d,%d] (%1.9g,%1.9g) %s (%1.9g,%1.9g)\n", cu1, cu2, pts1[0].x, pts1[0].y, pts1[0].approximatelyEqualHalf(pts2[0]) ? "==" : "!=", pts2[0].x, pts2[0].y); } diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp index 70038e640e..0db33fa77d 100644 --- a/experimental/Intersection/Simplify.cpp +++ b/experimental/Intersection/Simplify.cpp @@ -4165,7 +4165,7 @@ the same winding is shared by both. start, segment.xAtT(&sSpan), segment.yAtT(&sSpan), end, segment.xAtT(&eSpan), segment.yAtT(&eSpan), angle.sign(), mSpan.fWindValue); - start here; + start here; // create an inline to replace this conditional if (mSpan.fWindSum == SK_MinS32) { SkDebugf("?"); diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp index a6fc56dd4f..056d89ca61 100644 --- a/gm/blurrect.cpp +++ b/gm/blurrect.cpp @@ -148,17 +148,17 @@ public: , fStyle(style) {} - int width() const { - return fRectWidth; + int width() const { + return fRectWidth; } - int height() const { - return fRectHeight; + int height() const { + return fRectHeight; } - SkScalar radius() const { - return fRadius; + SkScalar radius() const { + return fRadius; } - SkBlurMask::Style style() const { - return fStyle; + SkBlurMask::Style style() const { + return fStyle; } protected: @@ -211,9 +211,9 @@ public: BlurRectFastGM(const char name[], unsigned int rect_width, unsigned int rect_height, float blur_radius, SkBlurMask::Style style) : - INHERITED(name, rect_width, rect_height, blur_radius, style) + INHERITED(name, rect_width, rect_height, blur_radius, style) { - + } protected: virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { @@ -225,11 +225,11 @@ private: class BlurRectSlowGM: public BlurRectCompareGM { public: - BlurRectSlowGM(const char name[], unsigned int rect_width, unsigned int rect_height, + BlurRectSlowGM(const char name[], unsigned int rect_width, unsigned int rect_height, float blur_radius, SkBlurMask::Style style) : - INHERITED(name, rect_width, rect_height, blur_radius, style) + INHERITED(name, rect_width, rect_height, blur_radius, style) { - + } protected: virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { @@ -255,11 +255,11 @@ private: class BlurRectSlowLowGM: public BlurRectSlowGM { public: - BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight, + BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight, float blurRadius, SkBlurMask::Style style) : - INHERITED(name, rectWidth, rectHeight, blurRadius, style) + INHERITED(name, rectWidth, rectHeight, blurRadius, style) { - + } protected: virtual SkBlurMask::Quality getQuality() SK_OVERRIDE { @@ -271,11 +271,11 @@ private: class BlurRectGroundTruthGM: public BlurRectCompareGM { public: - BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned int rectHeight, + BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned int rectHeight, float blurRadius, SkBlurMask::Style style) : INHERITED(name, rectWidth, rectHeight, blurRadius, style) { - + } protected: virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp index d6184538de..413e8c0690 100644 --- a/src/effects/SkBlurMask.cpp +++ b/src/effects/SkBlurMask.cpp @@ -966,12 +966,12 @@ bool SkBlurMask::Blur(SkMask* dst, const SkMask& src, if (radius < SkIntToScalar(3)) { quality = kLow_Quality; } - - // highQuality: use three box blur passes as a cheap way + + // highQuality: use three box blur passes as a cheap way // to approximate a Gaussian blur int passCount = (kHigh_Quality == quality) ? 3 : 1; - SkScalar passRadius = (kHigh_Quality == quality) ? - SkScalarMul( radius, kBlurRadiusFudgeFactor): + SkScalar passRadius = (kHigh_Quality == quality) ? + SkScalarMul( radius, kBlurRadiusFudgeFactor): radius; int rx = SkScalarCeil(passRadius); @@ -987,13 +987,13 @@ bool SkBlurMask::Blur(SkMask* dst, const SkMask& src, int padx = passCount * rx; int pady = passCount * ry; - + if (margin) { margin->set(padx, pady); } dst->fBounds.set(src.fBounds.fLeft - padx, src.fBounds.fTop - pady, src.fBounds.fRight + padx, src.fBounds.fBottom + pady); - + dst->fRowBytes = dst->fBounds.width(); dst->fFormat = SkMask::kA8_Format; dst->fImage = NULL; @@ -1015,7 +1015,7 @@ bool SkBlurMask::Blur(SkMask* dst, const SkMask& src, SkAutoTMalloc<uint8_t> tmpBuffer(dstSize); uint8_t* tp = tmpBuffer.get(); int w = sw, h = sh; - + if (outerWeight == 255) { int loRadius, hiRadius; get_adjusted_radii(passRadius, &loRadius, &hiRadius); @@ -1137,9 +1137,9 @@ bool SkBlurMask::Blur(SkMask* dst, const SkMask& src, 3/4 - x^2 -.5 < x <= .5 9/8 - 3/2 x + 1/2 x^2 0.5 < x <= 1.5 0 1.5 < x - + Mathematica: - + g[x_] := Piecewise [ { {9/8 + 3/2 x + 1/2 x^2 , -1.5 < x <= -.5}, {3/4 - x^2 , -.5 < x <= .5}, @@ -1154,9 +1154,9 @@ bool SkBlurMask::Blur(SkMask* dst, const SkMask& src, 1/2 + 3/4 x - 1/3 x^3 -.5 < x <= .5 7/16 + 9/8 x - 3/4 x^2 + 1/6 x^3 .5 < x <= 1.5 1 1.5 < x - + in Mathematica code: - + gi[x_] := Piecewise[ { { 0 , x <= -1.5 }, { 9/16 + 9/8 x + 3/4 x^2 + 1/6 x^3, -1.5 < x <= -0.5 }, @@ -1230,7 +1230,7 @@ static inline unsigned int profile_lookup( unsigned int *profile, int loc, int b if (ox < 0) { ox = 0; } - + return profile[ox]; } @@ -1241,30 +1241,30 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, unsigned int *profile; float radius = SkScalarToFloat( SkScalarMul( provided_radius, kBlurRadiusFudgeFactor ) ); - + // adjust blur radius to match interpretation from boxfilter code radius = (radius + .5f) *2.f; profile_size = compute_profile( radius, &profile ); - + SkAutoTDeleteArray<unsigned int> ada(profile); int pad = profile_size/2; if (margin) { margin->set( pad, pad ); } - + int shadow_left = -pad; int shadow_top = -pad; int shadow_right = (int)(src.width()) + pad; int shadow_bottom = (int)(src.height()) + pad; - + dst->fBounds.set(shadow_left, shadow_top, shadow_right, shadow_bottom); dst->fRowBytes = dst->fBounds.width(); dst->fFormat = SkMask::kA8_Format; dst->fImage = NULL; - + size_t dstSize = dst->computeImageSize(); if (0 == dstSize) { return false; // too big to allocate, abort @@ -1288,7 +1288,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, int h = sh - center; uint8_t *outptr = dp; - + SkAutoTMalloc<uint8_t> horizontalScanline(dstWidth); for (int x = 0 ; x < dstWidth ; ++x) { @@ -1300,7 +1300,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, horizontalScanline[x] = (uint8_t) (255 * (gaussianIntegral(giX) - gaussianIntegral(giX + span))); } } - + for (int y = 0 ; y < dstHeight ; ++y) { unsigned int profile_y; if (profile_size <= sh) { @@ -1316,7 +1316,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, *(outptr++) = maskval; } } - + if (style == kInner_Style) { // now we allocate the "real" dst, mirror the size of src size_t srcSize = (size_t)(src.width() * src.height()); @@ -1333,7 +1333,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, dst->fBounds.set(0, 0, sw, sh); // restore trimmed bounds dst->fRowBytes = sw; - + } else if (style == kOuter_Style) { for (int y = pad ; y < dstHeight-pad ; y++) { uint8_t *dst_scanline = dp + y*dstWidth + pad; @@ -1350,9 +1350,9 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, // gaussian kernel. It's "ground truth" in a sense; too slow to be used, but very // useful for correctness comparisons. -bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provided_radius, +bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provided_radius, Style style, SkIPoint* margin) { - + if (src.fFormat != SkMask::kA8_Format) { return false; } @@ -1368,9 +1368,9 @@ bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provid SkAutoTMalloc<float> gaussWindow(windowSize); int halfWindow = windowSize >> 1; - + gaussWindow[halfWindow] = 1; - + float windowSum = 1; for (int x = 1 ; x <= halfWindow ; ++x) { float gaussian = expf(-x*x / variance); @@ -1380,7 +1380,7 @@ bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provid // leave the filter un-normalized for now; we will divide by the normalization // sum later; - + int pad = halfWindow; if (margin) { margin->set( pad, pad ); @@ -1399,39 +1399,39 @@ bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provid if (0 == dstSize) { return false; // too big to allocate, abort } - + int srcWidth = src.fBounds.width(); int srcHeight = src.fBounds.height(); int dstWidth = dst->fBounds.width(); - + const uint8_t* srcPixels = src.fImage; uint8_t* dstPixels = SkMask::AllocImage(dstSize); SkAutoTCallVProc<uint8_t, SkMask_FreeImage> autoCall(dstPixels); // do the actual blur. First, make a padded copy of the source. // use double pad so we never have to check if we're outside anything - + int padWidth = srcWidth + 4*pad; int padHeight = srcHeight; int padSize = padWidth * padHeight; - + SkAutoTMalloc<uint8_t> padPixels(padSize); memset(padPixels, 0, padSize); - + for (int y = 0 ; y < srcHeight; ++y) { uint8_t* padptr = padPixels + y * padWidth + 2*pad; const uint8_t* srcptr = srcPixels + y * srcWidth; memcpy(padptr, srcptr, srcWidth); } - + // blur in X, transposing the result into a temporary floating point buffer. // also double-pad the intermediate result so that the second blur doesn't // have to do extra conditionals. - + int tmpWidth = padHeight + 4*pad; int tmpHeight = padWidth - 2*pad; int tmpSize = tmpWidth * tmpHeight; - + SkAutoTMalloc<float> tmpImage(tmpSize); memset(tmpImage, 0, tmpSize*sizeof(tmpImage[0])); @@ -1444,13 +1444,13 @@ bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provid *outPixel += gaussWindow[pad+i]*windowCenter[i]; } *outPixel /= windowSum; - } + } } - + // blur in Y; now filling in the actual desired destination. We have to do - // the transpose again; these transposes guarantee that we read memory in + // the transpose again; these transposes guarantee that we read memory in // linear order. - + for (int y = 0 ; y < tmpHeight ; ++y) { float *srcScanline = tmpImage + y*tmpWidth; for (int x = pad ; x < tmpWidth - pad ; ++x) { @@ -1465,7 +1465,7 @@ bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar provid *outPixel = SkClampMax( SkClampPos(integerPixel), 255 ); } } - + dst->fImage = dstPixels; // if need be, alloc the "real" dst (same size as src) and copy/merge // the blur into it (applying the src) diff --git a/src/effects/SkBlurMask.h b/src/effects/SkBlurMask.h index 51ec8f858f..5179b4b2b7 100644 --- a/src/effects/SkBlurMask.h +++ b/src/effects/SkBlurMask.h @@ -37,13 +37,13 @@ public: static bool BlurSeparable(SkMask* dst, const SkMask& src, SkScalar radius, Style style, Quality quality, SkIPoint* margin = NULL); - + // the "ground truth" blur does a gaussian convolution; it's slow // but useful for comparison purposes. - static bool BlurGroundTruth(SkMask* dst, const SkMask& src, - SkScalar provided_radius, Style style, + static bool BlurGroundTruth(SkMask* dst, const SkMask& src, + SkScalar provided_radius, Style style, SkIPoint* margin = NULL); private: |