| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #ifndef Viewer_DEFINED | 8 #ifndef Viewer_DEFINED | 
| 9 #define Viewer_DEFINED | 9 #define Viewer_DEFINED | 
| 10 | 10 | 
| 11 #include "sk_app/Application.h" | 11 #include "sk_app/Application.h" | 
| 12 #include "sk_app/CommandSet.h" | 12 #include "sk_app/CommandSet.h" | 
| 13 #include "sk_app/Window.h" | 13 #include "sk_app/Window.h" | 
| 14 #include "gm.h" | 14 #include "gm.h" | 
| 15 #include "SkAnimTimer.h" | 15 #include "SkAnimTimer.h" | 
| 16 #include "Slide.h" | 16 #include "Slide.h" | 
| 17 | 17 | 
| 18 class SkCanvas; | 18 class SkCanvas; | 
| 19 | 19 | 
| 20 class Viewer : public sk_app::Application { | 20 class Viewer : public sk_app::Application { | 
| 21 public: | 21 public: | 
| 22     Viewer(int argc, char** argv, void* platformData); | 22     Viewer(int argc, char** argv, void* platformData); | 
| 23     ~Viewer() override; | 23     ~Viewer() override; | 
| 24 | 24 | 
| 25     void onPaint(SkCanvas* canvas); | 25     void onPaint(SkCanvas* canvas); | 
| 26     void onIdle(double ms) override; | 26     void onIdle(double ms) override; | 
|  | 27     bool onTouch(int owner, sk_app::Window::InputState state, float x, float y); | 
| 27 | 28 | 
| 28 private: | 29 private: | 
| 29     void initSlides(); | 30     void initSlides(); | 
| 30     void updateTitle(); | 31     void updateTitle(); | 
| 31     void setupCurrentSlide(int previousSlide); | 32     void setupCurrentSlide(int previousSlide); | 
| 32 | 33 | 
| 33     void drawStats(SkCanvas* canvas); | 34     void drawStats(SkCanvas* canvas); | 
| 34 | 35 | 
| 35     void changeZoomLevel(float delta); | 36     void changeZoomLevel(float delta); | 
| 36     void updateMatrix(); | 37     SkMatrix computeMatrix(); | 
| 37 | 38 | 
| 38     sk_app::Window*        fWindow; | 39     sk_app::Window*        fWindow; | 
| 39 | 40 | 
| 40     static const int kMeasurementCount = 64;  // should be power of 2 for fast m
    od | 41     static const int kMeasurementCount = 64;  // should be power of 2 for fast m
    od | 
| 41     double fMeasurements[kMeasurementCount]; | 42     double fMeasurements[kMeasurementCount]; | 
| 42     int fCurrentMeasurement; | 43     int fCurrentMeasurement; | 
| 43 | 44 | 
| 44     SkAnimTimer            fAnimTimer; | 45     SkAnimTimer            fAnimTimer; | 
| 45     SkTArray<sk_sp<Slide>> fSlides; | 46     SkTArray<sk_sp<Slide>> fSlides; | 
| 46     int                    fCurrentSlide; | 47     int                    fCurrentSlide; | 
| 47 | 48 | 
| 48     bool                   fDisplayStats; | 49     bool                   fDisplayStats; | 
| 49 | 50 | 
| 50     // transform data | 51     // transform data | 
| 51     SkMatrix               fLocalMatrix; |  | 
| 52     SkScalar               fZoomCenterX; | 52     SkScalar               fZoomCenterX; | 
| 53     SkScalar               fZoomCenterY; | 53     SkScalar               fZoomCenterY; | 
| 54     SkScalar               fZoomLevel; | 54     SkScalar               fZoomLevel; | 
| 55     SkScalar               fZoomScale; | 55     SkScalar               fZoomScale; | 
| 56 | 56 | 
| 57     sk_app::CommandSet     fCommands; | 57     sk_app::CommandSet     fCommands; | 
|  | 58 | 
|  | 59     SkTouchGesture         fGesture; | 
| 58 }; | 60 }; | 
| 59 | 61 | 
| 60 | 62 | 
| 61 #endif | 63 #endif | 
| OLD | NEW | 
|---|