Update ImGui to v1.62 (June 22, 2018)
He's been steadily adding features and fixing bugs, figured it was time
to fetch a new version.
Change-Id: I496aefc0a1b60c3be5c89a0e58dc64811fccc77e
Reviewed-on: https://skia-review.googlesource.com/138591
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/DEPS b/DEPS
index b84f171..e15aa41 100644
--- a/DEPS
+++ b/DEPS
@@ -15,7 +15,7 @@
"third_party/externals/googletest" : "https://android.googlesource.com/platform/external/googletest@dd43b9998e9a44a579a7aba6c1309407d1a5ed95",
"third_party/externals/harfbuzz" : "https://skia.googlesource.com/third_party/harfbuzz.git@1.4.2",
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@ec9c1133693148470ffe2e5e53576998e3650c1d",
- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@6384eee34f08cb7eab8d835043e1738e4adcdf75",
+ "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@00418d13e369bf53cc4b8f817eb10b8ce65f0904",
# TODO: remove jsoncpp after migrating clients to SkJSON
"third_party/externals/jsoncpp" : "https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git@1.0.0",
"third_party/externals/libjpeg-turbo" : "https://skia.googlesource.com/external/github.com/libjpeg-turbo/libjpeg-turbo.git@26f109290dc4ffc9c522d9f5d5a7d5d1ee2c0e0a",
diff --git a/tools/viewer/ImGuiLayer.cpp b/tools/viewer/ImGuiLayer.cpp
index e55ac9c..fe55a61 100644
--- a/tools/viewer/ImGuiLayer.cpp
+++ b/tools/viewer/ImGuiLayer.cpp
@@ -22,6 +22,7 @@
ImGuiLayer::ImGuiLayer() {
// ImGui initialization:
+ ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
// Keymap...
@@ -59,6 +60,10 @@
io.Fonts->TexID = &fFontPaint;
}
+ImGuiLayer::~ImGuiLayer() {
+ ImGui::DestroyContext();
+}
+
void ImGuiLayer::onAttach(Window* window) {
fWindow = window;
}
diff --git a/tools/viewer/ImGuiLayer.h b/tools/viewer/ImGuiLayer.h
index 1cefcd4..d9e1571 100644
--- a/tools/viewer/ImGuiLayer.h
+++ b/tools/viewer/ImGuiLayer.h
@@ -16,6 +16,7 @@
class ImGuiLayer : public sk_app::Window::Layer {
public:
ImGuiLayer();
+ ~ImGuiLayer() override;
typedef std::function<void(SkCanvas*)> SkiaWidgetFunc;
void skiaWidget(const ImVec2& size, SkiaWidgetFunc func);
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 3675cc4..81c1851 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1418,13 +1418,13 @@
void Viewer::drawImGui() {
// Support drawing the ImGui demo window. Superfluous, but gives a good idea of what's possible
if (fShowImGuiTestWindow) {
- ImGui::ShowTestWindow(&fShowImGuiTestWindow);
+ ImGui::ShowDemoWindow(&fShowImGuiTestWindow);
}
if (fShowImGuiDebugWindow) {
// We have some dynamic content that sizes to fill available size. If the scroll bar isn't
// always visible, we can end up in a layout feedback loop.
- ImGui::SetNextWindowSize(ImVec2(400, 400), ImGuiSetCond_FirstUseEver);
+ ImGui::SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);
DisplayParams params = fWindow->getRequestedDisplayParams();
bool paramsChanged = false;
if (ImGui::Begin("Tools", &fShowImGuiDebugWindow,
@@ -1827,7 +1827,8 @@
}
if (fShowZoomWindow && fLastImage) {
- if (ImGui::Begin("Zoom", &fShowZoomWindow, ImVec2(200, 200))) {
+ ImGui::SetNextWindowSize(ImVec2(200, 200), ImGuiCond_FirstUseEver);
+ if (ImGui::Begin("Zoom", &fShowZoomWindow)) {
static int zoomFactor = 8;
if (ImGui::Button("<<")) {
zoomFactor = SkTMax(zoomFactor / 2, 4);