| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 switch (uni) { | 225 switch (uni) { |
| 226 case 'C': fDrawable->toggleUseColors(); this->inval(nullptr); re
turn true; | 226 case 'C': fDrawable->toggleUseColors(); this->inval(nullptr); re
turn true; |
| 227 default: break; | 227 default: break; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 return this->INHERITED::onQuery(evt); | 230 return this->INHERITED::onQuery(evt); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void onDrawContent(SkCanvas* canvas) override { | 233 void onDrawContent(SkCanvas* canvas) override { |
| 234 canvas->drawDrawable(fDrawable); | 234 canvas->drawDrawable(fDrawable); |
| 235 this->inval(nullptr); | |
| 236 } | 235 } |
| 237 | 236 |
| 237 bool onAnimate(const SkAnimTimer&) override { |
| 238 return true; |
| 239 } |
| 238 #if 0 | 240 #if 0 |
| 239 // TODO: switch over to use this for our animation | 241 // TODO: switch over to use this for our animation |
| 240 bool onAnimate(const SkAnimTimer& timer) override { | 242 bool onAnimate(const SkAnimTimer& timer) override { |
| 241 SkScalar angle = SkDoubleToScalar(fmod(timer.secs() * 360 / 24, 360)); | 243 SkScalar angle = SkDoubleToScalar(fmod(timer.secs() * 360 / 24, 360)); |
| 242 fAnimatingDrawable->setSweep(angle); | 244 fAnimatingDrawable->setSweep(angle); |
| 243 return true; | 245 return true; |
| 244 } | 246 } |
| 245 #endif | 247 #endif |
| 246 | 248 |
| 247 private: | 249 private: |
| 248 typedef SampleView INHERITED; | 250 typedef SampleView INHERITED; |
| 249 }; | 251 }; |
| 250 | 252 |
| 251 ////////////////////////////////////////////////////////////////////////////// | 253 ////////////////////////////////////////////////////////////////////////////// |
| 252 | 254 |
| 253 DEF_SAMPLE( return new DrawAtlasView("DrawAtlas", draw_atlas); ) | 255 DEF_SAMPLE( return new DrawAtlasView("DrawAtlas", draw_atlas); ) |
| 254 DEF_SAMPLE( return new DrawAtlasView("DrawAtlasSim", draw_atlas_sim); ) | 256 DEF_SAMPLE( return new DrawAtlasView("DrawAtlasSim", draw_atlas_sim); ) |
| OLD | NEW |