Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tools/viewer/Viewer.h

Issue 2004633002: Add drawer with state information (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Format_old Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string>
12
11 #include "sk_app/Application.h" 13 #include "sk_app/Application.h"
12 #include "sk_app/CommandSet.h" 14 #include "sk_app/CommandSet.h"
13 #include "sk_app/Window.h" 15 #include "sk_app/Window.h"
14 #include "gm.h" 16 #include "gm.h"
15 #include "SkAnimTimer.h" 17 #include "SkAnimTimer.h"
16 #include "Slide.h" 18 #include "Slide.h"
19 #include "SkJSONCPP.h"
17 20
18 class SkCanvas; 21 class SkCanvas;
19 22
20 class Viewer : public sk_app::Application { 23 class Viewer : public sk_app::Application {
21 public: 24 public:
22 Viewer(int argc, char** argv, void* platformData); 25 Viewer(int argc, char** argv, void* platformData);
23 ~Viewer() override; 26 ~Viewer() override;
24 27
25 void onPaint(SkCanvas* canvas); 28 void onPaint(SkCanvas* canvas);
26 void onIdle(double ms) override; 29 void onIdle(double ms) override;
27 bool onTouch(int owner, sk_app::Window::InputState state, float x, float y); 30 bool onTouch(int owner, sk_app::Window::InputState state, float x, float y);
31 void onSet(const SkString& stateName, const SkString& stateValue);
28 32
29 private: 33 private:
30 void initSlides(); 34 void initSlides();
31 void updateTitle(); 35 void updateTitle();
32 void setupCurrentSlide(int previousSlide); 36 void setupCurrentSlide(int previousSlide);
33 37
38 Json::Value getStateJson() const;
39
34 void drawStats(SkCanvas* canvas); 40 void drawStats(SkCanvas* canvas);
35 41
36 void changeZoomLevel(float delta); 42 void changeZoomLevel(float delta);
37 SkMatrix computeMatrix(); 43 SkMatrix computeMatrix();
38 44
39 sk_app::Window* fWindow; 45 sk_app::Window* fWindow;
40 46
41 static const int kMeasurementCount = 64; // should be power of 2 for fast m od 47 static const int kMeasurementCount = 64; // should be power of 2 for fast m od
42 double fMeasurements[kMeasurementCount]; 48 double fMeasurements[kMeasurementCount];
43 int fCurrentMeasurement; 49 int fCurrentMeasurement;
(...skipping 16 matching lines...) Expand all
60 66
61 SkTouchGesture fGesture; 67 SkTouchGesture fGesture;
62 68
63 // identity unless the window initially scales the content to fit the screen . 69 // identity unless the window initially scales the content to fit the screen .
64 SkMatrix fDefaultMatrix; 70 SkMatrix fDefaultMatrix;
65 SkMatrix fDefaultMatrixInv; 71 SkMatrix fDefaultMatrixInv;
66 }; 72 };
67 73
68 74
69 #endif 75 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698