aboutsummaryrefslogtreecommitdiff
path: root/fb.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-02-27 11:29:06 +0000
committerrodri <rgl@antares-labs.eu>2024-02-27 11:29:06 +0000
commite0baf147d655409b721e41b0e3effabd39a96b34 (patch)
treeddfe6bbcaa5651650e8ff1f6e0b3b4dcc0bf07ee /fb.c
parentc0bc9d332f3ab51a43d5e3d0da2d5a32e938b1d2 (diff)
downloadlibgraphics-e0baf147d655409b721e41b0e3effabd39a96b34.tar.gz
libgraphics-e0baf147d655409b721e41b0e3effabd39a96b34.tar.bz2
libgraphics-e0baf147d655409b721e41b0e3effabd39a96b34.zip
have separate routines for drawing and memdrawing.
Diffstat (limited to 'fb.c')
-rw-r--r--fb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fb.c b/fb.c
index a7a5122..17496ac 100644
--- a/fb.c
+++ b/fb.c
@@ -9,7 +9,18 @@
#include "internal.h"
static void
-framebufctl_draw(Framebufctl *ctl, Memimage *dst)
+framebufctl_draw(Framebufctl *ctl, Image *dst)
+{
+ Framebuf *fb;
+
+ fb = ctl->fb[ctl->idx];
+ lock(&ctl->swplk);
+ loadimage(dst, rectaddpt(fb->r, dst->r.min), byteaddr(fb->cb, fb->r.min), bytesperline(fb->r, fb->cb->depth)*Dy(fb->r));
+ unlock(&ctl->swplk);
+}
+
+static void
+framebufctl_memdraw(Framebufctl *ctl, Memimage *dst)
{
lock(&ctl->swplk);
memimagedraw(dst, dst->r, ctl->fb[ctl->idx]->cb, ZP, nil, ZP, SoverD);
@@ -67,6 +78,7 @@ mkfbctl(Rectangle r)
fc->fb[0] = mkfb(r);
fc->fb[1] = mkfb(r);
fc->draw = framebufctl_draw;
+ fc->memdraw = framebufctl_memdraw;
fc->swap = framebufctl_swap;
fc->reset = framebufctl_reset;
return fc;