shithub: libgraphics

Download patch

ref: be27f4dff3e949b012d7fac9b872fc911123cf3a
parent: 76ce56250c48af053aa08d0cea613962a75c5cbe
author: rodri <rgl@antares-labs.eu>
date: Thu Sep 12 11:32:17 EDT 2024

fb: little memdrawing optimization.

--- a/fb.c
+++ b/fb.c
@@ -364,6 +364,7 @@
 	Raster *r, *r2;
 	Rectangle sr, dr;
 	Memimage *tmp;
+	uchar *bdata0;
 
 	qlock(ctl);
 	fb = ctl->getfb(ctl);
@@ -403,8 +404,10 @@
 		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);