| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 fRect.set(0, 0, SkIntToScalar(200), SkIntToScalar(200)); | 93 fRect.set(0, 0, SkIntToScalar(200), SkIntToScalar(200)); |
| 94 fRect.offset(SkIntToScalar(20), SkIntToScalar(20)); | 94 fRect.offset(SkIntToScalar(20), SkIntToScalar(20)); |
| 95 fAnimatingDrawable = SkNEW_ARGS(MyDrawable, (fRect)); | 95 fAnimatingDrawable = SkNEW_ARGS(MyDrawable, (fRect)); |
| 96 | 96 |
| 97 SkPictureRecorder recorder; | 97 SkPictureRecorder recorder; |
| 98 this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500))); | 98 this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500))); |
| 99 fRootDrawable = recorder.EXPERIMENTAL_endRecordingAsDrawable(); | 99 fRootDrawable = recorder.EXPERIMENTAL_endRecordingAsDrawable(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 virtual ~ArcsView() SK_OVERRIDE { | 102 ~ArcsView() SK_OVERRIDE { |
| 103 fAnimatingDrawable->unref(); | 103 fAnimatingDrawable->unref(); |
| 104 fRootDrawable->unref(); | 104 fRootDrawable->unref(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 // overrides from SkEventSink | 108 // overrides from SkEventSink |
| 109 bool onQuery(SkEvent* evt) SK_OVERRIDE { | 109 bool onQuery(SkEvent* evt) SK_OVERRIDE { |
| 110 if (SampleCode::TitleQ(*evt)) { | 110 if (SampleCode::TitleQ(*evt)) { |
| 111 SampleCode::TitleR(evt, "Arcs"); | 111 SampleCode::TitleR(evt, "Arcs"); |
| 112 return true; | 112 return true; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 private: | 209 private: |
| 210 SkScalar fSweep; | 210 SkScalar fSweep; |
| 211 | 211 |
| 212 typedef SampleView INHERITED; | 212 typedef SampleView INHERITED; |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 ////////////////////////////////////////////////////////////////////////////// | 215 ////////////////////////////////////////////////////////////////////////////// |
| 216 | 216 |
| 217 static SkView* MyFactory() { return new ArcsView; } | 217 static SkView* MyFactory() { return new ArcsView; } |
| 218 static SkViewRegister reg(MyFactory); | 218 static SkViewRegister reg(MyFactory); |
| OLD | NEW |