summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-12 15:32:17 +0000
committerrodri <rgl@antares-labs.eu>2024-09-12 15:32:17 +0000
commitbe27f4dff3e949b012d7fac9b872fc911123cf3a (patch)
tree6cd069c304b9ae8a2eca48109f0d72a291abf91f
parent76ce56250c48af053aa08d0cea613962a75c5cbe (diff)
downloadlibgraphics-be27f4dff3e949b012d7fac9b872fc911123cf3a.tar.gz
libgraphics-be27f4dff3e949b012d7fac9b872fc911123cf3a.tar.bz2
libgraphics-be27f4dff3e949b012d7fac9b872fc911123cf3a.zip
fb: little memdrawing optimization.
-rw-r--r--fb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fb.c b/fb.c
index 7a11571..353c8a1 100644
--- a/fb.c
+++ b/fb.c
@@ -364,6 +364,7 @@ framebufctl_memdraw(Framebufctl *ctl, Memimage *dst, char *name, Point off, Poin
Raster *r, *r2;
Rectangle sr, dr;
Memimage *tmp;
+ uchar *bdata0;
qlock(ctl);
fb = ctl->getfb(ctl);
@@ -403,8 +404,10 @@ framebufctl_memdraw(Framebufctl *ctl, Memimage *dst, char *name, Point off, Poin
if(tmp == nil)
sysfatal("allocmemimage: %r");
- loadmemimage(tmp, sr, (uchar*)r->data, Dx(fb->r)*Dy(r->r)*4);
+ bdata0 = tmp->data->bdata;
+ tmp->data->bdata = (void*)r->data;
memimagedraw(dst, rectaddpt(sr, dst->r.min), tmp, ZP, nil, ZP, S);
+ tmp->data->bdata = bdata0;
freememimage(tmp);
}else if(rectclip(&sr, dr)){
tmp = allocmemimage(sr, RGBA32);