diff options
| author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:19:56 +0000 |
|---|---|---|
| committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:19:56 +0000 |
| commit | ae933ce0ea5fd9d21cb6ef2cee7e729d32690aac (patch) | |
| tree | 62d80e33b16679d01454cf814977a7030d3a5462 /samplecode/SampleCull.cpp | |
| parent | d6176b0dcacb124539e0cfd051e6d93a9782f020 (diff) | |
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6475053
git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleCull.cpp')
| -rw-r--r-- | samplecode/SampleCull.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/samplecode/SampleCull.cpp b/samplecode/SampleCull.cpp index 778d0fc6c9..18d9bdcaa0 100644 --- a/samplecode/SampleCull.cpp +++ b/samplecode/SampleCull.cpp @@ -19,7 +19,7 @@ static void addbump(SkPath* path, const SkPoint pts[2], SkScalar bump) { SkVector tang; - + tang.setLength(pts[1].fX - pts[0].fX, pts[1].fY - pts[0].fY, bump); path->lineTo(SkScalarHalf(pts[0].fX + pts[1].fX) - tang.fY, @@ -31,7 +31,7 @@ static void subdivide(SkPath* path, SkScalar bump) { SkPath::Iter iter(*path, false); SkPoint pts[4]; SkPath tmp; - + for (;;) switch (iter.next(pts)) { case SkPath::kMove_Verb: @@ -90,7 +90,7 @@ FINISHED: break; } } - + FINISHED2: *count = n; return array; @@ -102,11 +102,11 @@ static SkScalar nextScalarRange(SkRandom& rand, SkScalar min, SkScalar max) { class CullView : public SampleView { public: - CullView() { + CullView() { fClip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); - + SkRandom rand; - + for (int i = 0; i < 50; i++) { SkScalar x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2); SkScalar y = nextScalarRange(rand, -fClip.height()*1, fClip.height()*2); @@ -115,16 +115,16 @@ public: else fPath.lineTo(x, y); } - + SkScalar bump = fClip.width()/8; subdivide(&fPath, bump); subdivide(&fPath, bump); subdivide(&fPath, bump); fPoints = getpts(fPath, &fPtCount); - + this->setBGColor(0xFFDDDDDD); } - + virtual ~CullView() { delete[] fPoints; } @@ -138,7 +138,7 @@ protected: } return this->INHERITED::onQuery(evt); } - + virtual void onDrawContent(SkCanvas* canvas) { SkAutoCanvasRestore ar(canvas, true); @@ -148,7 +148,7 @@ protected: // canvas->scale(SK_Scalar1*3, SK_Scalar1*3, 0, 0); SkPaint paint; - + // paint.setAntiAliasOn(true); paint.setStyle(SkPaint::kStroke_Style); @@ -165,21 +165,21 @@ protected: SkPath tmp; SkIRect iclip; fClip.round(&iclip); - + SkCullPointsPath cpp(iclip, &tmp); - + cpp.moveTo(fPoints[0].fX, fPoints[0].fY); for (int i = 0; i < fPtCount; i++) cpp.lineTo(fPoints[i].fX, fPoints[i].fY); - + paint.setColor(SK_ColorRED); paint.setStrokeWidth(SkIntToScalar(3)); paint.setStrokeJoin(SkPaint::kRound_Join); canvas->drawPath(tmp, paint); - + this->inval(NULL); } - + private: SkRect fClip; SkIPoint* fPoints; |
