mirror of https://github.com/adamdruppe/arsd.git
huge redraw optimization
This commit is contained in:
parent
86fb5ba6ee
commit
9deb9d0801
22
minigui.d
22
minigui.d
|
@ -1226,7 +1226,23 @@ class Widget {
|
||||||
child.privatePaint(painter, painter.originX, painter.originY);
|
child.privatePaint(painter, painter.originX, painter.originY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void redraw() {
|
static class RedrawEvent {}
|
||||||
|
__gshared re = new RedrawEvent();
|
||||||
|
|
||||||
|
private bool redrawRequested;
|
||||||
|
final void redraw() {
|
||||||
|
redrawRequested = true;
|
||||||
|
|
||||||
|
if(this.parentWindow) {
|
||||||
|
auto sw = this.parentWindow.win;
|
||||||
|
assert(sw !is null);
|
||||||
|
if(!sw.eventQueued!RedrawEvent)
|
||||||
|
sw.postEvent(re);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void actualRedraw() {
|
||||||
|
redrawRequested = false;
|
||||||
if(!showing) return;
|
if(!showing) return;
|
||||||
|
|
||||||
assert(parentWindow !is null);
|
assert(parentWindow !is null);
|
||||||
|
@ -1984,6 +2000,10 @@ class Window : Widget {
|
||||||
super(null);
|
super(null);
|
||||||
this.win = win;
|
this.win = win;
|
||||||
|
|
||||||
|
win.addEventListener((Widget.RedrawEvent) {
|
||||||
|
this.actualRedraw();
|
||||||
|
});
|
||||||
|
|
||||||
this.width = win.width;
|
this.width = win.width;
|
||||||
this.height = win.height;
|
this.height = win.height;
|
||||||
this.parentWindow = this;
|
this.parentWindow = this;
|
||||||
|
|
Loading…
Reference in New Issue