From 8aa0dc8601656db1390617d24bc77be17f099686 Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 20 Jul 2024 11:58:47 +0000 Subject: reduce the volume of Camera.times records. clean up. --- camera.c | 1 + fb.c | 34 ++++++++++++++++------------------ graphics.h | 4 ++-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/camera.c b/camera.c index b6bb5bb..2a31738 100644 --- a/camera.c +++ b/camera.c @@ -94,6 +94,7 @@ updatetimes(Camera *c, Renderjob *j) c->times.E[c->times.cur] = j->times.E; c->times.Tn[c->times.cur] = j->times.Tn; c->times.Rn[c->times.cur] = j->times.Rn; + c->times.last = c->times.cur; c->times.cur = ++c->times.cur % nelem(c->times.R); } diff --git a/fb.c b/fb.c index 0077452..e71312a 100644 --- a/fb.c +++ b/fb.c @@ -94,7 +94,6 @@ framebufctl_upscaledraw(Framebufctl *ctl, Image *dst, Point scale) Rectangle blkr; Point sp, dp; ulong *blk; - int i; blk = emalloc(scale.x*scale.y*4); blkr = Rect(0,0,scale.x,scale.y); @@ -102,14 +101,14 @@ framebufctl_upscaledraw(Framebufctl *ctl, Image *dst, Point scale) qlock(ctl); fb = ctl->getfb(ctl); for(sp.y = fb->r.min.y, dp.y = dst->r.min.y; sp.y < fb->r.max.y; sp.y++, dp.y += scale.y) - for(sp.x = fb->r.min.x, dp.x = dst->r.min.x; sp.x < fb->r.max.x; sp.x++, dp.x += scale.x){ - /*if(scale.x == 2 && scale.y == 2) - scale2x_filter(blk, fb, &sp); - else if(scale.x == 3 && scale.y == 3) - scale3x_filter(blk, fb, &sp); - else */memsetl(blk, getpixel(fb, sp), scale.x*scale.y); - loadimage(dst, rectaddpt(blkr, dp), (uchar*)blk, scale.x*scale.y*4); - } + for(sp.x = fb->r.min.x, dp.x = dst->r.min.x; sp.x < fb->r.max.x; sp.x++, dp.x += scale.x){ + /*if(scale.x == 2 && scale.y == 2) + scale2x_filter(blk, fb, &sp); + else if(scale.x == 3 && scale.y == 3) + scale3x_filter(blk, fb, &sp); + else */memsetl(blk, getpixel(fb, sp), scale.x*scale.y); + loadimage(dst, rectaddpt(blkr, dp), (uchar*)blk, scale.x*scale.y*4); + } qunlock(ctl); free(blk); } @@ -132,7 +131,6 @@ framebufctl_upscalememdraw(Framebufctl *ctl, Memimage *dst, Point scale) Rectangle blkr; Point sp, dp; ulong *blk; - int i; blk = emalloc(scale.x*scale.y*4); blkr = Rect(0,0,scale.x,scale.y); @@ -140,14 +138,14 @@ framebufctl_upscalememdraw(Framebufctl *ctl, Memimage *dst, Point scale) qlock(ctl); fb = ctl->getfb(ctl); for(sp.y = fb->r.min.y, dp.y = dst->r.min.y; sp.y < fb->r.max.y; sp.y++, dp.y += scale.y) - for(sp.x = fb->r.min.x, dp.x = dst->r.min.x; sp.x < fb->r.max.x; sp.x++, dp.x += scale.x){ - /*if(scale.x == 2 && scale.y == 2) - scale2x_filter(blk, fb, &sp); - else if(scale.x == 3 && scale.y == 3) - scale3x_filter(blk, fb, &sp); - else */memsetl(blk, getpixel(fb, sp), scale.x*scale.y); - loadmemimage(dst, rectaddpt(blkr, dp), (uchar*)blk, scale.x*scale.y*4); - } + for(sp.x = fb->r.min.x, dp.x = dst->r.min.x; sp.x < fb->r.max.x; sp.x++, dp.x += scale.x){ + /*if(scale.x == 2 && scale.y == 2) + scale2x_filter(blk, fb, &sp); + else if(scale.x == 3 && scale.y == 3) + scale3x_filter(blk, fb, &sp); + else */memsetl(blk, getpixel(fb, sp), scale.x*scale.y); + loadmemimage(dst, rectaddpt(blkr, dp), (uchar*)blk, scale.x*scale.y*4); + } qunlock(ctl); free(blk); } diff --git a/graphics.h b/graphics.h index a0e1c3a..476f954 100644 --- a/graphics.h +++ b/graphics.h @@ -295,8 +295,8 @@ struct Camera uvlong nframes; } stats; struct { - Rendertime R[100], E[100], Tn[100], Rn[100]; - int cur; + Rendertime R[10], E[10], Tn[10], Rn[10]; + int last, cur; } times; }; -- cgit v1.2.3