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

Unified Diff: tools/viewer/Viewer.cpp

Issue 2016343002: Revert of Add drawer with state information (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/viewer/Viewer.h ('k') | tools/viewer/sk_app/Window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/Viewer.cpp
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 6519a3c8be59007e89ee882c6739638fa61a8291..c4b8b26dc51e3fda5a43a66962f5dba0a397de0d 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -33,12 +33,6 @@
Viewer* viewer = reinterpret_cast<Viewer*>(userData);
return viewer->onTouch(owner, state, x, y);
-}
-
-static void on_ui_state_changed_handler(const SkString& stateName, const SkString& stateValue, void* userData) {
- Viewer* viewer = reinterpret_cast<Viewer*>(userData);
-
- return viewer->onUIStateChanged(stateName, stateValue);
}
DEFINE_bool2(fullscreen, f, true, "Run fullscreen.");
@@ -59,12 +53,6 @@
" [Vulkan]"
};
-const char* kName = "name";
-const char* kValue = "value";
-const char* kOptions = "options";
-const char* kSlideStateName = "Slide";
-const char* kBackendStateName = "Backend";
-
Viewer::Viewer(int argc, char** argv, void* platformData)
: fCurrentMeasurement(0)
, fDisplayStats(false)
@@ -91,7 +79,6 @@
fCommands.attach(fWindow);
fWindow->registerPaintFunc(on_paint_handler, this);
fWindow->registerTouchFunc(on_touch_handler, this);
- fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this);
// add key-bindings
fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() {
@@ -226,10 +213,6 @@
}
void Viewer::setupCurrentSlide(int previousSlide) {
- if (fCurrentSlide == previousSlide) {
- return; // no change; do nothing
- }
-
fGesture.reset();
fDefaultMatrix.reset();
fDefaultMatrixInv.reset();
@@ -252,7 +235,6 @@
}
this->updateTitle();
- this->updateUIState();
fSlides[fCurrentSlide]->load();
if (previousSlide >= 0) {
fSlides[previousSlide]->unload();
@@ -400,49 +382,3 @@
fWindow->inval();
}
}
-
-void Viewer::updateUIState() {
- Json::Value slideState(Json::objectValue);
- slideState[kName] = kSlideStateName;
- slideState[kValue] = fSlides[fCurrentSlide]->getName().c_str();
- Json::Value allSlideNames(Json::arrayValue);
- for(auto slide : fSlides) {
- allSlideNames.append(Json::Value(slide->getName().c_str()));
- }
- slideState[kOptions] = allSlideNames;
-
- // This state is currently a demo for the one without options.
- // We will be able to change the backend too.
- Json::Value backendState(Json::objectValue);
- backendState[kName] = kBackendStateName;
- backendState[kValue] = fBackendType == sk_app::Window::kVulkan_BackendType ?
- "Vulkan" : "Other than Vulkan";
- backendState[kOptions] = Json::Value(Json::arrayValue);
-
- Json::Value state(Json::arrayValue);
- state.append(slideState);
- state.append(backendState);
-
- fWindow->setUIState(state);
-}
-
-void Viewer::onUIStateChanged(const SkString& stateName, const SkString& stateValue) {
- // Currently, we only recognize the Slide state
- if (stateName.equals(kSlideStateName)) {
- int previousSlide = fCurrentSlide;
- fCurrentSlide = 0;
- for(auto slide : fSlides) {
- if (slide->getName().equals(stateValue)) {
- setupCurrentSlide(previousSlide);
- break;
- }
- fCurrentSlide++;
- }
- if (fCurrentSlide >= fSlides.count()) {
- fCurrentSlide = previousSlide;
- SkDebugf("Slide not found: %s", stateValue.c_str());
- }
- } else {
- SkDebugf("Unknown stateName: %s", stateName.c_str());
- }
-}
« no previous file with comments | « tools/viewer/Viewer.h ('k') | tools/viewer/sk_app/Window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698