add fatstroke sample
authorMike Reed <reed@google.com>
Thu, 15 Dec 2016 15:23:42 +0000 (10:23 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 15 Dec 2016 16:28:57 +0000 (16:28 +0000)
BUG=skia:

Change-Id: I7d5d2c76cba8ac566e2900697b913ea18e7695dd
Reviewed-on: https://skia-review.googlesource.com/6120
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>

samplecode/SamplePath.cpp

index 40c350fbd24716418abca60526117c2b7b608b47..6438dcfb7d4849f3922a4725c804e32ce1bd6d60 100644 (file)
@@ -338,6 +338,7 @@ DEF_SAMPLE( return new ArcToView; )
 class FatStroke : public SampleView {
     bool fClosed, fShowStroke, fShowHidden, fShowSkeleton;
     int  fJoinType, fCapType;
+    float fWidth = 30;
     SkPaint fPtsPaint, fHiddenPaint, fSkeletonPaint, fStrokePaint;
 public:
     enum {
@@ -398,6 +399,8 @@ protected:
                 case '4': this->toggle3(fJoinType); return true;
                 case '5': this->toggle3(fCapType); return true;
                 case '6': this->toggle(fClosed); return true;
+                case '-': fWidth -= 5; this->inval(nullptr); return true;
+                case '=': fWidth += 5; this->inval(nullptr); return true;
                 default: break;
             }
         }
@@ -420,6 +423,7 @@ protected:
         SkPath path;
         this->makePath(&path);
 
+        fStrokePaint.setStrokeWidth(fWidth);
         fStrokePaint.setStrokeJoin((SkPaint::Join)fJoinType);
         fStrokePaint.setStrokeCap((SkPaint::Cap)fCapType);