| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
| 10 #include "SkView.h" | 10 #include "SkView.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 SkPaint paint; | 76 SkPaint paint; |
| 77 if (fShaders.count() > 0) { | 77 if (fShaders.count() > 0) { |
| 78 bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0; | 78 bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0; |
| 79 if (frontFace != fFrontFace) { | 79 if (frontFace != fFrontFace) { |
| 80 fFrontFace = frontFace; | 80 fFrontFace = frontFace; |
| 81 fShaderIndex = (fShaderIndex + 1) % fShaders.count(); | 81 fShaderIndex = (fShaderIndex + 1) % fShaders.count(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 paint.setAntiAlias(true); | 84 paint.setAntiAlias(true); |
| 85 paint.setShader(fShaders[fShaderIndex]); | 85 paint.setShader(fShaders[fShaderIndex]); |
| 86 paint.setFilterLevel(SkPaint::kLow_FilterLevel); | 86 paint.setFilterQuality(kLow_SkFilterQuality); |
| 87 SkRect r = { -150, -150, 150, 150 }; | 87 SkRect r = { -150, -150, 150, 150 }; |
| 88 canvas->drawRoundRect(r, 30, 30, paint); | 88 canvas->drawRoundRect(r, 30, 30, paint); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { | 92 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { |
| 93 if (timer.isStopped()) { | 93 if (timer.isStopped()) { |
| 94 fRY = 0; | 94 fRY = 0; |
| 95 } else { | 95 } else { |
| 96 fRY = timer.scaled(90, 360); | 96 fRY = timer.scaled(90, 360); |
| 97 } | 97 } |
| 98 return true; | 98 return true; |
| 99 } | 99 } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 SkScalar fRX, fRY, fRZ; | 102 SkScalar fRX, fRY, fRZ; |
| 103 typedef SampleView INHERITED; | 103 typedef SampleView INHERITED; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 ////////////////////////////////////////////////////////////////////////////// | 106 ////////////////////////////////////////////////////////////////////////////// |
| 107 | 107 |
| 108 static SkView* MyFactory() { return new CameraView; } | 108 static SkView* MyFactory() { return new CameraView; } |
| 109 static SkViewRegister reg(MyFactory); | 109 static SkViewRegister reg(MyFactory); |
| OLD | NEW |