| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 protected: | 34 protected: |
| 35 // overrides from SkEventSink | 35 // overrides from SkEventSink |
| 36 virtual bool onQuery(SkEvent* evt) { | 36 virtual bool onQuery(SkEvent* evt) { |
| 37 if (SampleCode::TitleQ(*evt)) { | 37 if (SampleCode::TitleQ(*evt)) { |
| 38 SampleCode::TitleR(evt, "Points"); | 38 SampleCode::TitleR(evt, "Points"); |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 return this->INHERITED::onQuery(evt); | 41 return this->INHERITED::onQuery(evt); |
| 42 } | 42 } |
| 43 | 43 |
| 44 static void fill_pts(SkPoint pts[], size_t n, SkMWCRandom* rand) { | 44 static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { |
| 45 for (size_t i = 0; i < n; i++) | 45 for (size_t i = 0; i < n; i++) |
| 46 pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); | 46 pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void onDrawContent(SkCanvas* canvas) { | 49 virtual void onDrawContent(SkCanvas* canvas) { |
| 50 canvas->translate(SK_Scalar1, SK_Scalar1); | 50 canvas->translate(SK_Scalar1, SK_Scalar1); |
| 51 | 51 |
| 52 SkMWCRandom rand; | 52 SkRandom rand; |
| 53 SkPaint p0, p1, p2, p3; | 53 SkPaint p0, p1, p2, p3; |
| 54 const size_t n = 99; | 54 const size_t n = 99; |
| 55 | 55 |
| 56 p0.setColor(SK_ColorRED); | 56 p0.setColor(SK_ColorRED); |
| 57 p1.setColor(SK_ColorGREEN); | 57 p1.setColor(SK_ColorGREEN); |
| 58 p2.setColor(SK_ColorBLUE); | 58 p2.setColor(SK_ColorBLUE); |
| 59 p3.setColor(SK_ColorWHITE); | 59 p3.setColor(SK_ColorWHITE); |
| 60 | 60 |
| 61 p0.setStrokeWidth(SkIntToScalar(4)); | 61 p0.setStrokeWidth(SkIntToScalar(4)); |
| 62 p2.setStrokeCap(SkPaint::kRound_Cap); | 62 p2.setStrokeCap(SkPaint::kRound_Cap); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 | 77 |
| 78 typedef SampleView INHERITED; | 78 typedef SampleView INHERITED; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 ////////////////////////////////////////////////////////////////////////////// | 81 ////////////////////////////////////////////////////////////////////////////// |
| 82 | 82 |
| 83 static SkView* MyFactory() { return new PointsView; } | 83 static SkView* MyFactory() { return new PointsView; } |
| 84 static SkViewRegister reg(MyFactory); | 84 static SkViewRegister reg(MyFactory); |
| OLD | NEW |