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 #include "SampleApp.h" | 7 #include "SampleApp.h" |
8 | 8 |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 SkScalar phaseInSec) { | 635 SkScalar phaseInSec) { |
636 if (!periodInSec) { | 636 if (!periodInSec) { |
637 return 0; | 637 return 0; |
638 } | 638 } |
639 double t = (double)gAnimTime / 1000.0 + phaseInSec; | 639 double t = (double)gAnimTime / 1000.0 + phaseInSec; |
640 t *= SkScalarToFloat(2 * SK_ScalarPI) / periodInSec; | 640 t *= SkScalarToFloat(2 * SK_ScalarPI) / periodInSec; |
641 amplitude = SK_ScalarHalf * amplitude; | 641 amplitude = SK_ScalarHalf * amplitude; |
642 return SkScalarMul(amplitude, SkDoubleToScalar(sin(t))) + amplitude; | 642 return SkScalarMul(amplitude, SkDoubleToScalar(sin(t))) + amplitude; |
643 } | 643 } |
644 | 644 |
645 GrContext* SampleCode::GetGr() { | |
646 return gSampleWindow ? gSampleWindow->getGrContext() : NULL; | |
647 } | |
648 | |
649 // some GMs rely on having a skiagm::GetGr function defined | |
650 namespace skiagm { | |
651 // FIXME: this should be moved into a header | |
652 GrContext* GetGr(); | |
653 GrContext* GetGr() { return SampleCode::GetGr(); } | |
654 } | |
655 | |
656 ////////////////////////////////////////////////////////////////////////////// | |
657 | |
658 enum TilingMode { | 645 enum TilingMode { |
659 kNo_Tiling, | 646 kNo_Tiling, |
660 kAbs_128x128_Tiling, | 647 kAbs_128x128_Tiling, |
661 kAbs_256x256_Tiling, | 648 kAbs_256x256_Tiling, |
662 kRel_4x4_Tiling, | 649 kRel_4x4_Tiling, |
663 kRel_1x16_Tiling, | 650 kRel_1x16_Tiling, |
664 kRel_16x1_Tiling, | 651 kRel_16x1_Tiling, |
665 | 652 |
666 kLast_TilingMode_Enum | 653 kLast_TilingMode_Enum |
667 }; | 654 }; |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 SkGraphics::Init(); | 2603 SkGraphics::Init(); |
2617 SkEvent::Init(); | 2604 SkEvent::Init(); |
2618 } | 2605 } |
2619 | 2606 |
2620 // FIXME: this should be in a header | 2607 // FIXME: this should be in a header |
2621 void application_term(); | 2608 void application_term(); |
2622 void application_term() { | 2609 void application_term() { |
2623 SkEvent::Term(); | 2610 SkEvent::Term(); |
2624 SkGraphics::Term(); | 2611 SkGraphics::Term(); |
2625 } | 2612 } |
OLD | NEW |