diff options
author | rodri <rgl@antares-labs.eu> | 2024-04-01 16:16:49 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-04-01 16:16:49 +0000 |
commit | 4d711e22d597a42e1478e2f3c2d3c23312520309 (patch) | |
tree | 69b2e306d792a75f5de642aa6de612ade08faebb | |
parent | d22a9cf1583075186a19282c7566b520ec1dcd81 (diff) | |
download | libgraphics-4d711e22d597a42e1478e2f3c2d3c23312520309.tar.gz libgraphics-4d711e22d597a42e1478e2f3c2d3c23312520309.tar.bz2 libgraphics-4d711e22d597a42e1478e2f3c2d3c23312520309.zip |
viewport: add a way to access front and back buffers.
-rw-r--r-- | graphics.h | 1 | ||||
-rw-r--r-- | render.c | 2 | ||||
-rw-r--r-- | viewport.c | 9 |
3 files changed, 10 insertions, 2 deletions
@@ -216,6 +216,7 @@ struct Viewport void (*draw)(Viewport*, Image*); void (*memdraw)(Viewport*, Memimage*); Framebuf *(*getfb)(Viewport*); + Framebuf *(*getbb)(Viewport*); }; struct Camera @@ -527,7 +527,7 @@ sendparams: if(ent != nil && ent != &sc->ents){ params = emalloc(sizeof *params); memset(params, 0, sizeof *params); - params->fb = job->v->getfb(job->v); + params->fb = job->v->getbb(job->v); params->id = job->lastid++; params->frag = rgb(DBlack); params->donec = donec; @@ -23,7 +23,13 @@ viewport_memdraw(Viewport *v, Memimage *dst) static Framebuf * viewport_getfb(Viewport *v) { - return v->fbctl->fb[v->fbctl->idx^1]; /* address the back buffer */ + return v->fbctl->fb[v->fbctl->idx]; /* front buffer */ +} + +static Framebuf * +viewport_getbb(Viewport *v) +{ + return v->fbctl->fb[v->fbctl->idx^1]; /* back buffer */ } Viewport * @@ -39,6 +45,7 @@ mkviewport(Rectangle r) v->draw = viewport_draw; v->memdraw = viewport_memdraw; v->getfb = viewport_getfb; + v->getbb = viewport_getbb; return v; } |