summaryrefslogtreecommitdiff
path: root/plugingui/widget.cc
diff options
context:
space:
mode:
authorLars Muldjord <muldjordlars@gmail.com>2017-03-23 19:22:38 +0100
committerLars Muldjord <muldjordlars@gmail.com>2017-03-23 19:22:38 +0100
commit889070f5c84f67cb52a5038fe93aca6234bbc360 (patch)
tree5c9ccdac1c8e7c13e501c89b2fbbaffa04340391 /plugingui/widget.cc
parent83745f8bf86d22936c5c2c7becc86885119f5d29 (diff)
parent494e7218597a6cd94902b3ae6f827e74b41c00b0 (diff)
Merge branch 'master' of http://git.drumgizmo.org/drumgizmo
Diffstat (limited to 'plugingui/widget.cc')
-rw-r--r--plugingui/widget.cc49
1 files changed, 42 insertions, 7 deletions
diff --git a/plugingui/widget.cc b/plugingui/widget.cc
index 7d92a22..00acfbf 100644
--- a/plugingui/widget.cc
+++ b/plugingui/widget.cc
@@ -42,6 +42,9 @@ Widget::Widget(Widget* parent)
parent->addChild(this);
_window = parent->window();
}
+
+ pixbuf.x = translateToWindowX();
+ pixbuf.y = translateToWindowY();
}
Widget::~Widget()
@@ -64,12 +67,14 @@ void Widget::hide()
void Widget::setVisible(bool visible)
{
- _visible = visible;
-
- if(visible)
+ if(_visible == visible)
{
- redraw();
+ return;
}
+
+ _visible = visible;
+ pixbuf.visible = visible;
+ redraw();
}
bool Widget::visible() const
@@ -130,7 +135,20 @@ void Widget::resize(std::size_t width, std::size_t height)
_width = width;
_height = height;
+
+ // Store old size/position in pixelbuffer for rendering invalidation.
+ if(!pixbuf.has_last)
+ {
+ pixbuf.last_width = pixbuf.width;
+ pixbuf.last_height = pixbuf.height;
+ pixbuf.last_x = pixbuf.x;
+ pixbuf.last_y = pixbuf.y;
+ pixbuf.has_last = true;
+ }
+
pixbuf.realloc(width, height);
+ pixbuf.x = translateToWindowX();
+ pixbuf.y = translateToWindowY();
redraw();
sizeChangeNotifier(width, height);
}
@@ -145,6 +163,20 @@ void Widget::move(int x, int y)
_x = x;
_y = y;
+
+ // Store old size/position in pixelbuffer for rendering invalidation.
+ if(!pixbuf.has_last)
+ {
+ pixbuf.last_width = pixbuf.width;
+ pixbuf.last_height = pixbuf.height;
+ pixbuf.last_x = pixbuf.x;
+ pixbuf.last_y = pixbuf.y;
+ pixbuf.has_last = true;
+ }
+
+ //pixbuf.x = translateToWindowX();
+ //pixbuf.y = translateToWindowY();
+
positionChangeNotifier(x, y);
}
@@ -216,11 +248,14 @@ std::vector<PixelBufferAlpha*> Widget::getPixelBuffers()
dirty = false;
}
- pixelBuffers.push_back(&pixbuf);
+ if(pixbuf.dirty || visible())
+ {
+ pixelBuffers.push_back(&pixbuf);
+ }
- for(auto child : children)
+ if(visible())
{
- if(child->visible())
+ for(auto child : children)
{
auto childPixelBuffers = child->getPixelBuffers();
pixelBuffers.insert(pixelBuffers.end(),