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 #include "Viewer.h" | 8 #include "Viewer.h" |
9 | 9 |
10 #include "GMSlide.h" | 10 #include "GMSlide.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 DEFINE_string(jpgs, "/data/local/tmp/skia", "Directory to read jpgs from."); | 59 DEFINE_string(jpgs, "/data/local/tmp/skia", "Directory to read jpgs from."); |
60 DEFINE_bool(vulkan, false, "Run with Vulkan."); | 60 DEFINE_bool(vulkan, false, "Run with Vulkan."); |
61 #else | 61 #else |
62 DEFINE_string(skps, "skps", "Directory to read skps from."); | 62 DEFINE_string(skps, "skps", "Directory to read skps from."); |
63 DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); | 63 DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); |
64 DEFINE_bool(vulkan, true, "Run with Vulkan."); | 64 DEFINE_bool(vulkan, true, "Run with Vulkan."); |
65 #endif | 65 #endif |
66 | 66 |
67 const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = { | 67 const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = { |
68 " [OpenGL]", | 68 " [OpenGL]", |
69 #ifdef SK_VULKAN | |
70 " [Vulkan]", | 69 " [Vulkan]", |
71 #endif | |
72 " [Raster]" | 70 " [Raster]" |
73 }; | 71 }; |
74 | 72 |
75 const char* kName = "name"; | 73 const char* kName = "name"; |
76 const char* kValue = "value"; | 74 const char* kValue = "value"; |
77 const char* kOptions = "options"; | 75 const char* kOptions = "options"; |
78 const char* kSlideStateName = "Slide"; | 76 const char* kSlideStateName = "Slide"; |
79 const char* kBackendStateName = "Backend"; | 77 const char* kBackendStateName = "Backend"; |
80 const char* kSoftkeyStateName = "Softkey"; | 78 const char* kSoftkeyStateName = "Softkey"; |
81 const char* kSoftkeyHint = "Please select a softkey"; | 79 const char* kSoftkeyHint = "Please select a softkey"; |
82 const char* kFpsStateName = "FPS"; | 80 const char* kFpsStateName = "FPS"; |
83 const char* kSplitScreenStateName = "Split screen"; | 81 const char* kSplitScreenStateName = "Split screen"; |
84 const char* kON = "ON"; | 82 const char* kON = "ON"; |
85 const char* kOFF = "OFF"; | 83 const char* kOFF = "OFF"; |
86 | 84 |
87 Viewer::Viewer(int argc, char** argv, void* platformData) | 85 Viewer::Viewer(int argc, char** argv, void* platformData) |
88 : fCurrentMeasurement(0) | 86 : fCurrentMeasurement(0) |
89 , fDisplayStats(false) | 87 , fDisplayStats(false) |
90 , fSplitScreen(false) | 88 , fSplitScreen(false) |
91 , fBackendType(sk_app::Window::kNativeGL_BackendType) | 89 , fBackendType(sk_app::Window::kVulkan_BackendType) |
92 , fZoomCenterX(0.0f) | 90 , fZoomCenterX(0.0f) |
93 , fZoomCenterY(0.0f) | 91 , fZoomCenterY(0.0f) |
94 , fZoomLevel(0.0f) | 92 , fZoomLevel(0.0f) |
95 , fZoomScale(SK_Scalar1) | 93 , fZoomScale(SK_Scalar1) |
96 { | 94 { |
97 memset(fMeasurements, 0, sizeof(fMeasurements)); | 95 memset(fMeasurements, 0, sizeof(fMeasurements)); |
98 | 96 |
99 SkDebugf("Command line arguments: "); | 97 SkDebugf("Command line arguments: "); |
100 for (int i = 1; i < argc; ++i) { | 98 for (int i = 1; i < argc; ++i) { |
101 SkDebugf("%s ", argv[i]); | 99 SkDebugf("%s ", argv[i]); |
102 } | 100 } |
103 SkDebugf("\n"); | 101 SkDebugf("\n"); |
104 | 102 |
105 SkCommandLineFlags::Parse(argc, argv); | 103 SkCommandLineFlags::Parse(argc, argv); |
106 | 104 |
107 #ifdef SK_VULKAN | |
108 fBackendType = FLAGS_vulkan ? sk_app::Window::kVulkan_BackendType | 105 fBackendType = FLAGS_vulkan ? sk_app::Window::kVulkan_BackendType |
109 : sk_app::Window::kNativeGL_BackendType; | 106 : sk_app::Window::kNativeGL_BackendType; |
110 #endif | 107 |
111 fWindow = Window::CreateNativeWindow(platformData); | 108 fWindow = Window::CreateNativeWindow(platformData); |
112 fWindow->attach(fBackendType, DisplayParams()); | 109 fWindow->attach(fBackendType, DisplayParams()); |
113 | 110 |
114 // register callbacks | 111 // register callbacks |
115 fCommands.attach(fWindow); | 112 fCommands.attach(fWindow); |
116 fWindow->registerPaintFunc(on_paint_handler, this); | 113 fWindow->registerPaintFunc(on_paint_handler, this); |
117 fWindow->registerTouchFunc(on_touch_handler, this); | 114 fWindow->registerTouchFunc(on_touch_handler, this); |
118 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); | 115 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); |
119 | 116 |
120 // add key-bindings | 117 // add key-bindings |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 bool newSplitScreen = stateValue.equals(kON); | 559 bool newSplitScreen = stateValue.equals(kON); |
563 if (newSplitScreen != fSplitScreen) { | 560 if (newSplitScreen != fSplitScreen) { |
564 fSplitScreen = newSplitScreen; | 561 fSplitScreen = newSplitScreen; |
565 fWindow->inval(); | 562 fWindow->inval(); |
566 updateUIState(); | 563 updateUIState(); |
567 } | 564 } |
568 } else { | 565 } else { |
569 SkDebugf("Unknown stateName: %s", stateName.c_str()); | 566 SkDebugf("Unknown stateName: %s", stateName.c_str()); |
570 } | 567 } |
571 } | 568 } |
OLD | NEW |