From 6ada0ba8c8cdc65e1d50168873466ee8f2c6b23f Mon Sep 17 00:00:00 2001 From: bsp2 Date: Thu, 25 Oct 2018 23:06:47 +0200 Subject: [PATCH] debug prints (commented out) --- src/app/RackRail.cpp | 4 ++++ src/app/RackScene.cpp | 1 + src/app/RackWidget.cpp | 1 + src/app/Toolbar.cpp | 1 + src/ui/ScrollWidget.cpp | 1 + src/widgets/Widget.cpp | 18 +++++++++--------- src/window.cpp | 31 ++++++++++++++++++++++++++++++- 7 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/app/RackRail.cpp b/src/app/RackRail.cpp index 8dc97e27..5efff9cd 100644 --- a/src/app/RackRail.cpp +++ b/src/app/RackRail.cpp @@ -6,6 +6,8 @@ namespace rack { void RackRail::draw(NVGcontext *vg) { const float railHeight = RACK_GRID_WIDTH; + // printf("xxx RackRail::draw: ENTER\n"); + // Background color nvgBeginPath(vg); nvgRect(vg, 0.0, 0.0, box.size.x, box.size.y); @@ -55,6 +57,8 @@ void RackRail::draw(NVGcontext *vg) { nvgFillColor(vg, nvgRGBf(1.0, 1.0, 1.0)); nvgFill(vg); } + + // printf("xxx RackRail::draw: LEAVE\n"); } diff --git a/src/app/RackScene.cpp b/src/app/RackScene.cpp index fb6d0637..a3ddf274 100644 --- a/src/app/RackScene.cpp +++ b/src/app/RackScene.cpp @@ -57,6 +57,7 @@ void RackScene::step() { } void RackScene::draw(NVGcontext *vg) { + // printf("xxx RackScene::draw\n"); Scene::draw(vg); } diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index 7491acfe..9a91c29f 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -659,6 +659,7 @@ void RackWidget::step() { } void RackWidget::draw(NVGcontext *vg) { + // printf("xxx RackWidget::draw\n"); Widget::draw(vg); } diff --git a/src/app/Toolbar.cpp b/src/app/Toolbar.cpp index 76ec69b5..18390638 100644 --- a/src/app/Toolbar.cpp +++ b/src/app/Toolbar.cpp @@ -507,6 +507,7 @@ Toolbar::Toolbar() { } void Toolbar::draw(NVGcontext *vg) { + // printf("xxx Toolbar::draw\n"); bndBackground(vg, 0.0, 0.0, box.size.x, box.size.y); bndBevel(vg, 0.0, 0.0, box.size.x, box.size.y); diff --git a/src/ui/ScrollWidget.cpp b/src/ui/ScrollWidget.cpp index 269566da..1b75f886 100644 --- a/src/ui/ScrollWidget.cpp +++ b/src/ui/ScrollWidget.cpp @@ -68,6 +68,7 @@ void ScrollWidget::scrollTo(Rect r) { } void ScrollWidget::draw(NVGcontext *vg) { + // printf("xxx ScrollWidget::draw\n"); nvgScissor(vg, 0, 0, box.size.x, box.size.y); Widget::draw(vg); nvgResetScissor(vg); diff --git a/src/widgets/Widget.cpp b/src/widgets/Widget.cpp index 189bdecb..30308d0c 100644 --- a/src/widgets/Widget.cpp +++ b/src/widgets/Widget.cpp @@ -109,20 +109,20 @@ void Widget::step() { } void Widget::draw(NVGcontext *vg) { - for (Widget *child : children) { + for (Widget *child : children) { // printf("xxx Widget::draw: 1 child=%p vg=%p\n", child, vg); - if (!child->visible) - continue; + if (!child->visible) + continue; // printf("xxx Widget::draw: 2 child=%p\n", child); - nvgSave(vg); - // printf("xxx Widget::draw: 3 child=%p\n", child); - nvgTranslate(vg, child->box.pos.x, child->box.pos.y); + nvgSave(vg); + // printf("xxx Widget::draw: 3 child=%p p=(%f; %f)\n", child, child->box.pos.x, child->box.pos.y); + nvgTranslate(vg, child->box.pos.x, child->box.pos.y); // printf("xxx Widget::draw: 4 child=%p\n", child); - child->draw(vg); + child->draw(vg); // printf("xxx Widget::draw: 5 child=%p\n", child); - nvgRestore(vg); + nvgRestore(vg); // printf("xxx Widget::draw: 6 child=%p\n", child); - } + } } #define RECURSE_EVENT_POSITION(_method) { \ diff --git a/src/window.cpp b/src/window.cpp index 5d0c325b..8b272c94 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -348,18 +348,28 @@ void renderGui() { // printf("xxx renderGui: ENTER\n"); lglw_window_size_get(global_ui->window.lglw, &width, &height); + // printf("xxx renderGui: 1 lglw=%p size=(%d; %d)\n", global_ui->window.lglw, width, height); + // Update and render nvgBeginFrame(global_ui->window.gVg, width, height, global_ui->window.gPixelRatio); + // printf("xxx renderGui: 2\n"); + nvgReset(global_ui->window.gVg); + // printf("xxx renderGui: 3\n"); nvgScale(global_ui->window.gVg, global_ui->window.gPixelRatio, global_ui->window.gPixelRatio); // printf("xxx renderGui: gScene->draw() BEGIN\n"); + // printf("xxx renderGui: 4\n"); global_ui->ui.gScene->draw(global_ui->window.gVg); // printf("xxx renderGui: gScene->draw() END\n"); + // printf("xxx renderGui: 5\n"); glViewport(0, 0, width, height); + // printf("xxx renderGui: 6\n"); glClearColor(0.0, 0.0, 0.0, 1.0); + // printf("xxx renderGui: 7\n"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + // printf("xxx renderGui: 8\n"); nvgEndFrame(global_ui->window.gVg); // printf("xxx renderGui: LEAVE\n"); } @@ -386,7 +396,7 @@ void windowInit() { lglw_glcontext_push(global_ui->window.lglw); printf("xxx vstrack_plugin:windowInit: 5\n"); - lglw_swap_interval_set(global_ui->window.lglw, 1); // can be overridden via settings.json:"vsync" property + global_ui->pending_swap_interval = 1; printf("xxx vstrack_plugin:windowInit: 6\n"); lglw_mouse_callback_set (global_ui->window.lglw, &lglw_mouse_cbk); @@ -479,9 +489,18 @@ void windowDestroy() { void vst2_editor_redraw(void) { // (note) the GL context is set by the caller + // printf("xxx vst2_editor_redraw: ENTER\n"); + + if(-1 != global_ui->pending_swap_interval) + { + lglw_swap_interval_set(global_ui->window.lglw, global_ui->pending_swap_interval); // can be overridden via settings.json:"vsync" property + global_ui->pending_swap_interval = -1; + } + global_ui->window.gGuiFrame++; // Find/validate hover param + // printf("xxx vst2_editor_redraw: 2 global_ui->param_info.last_param_widget=%p\n", global_ui->param_info.last_param_widget); if(NULL != global_ui->param_info.last_param_widget) { int uniqueParamId; @@ -541,6 +560,7 @@ void vst2_editor_redraw(void) { } } + // printf("xxx vst2_editor_redraw: 3\n"); #if 0 // Set window title @@ -565,15 +585,24 @@ void vst2_editor_redraw(void) { global_ui->window.gWindowRatio = 1.0f; global_ui->ui.gScene->box.size = Vec(width, height); + // printf("xxx vst2_editor_redraw: 4\n"); + // Step scene global_ui->ui.gScene->step(); + // printf("xxx vst2_editor_redraw: 5\n"); + // Render renderGui(); + // printf("xxx vst2_editor_redraw: 6\n"); + // Present glFlush(); + // printf("xxx vst2_editor_redraw: 7\n"); lglw_swap_buffers(global_ui->window.lglw); + + // printf("xxx vst2_editor_redraw: LEAVE\n"); } void windowCursorLock() {