diff options
author | rodri <rgl@antares-labs.eu> | 2024-07-20 11:58:47 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-07-20 11:58:47 +0000 |
commit | 8aa0dc8601656db1390617d24bc77be17f099686 (patch) | |
tree | 53cb847593058381f8975894424bb6da720fdcde | |
parent | 071b70df067ffa192e64511f2a88f1d4efad241b (diff) | |
download | libgraphics-8aa0dc8601656db1390617d24bc77be17f099686.tar.gz libgraphics-8aa0dc8601656db1390617d24bc77be17f099686.tar.bz2 libgraphics-8aa0dc8601656db1390617d24bc77be17f099686.zip |
reduce the volume of Camera.times records. clean up.
-rw-r--r-- | camera.c | 1 | ||||
-rw-r--r-- | fb.c | 34 | ||||
-rw-r--r-- | graphics.h | 4 |
3 files changed, 19 insertions, 20 deletions
@@ -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); } @@ -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); } @@ -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; }; |