aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-07-25 15:01:53 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-26 16:05:19 +0000
commitd902042c7324d2d648ceedb242f96f4fdb8d04eb (patch)
tree379f893dcbe409376d08c062977f0197893d84a2 /tools
parent847068ce833f2409ae2f5e39d14616899b24e1a5 (diff)
Fix viewer state that has empty state/option
If the value or option is empty (as was for kInstancedRenderingStateName), our Android Java application will throw exception and skip the remaining state objects. That would result in missing "Softkeys" and "FPS" for Raster backend in Android Viewer app. Bug: skia: Change-Id: I6f600bbb94509ca5389eac2d681304a00427ecdb Reviewed-on: https://skia-review.googlesource.com/26527 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/viewer/Viewer.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 72c2f6cb40..6f01f2df01 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1320,13 +1320,12 @@ void Viewer::updateUIState() {
// Instanced rendering state
Json::Value instState(Json::objectValue);
instState[kName] = kInstancedRenderingStateName;
+ instState[kValue] = kOFF;
+ instState[kOptions] = Json::Value(Json::arrayValue);
if (ctx) {
if (fWindow->getRequestedDisplayParams().fGrContextOptions.fEnableInstancedRendering) {
instState[kValue] = kON;
- } else {
- instState[kValue] = kOFF;
}
- instState[kOptions] = Json::Value(Json::arrayValue);
instState[kOptions].append(kOFF);
instState[kOptions].append(kON);
}