Minor change in Widget::invalidate*() funcs to use onInvalidateRegion()

This commit is contained in:
David Capello 2018-12-04 17:32:01 -03:00
parent 4790e3845a
commit 0a179acc90

View File

@ -1096,32 +1096,22 @@ void Widget::setTransparent(bool transparent)
void Widget::invalidate() void Widget::invalidate()
{ {
assert_ui_thread(); assert_ui_thread();
if (!hasFlags(HIDDEN)) // Quick filter for hidden widgets
// TODO we should use invalidateRect(bounds()) here. onInvalidateRegion(Region(bounds()));
if (isVisible()) {
m_updateRegion.clear();
getDrawableRegion(m_updateRegion, kCutTopWindows);
setDirtyFlag();
for (auto child : m_children)
child->invalidate();
}
} }
void Widget::invalidateRect(const gfx::Rect& rect) void Widget::invalidateRect(const gfx::Rect& rect)
{ {
assert_ui_thread(); assert_ui_thread();
if (!hasFlags(HIDDEN)) // Quick filter for hidden widgets
if (isVisible()) onInvalidateRegion(Region(rect));
invalidateRegion(Region(rect));
} }
void Widget::invalidateRegion(const Region& region) void Widget::invalidateRegion(const Region& region)
{ {
assert_ui_thread(); assert_ui_thread();
onInvalidateRegion(region); if (!hasFlags(HIDDEN)) // Quick filter for hidden widgets
onInvalidateRegion(region);
} }
class DeleteGraphicsAndSurface { class DeleteGraphicsAndSurface {