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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (SampleCode::TitleQ(*evt)) { | 51 if (SampleCode::TitleQ(*evt)) { |
52 SampleCode::TitleR(evt, "DegenerateTwoPtRadials"); | 52 SampleCode::TitleR(evt, "DegenerateTwoPtRadials"); |
53 return true; | 53 return true; |
54 } | 54 } |
55 return this->INHERITED::onQuery(evt); | 55 return this->INHERITED::onQuery(evt); |
56 } | 56 } |
57 | 57 |
58 virtual void onDrawContent(SkCanvas* canvas) { | 58 virtual void onDrawContent(SkCanvas* canvas) { |
59 fTime += SampleCode::GetAnimSecondsDelta(); | 59 fTime += SampleCode::GetAnimSecondsDelta(); |
60 SkScalar delta = fTime / 15.f; | 60 SkScalar delta = fTime / 15.f; |
61 int intPart = SkScalarFloor(delta); | 61 int intPart = SkScalarFloorToInt(delta); |
62 delta = delta - SK_Scalar1 * intPart; | 62 delta = delta - SK_Scalar1 * intPart; |
63 if (intPart % 2) { | 63 if (intPart % 2) { |
64 delta = SK_Scalar1 - delta; | 64 delta = SK_Scalar1 - delta; |
65 } | 65 } |
66 delta -= SK_ScalarHalf; | 66 delta -= SK_ScalarHalf; |
67 static const int DELTA_SCALE = 500; | 67 static const int DELTA_SCALE = 500; |
68 delta /= DELTA_SCALE; | 68 delta /= DELTA_SCALE; |
69 | 69 |
70 SkScalar w = SK_Scalar1 * 500; | 70 SkScalar w = SK_Scalar1 * 500; |
71 SkScalar h = SK_Scalar1 * 500; | 71 SkScalar h = SK_Scalar1 * 500; |
(...skipping 11 matching lines...) Expand all Loading... |
83 | 83 |
84 private: | 84 private: |
85 SkScalar fTime; | 85 SkScalar fTime; |
86 typedef SampleView INHERITED; | 86 typedef SampleView INHERITED; |
87 }; | 87 }; |
88 | 88 |
89 ////////////////////////////////////////////////////////////////////////////// | 89 ////////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; } | 91 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; } |
92 static SkViewRegister reg(MyFactory); | 92 static SkViewRegister reg(MyFactory); |
OLD | NEW |