aboutsummaryrefslogtreecommitdiff
path: root/fb.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-04-05 08:36:24 +0000
committerrodri <rgl@antares-labs.eu>2024-04-05 08:36:24 +0000
commit2c286986893435895528d59c7db624261ac5571b (patch)
tree5d3a47ce5e05f0c4a08da7a35865b3a56f9aaae0 /fb.c
parent8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff (diff)
downloadlibgraphics-2c286986893435895528d59c7db624261ac5571b.tar.gz
libgraphics-2c286986893435895528d59c7db624261ac5571b.tar.bz2
libgraphics-2c286986893435895528d59c7db624261ac5571b.zip
simplify the job scheduler. correct two mistakes regarding the Viewport.
> They made two mistakes. they hanged the wrong man and they didn't finish the job. so Clint Eastwood came back to kick my ass. the mistakes in question were that the Viewport shouldn't know about double buffering, conceptually it has a framebuffer and that's it. the second one was passing it to the renderer, when the renderer couldn't care less about what a viewport is.
Diffstat (limited to 'fb.c')
-rw-r--r--fb.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fb.c b/fb.c
index 17496ac..02c984d 100644
--- a/fb.c
+++ b/fb.c
@@ -46,6 +46,18 @@ framebufctl_reset(Framebufctl *ctl)
memfillcolor(fb->cb, DTransparent);
}
+static Framebuf *
+framebufctl_getfb(Framebufctl *ctl)
+{
+ return ctl->fb[ctl->idx]; /* front buffer */
+}
+
+static Framebuf *
+framebufctl_getbb(Framebufctl *ctl)
+{
+ return ctl->fb[ctl->idx^1]; /* back buffer */
+}
+
Framebuf *
mkfb(Rectangle r)
{
@@ -81,6 +93,8 @@ mkfbctl(Rectangle r)
fc->memdraw = framebufctl_memdraw;
fc->swap = framebufctl_swap;
fc->reset = framebufctl_reset;
+ fc->getfb = framebufctl_getfb;
+ fc->getbb = framebufctl_getbb;
return fc;
}