mirror of https://github.com/buggins/dlangui.git
a little optimization
This commit is contained in:
parent
de42d281b6
commit
c2edca6d7b
|
@ -46,10 +46,8 @@ class GLDrawBuf : DrawBuf, GLConfigCallback {
|
||||||
@property Scene scene() { return _scene; }
|
@property Scene scene() { return _scene; }
|
||||||
|
|
||||||
this(int dx, int dy, bool framebuffer = false) {
|
this(int dx, int dy, bool framebuffer = false) {
|
||||||
_dx = dx;
|
resize(dx, dy);
|
||||||
_dy = dy;
|
|
||||||
_framebuffer = framebuffer;
|
_framebuffer = framebuffer;
|
||||||
resetClipping();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// returns current width
|
/// returns current width
|
||||||
|
@ -65,7 +63,6 @@ class GLDrawBuf : DrawBuf, GLConfigCallback {
|
||||||
|
|
||||||
/// reserved for hardware-accelerated drawing - begins drawing batch
|
/// reserved for hardware-accelerated drawing - begins drawing batch
|
||||||
override void beforeDrawing() {
|
override void beforeDrawing() {
|
||||||
resetClipping();
|
|
||||||
_alpha = 0;
|
_alpha = 0;
|
||||||
if (_scene !is null) {
|
if (_scene !is null) {
|
||||||
_scene.reset();
|
_scene.reset();
|
||||||
|
|
|
@ -422,12 +422,13 @@ class SDLWindow : Window {
|
||||||
float b = ((_backgroundColor >> 0) & 255) / 255.0f;
|
float b = ((_backgroundColor >> 0) & 255) / 255.0f;
|
||||||
glClearColor(r, g, b, a);
|
glClearColor(r, g, b, a);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
GLDrawBuf buf = new GLDrawBuf(_dx, _dy, false);
|
if (!_drawbuf)
|
||||||
buf.beforeDrawing();
|
_drawbuf = new GLDrawBuf(_dx, _dy);
|
||||||
onDraw(buf);
|
_drawbuf.resize(_dx, _dy);
|
||||||
buf.afterDrawing();
|
_drawbuf.beforeDrawing();
|
||||||
|
onDraw(_drawbuf);
|
||||||
|
_drawbuf.afterDrawing();
|
||||||
SDL_GL_SwapWindow(_win);
|
SDL_GL_SwapWindow(_win);
|
||||||
destroy(buf);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Select the color for drawing.
|
// Select the color for drawing.
|
||||||
|
@ -441,10 +442,9 @@ class SDLWindow : Window {
|
||||||
if (!_drawbuf)
|
if (!_drawbuf)
|
||||||
_drawbuf = new ColorDrawBuf(_dx, _dy);
|
_drawbuf = new ColorDrawBuf(_dx, _dy);
|
||||||
_drawbuf.resize(_dx, _dy);
|
_drawbuf.resize(_dx, _dy);
|
||||||
_drawbuf.resetClipping();
|
|
||||||
_drawbuf.fill(_backgroundColor);
|
_drawbuf.fill(_backgroundColor);
|
||||||
onDraw(_drawbuf);
|
onDraw(_drawbuf);
|
||||||
draw(_drawbuf);
|
draw(cast(ColorDrawBuf)_drawbuf);
|
||||||
|
|
||||||
// Up until now everything was drawn behind the scenes.
|
// Up until now everything was drawn behind the scenes.
|
||||||
// This will show the new, red contents of the window.
|
// This will show the new, red contents of the window.
|
||||||
|
@ -452,7 +452,7 @@ class SDLWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorDrawBuf _drawbuf;
|
DrawBuf _drawbuf;
|
||||||
|
|
||||||
//bool _exposeSent;
|
//bool _exposeSent;
|
||||||
void processExpose() {
|
void processExpose() {
|
||||||
|
|
Loading…
Reference in New Issue