aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-06-29 14:30:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-29 18:58:57 +0000
commit7197e05eae34dce1c65c56a92b75b29b645d0d5d (patch)
treec51df7e7cc29d93e8e9c89491ea51887213f104b
parent0c3ceb2a1438662906de17f46a7e2344b91c1fba (diff)
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>
-rw-r--r--DEPS2
-rw-r--r--tools/viewer/ImGuiLayer.cpp5
-rw-r--r--tools/viewer/ImGuiLayer.h1
-rw-r--r--tools/viewer/Viewer.cpp7
4 files changed, 11 insertions, 4 deletions
diff --git a/DEPS b/DEPS
index b84f171342..e15aa41312 100644
--- a/DEPS
+++ b/DEPS
@@ -15,7 +15,7 @@ deps = {
"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 e55ac9c9c6..fe55a61279 100644
--- a/tools/viewer/ImGuiLayer.cpp
+++ b/tools/viewer/ImGuiLayer.cpp
@@ -22,6 +22,7 @@ using namespace sk_app;
ImGuiLayer::ImGuiLayer() {
// ImGui initialization:
+ ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
// Keymap...
@@ -59,6 +60,10 @@ ImGuiLayer::ImGuiLayer() {
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 1cefcd4097..d9e1571b60 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 3675cc4fe2..81c1851783 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1418,13 +1418,13 @@ static bool ImGui_DragQuad(SkPoint* pts) {
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 @@ void Viewer::drawImGui() {
}
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);