Remove trailing whitespace.

Also adds a presubmit to prevent adding trailing whitespace to source
code in the future.

Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6
Reviewed-on: https://skia-review.googlesource.com/57380
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/samplecode/PerlinPatch.cpp b/samplecode/PerlinPatch.cpp
index acc1a4a..d20a0fb 100644
--- a/samplecode/PerlinPatch.cpp
+++ b/samplecode/PerlinPatch.cpp
@@ -147,7 +147,7 @@
             { fTexX + texWidth, fTexY + texHeight},
             { fTexX - texWidth, fTexY + texHeight}}
         ;
-        
+
         SkScalar scaleFreq = 2.0;
         fShader1 = SkPerlinNoiseShader::MakeImprovedNoise(fXFreq/scaleFreq, fYFreq/scaleFreq, 4,
                                                              fSeed);
diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp
index 5b07665..350d3c8 100644
--- a/samplecode/SampleAAGeometry.cpp
+++ b/samplecode/SampleAAGeometry.cpp
@@ -616,11 +616,11 @@
 struct BiControl : public UniControl {
     SkScalar fValHi;
 
-    BiControl(const char* name, SkScalar min, SkScalar max) 
+    BiControl(const char* name, SkScalar min, SkScalar max)
         : UniControl(name, min, max)
         ,  fValHi(fMax) {
     }
-    
+
     virtual ~BiControl() {}
 
     virtual void draw(SkCanvas* canvas, const ControlPaints& paints) {
@@ -683,7 +683,7 @@
 
     MyClick(SkView* target, ClickType type, ControlType control)
         : Click(target)
-        , fType(type) 
+        , fType(type)
         , fControl(control)
         , fVerb((SkPath::Verb) -1)
         , fWeight(1) {
@@ -691,7 +691,7 @@
 
     MyClick(SkView* target, ClickType type, int index)
         : Click(target)
-        , fType(type) 
+        , fType(type)
         , fControl((ControlType) index)
         , fVerb((SkPath::Verb) -1)
         , fWeight(1) {
@@ -699,7 +699,7 @@
 
     MyClick(SkView* target, ClickType type, int index, SkPath::Verb verb, SkScalar weight)
         : Click(target)
-        , fType(type) 
+        , fType(type)
         , fControl((ControlType) index)
         , fVerb(verb)
         , fWeight(weight) {
@@ -819,7 +819,7 @@
 
 public:
 
-    AAGeometryView() 
+    AAGeometryView()
         : fResControl("error", 0, 10)
         , fWeightControl("weight", 0, 5)
         , fWidthControl("width", FLT_EPSILON, 100)
@@ -942,7 +942,7 @@
         SET_CONTROL(Filter);
         SET_CONTROL(Weight);
     }
-    
+
     #undef SET_CONTROL
 
     void set_buttonList(int index, Button* button, MyClick::ControlType type) {
@@ -973,7 +973,7 @@
 
     // overrides from SkEventSink
     bool onQuery(SkEvent* evt) override;
-    
+
     void onSizeChange() override {
         setControlButtonsPos();
         this->INHERITED::onSizeChange();
@@ -1173,7 +1173,7 @@
                         foundFirst = false;
                     }
                     break;
-                default: 
+                default:
                     break;
             }
             if (SkPath::kLine_Verb <= verb && verb <= SkPath::kCubic_Verb) {
@@ -1228,7 +1228,7 @@
                     canvas->drawPath(cPath, complex ? fComplexPaint : fActivePaint);
                     draw_points(canvas, pts, 4);
                     } break;
-                default: 
+                default:
                     break;
             }
             return;
@@ -1289,7 +1289,7 @@
                         return counter;
                     }
                     } break;
-                default: 
+                default:
                     break;
             }
         }
@@ -1400,7 +1400,7 @@
                 case SkPath::kCubic_Verb:
                     cubic_coverage(pts, distanceMap, w, h);
                     break;
-                default: 
+                default:
                     break;
             }
         }
@@ -1513,7 +1513,7 @@
                 if (!outPath.getBounds().intersects(inPath.getBounds())) {
                     continue;
                 }
-                
+
             }
         }
     }
@@ -1804,9 +1804,9 @@
     const char* fDescriptionR;
     bool (AAGeometryView::*fFunction)();
 } kKeyCommandList[] = {
-    { ' ',  0,  "space",   "center path", &AAGeometryView::scaleToFit },   
-    { '-',  0,  "-",          "zoom out", &AAGeometryView::scaleDown },   
-    { '+', '=', "+/=",         "zoom in", &AAGeometryView::scaleUp },   
+    { ' ',  0,  "space",   "center path", &AAGeometryView::scaleToFit },
+    { '-',  0,  "-",          "zoom out", &AAGeometryView::scaleDown },
+    { '+', '=', "+/=",         "zoom in", &AAGeometryView::scaleUp },
     { 'd',  0,  "d",   "dump to console", &AAGeometryView::pathDump },
     { 'h',  0,  "h",     "hide controls", &AAGeometryView::hideAll },
     { 'r',  0,  "r",        "reset path", &AAGeometryView::constructPath },
@@ -1869,5 +1869,5 @@
     }
     return this->INHERITED::onQuery(evt);
 }
-    
+
 DEF_SAMPLE( return new AAGeometryView; )
diff --git a/samplecode/SampleBigGradient.cpp b/samplecode/SampleBigGradient.cpp
index 9d850c9..301c3d8 100644
--- a/samplecode/SampleBigGradient.cpp
+++ b/samplecode/SampleBigGradient.cpp
@@ -93,7 +93,7 @@
 
     void drawRect(const SkRect& r, SkColor c) override {
         CGContextRef cg = (CGContextRef)fCanvas->accessTopRasterHandle();
-        
+
         CGColorRef color = CGColorCreateGenericRGB(SkColorGetR(c)/255.f,
                                                    SkColorGetG(c)/255.f,
                                                    SkColorGetB(c)/255.f,
@@ -121,7 +121,7 @@
 class Allocator_CG : public SkRasterHandleAllocator {
 public:
     Allocator_CG() {}
-    
+
     bool allocHandle(const SkImageInfo& info, Rec* rec) override {
         // let CG allocate the pixels
         CGContextRef cg = SkCreateCGContext(SkPixmap(info, nullptr, 0));
@@ -139,7 +139,7 @@
 
     void updateHandle(Handle hndl, const SkMatrix& ctm, const SkIRect& clip) override {
         CGContextRef cg = (CGContextRef)hndl;
-        
+
         CGContextRestoreGState(cg);
         CGContextSaveGState(cg);
         CGContextClipToRect(cg, CGRectMake(clip.x(), clip.y(), clip.width(), clip.height()));
@@ -282,7 +282,7 @@
         port->drawRect({0, 0, 30, 30}, SK_ColorBLUE);
         port->drawOval({10, 10, 20, 20}, SK_ColorWHITE);
         port->restore();
-        
+
         port->saveLayer({50, 50, 100, 100}, 0x80);
         port->drawRect({55, 55, 95, 95}, SK_ColorGREEN);
         port->restore();
diff --git a/samplecode/SampleCowboy.cpp b/samplecode/SampleCowboy.cpp
index 1191cd4..b1eec87 100644
--- a/samplecode/SampleCowboy.cpp
+++ b/samplecode/SampleCowboy.cpp
@@ -29,13 +29,13 @@
 
 protected:
     static constexpr auto kAnimationIterations = 5;
-    
+
     enum State {
         kZoomIn,
         kScroll,
         kZoomOut
     };
-    
+
     void onOnceBeforeDraw() override {
         fPath = GetResourcePath("Cowboy.svg");
         SkFILEStream svgStream(fPath.c_str());
@@ -79,7 +79,7 @@
                     canvas->concat(SkMatrix::MakeScale(fDelta));
                     break;
             }
-            
+
             fDom->render(canvas);
         }
     }
@@ -100,12 +100,12 @@
 
         return this->INHERITED::onQuery(evt);
     }
-    
+
     bool onAnimate(const SkAnimTimer& timer) override {
         if (!fDom) {
             return false;
         }
-        
+
         --fAnimationLoop;
         if (fAnimationLoop == 0) {
             fAnimationLoop = kAnimationIterations;
@@ -126,7 +126,7 @@
         }
         return true;
     }
-    
+
 private:
     sk_sp<SkSVGDOM> fDom;
     SkString        fPath;
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index 0fb5287..ec92fdf 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -334,7 +334,7 @@
         N = 4
     };
     SkPoint fPts[N];
-    
+
     FatStroke() : fClosed(false), fShowStroke(true), fShowHidden(false), fShowSkeleton(true),
                   fJoinType(0), fCapType(0)
     {
@@ -343,35 +343,35 @@
             fPts[i].fX = 20 + rand.nextUScalar1() * 640;
             fPts[i].fY = 20 + rand.nextUScalar1() * 480;
         }
-        
+
         fPtsPaint.setAntiAlias(true);
         fPtsPaint.setStrokeWidth(10);
         fPtsPaint.setStrokeCap(SkPaint::kRound_Cap);
-        
+
         fHiddenPaint.setAntiAlias(true);
         fHiddenPaint.setStyle(SkPaint::kStroke_Style);
         fHiddenPaint.setColor(0xFF0000FF);
-        
+
         fStrokePaint.setAntiAlias(true);
         fStrokePaint.setStyle(SkPaint::kStroke_Style);
         fStrokePaint.setStrokeWidth(50);
         fStrokePaint.setColor(0x8000FF00);
-        
+
         fSkeletonPaint.setAntiAlias(true);
         fSkeletonPaint.setStyle(SkPaint::kStroke_Style);
         fSkeletonPaint.setColor(SK_ColorRED);
     }
-    
+
     void toggle(bool& value) {
         value = !value;
         this->inval(nullptr);
     }
-    
+
     void toggle3(int& value) {
         value = (value + 1) % 3;
         this->inval(nullptr);
     }
-    
+
 protected:
     // overrides from SkEventSink
     bool onQuery(SkEvent* evt) override {
@@ -395,7 +395,7 @@
         }
         return this->INHERITED::onQuery(evt);
     }
-    
+
     void makePath(SkPath* path) {
         path->moveTo(fPts[0]);
         for (int i = 1; i < N; ++i) {
@@ -405,7 +405,7 @@
             path->close();
         }
     }
-    
+
     void onDrawContent(SkCanvas* canvas) override {
         canvas->drawColor(0xFFEEEEEE);
 
@@ -429,7 +429,7 @@
         }
         canvas->drawPoints(SkCanvas::kPoints_PointMode, N, fPts, fPtsPaint);
     }
-    
+
     bool onClick(Click* click) override {
         int32_t index;
         if (click->fMeta.findS32("index", &index)) {
@@ -440,7 +440,7 @@
         }
         return false;
     }
-    
+
     SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
         const SkScalar tol = 4;
         const SkRect r = SkRect::MakeXYWH(x - tol, y - tol, tol * 2, tol * 2);
@@ -453,7 +453,7 @@
         }
         return this->INHERITED::onFindClickHandler(x, y, modi);
     }
-    
+
 private:
     typedef SampleView INHERITED;
 };
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index 0c08fd7..9c82b4b 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -45,7 +45,7 @@
     ~PictFileView() override {
         this->freePictures();
     }
-    
+
     void freePictures() {
         for (int i = 0; i < kBBoxTypeCount; ++i) {
             SkSafeUnref(fPictures[i]);