diff options
author | rgl <devnull@localhost> | 2020-02-16 15:27:40 +0100 |
---|---|---|
committer | rgl <devnull@localhost> | 2020-02-16 15:27:40 +0100 |
commit | afda5b9243cc8c843dfc799db79807a072cc09be (patch) | |
tree | c1ff34be978492b149fddd191b00b3fe67a99d1b | |
parent | 9c56f017f8a6d7012217ad6bbb9e32d48f4f50ae (diff) | |
download | st-afda5b9243cc8c843dfc799db79807a072cc09be.tar.gz st-afda5b9243cc8c843dfc799db79807a072cc09be.tar.bz2 st-afda5b9243cc8c843dfc799db79807a072cc09be.zip |
exercises on image rotation.
-rw-r--r-- | main.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -172,7 +172,7 @@ void redraw(void) { Rectangle r; - Point p; + Point p, dp; memimagedraw(fb, fb->r, pal[Cbg], ZP, nil, ZP, SoverD); for(r = ZR; r.min.y < bob.spr->r.max.y; r.min.y++){ @@ -180,11 +180,11 @@ redraw(void) r.max.y = r.min.y+1; for(; r.min.x < bob.spr->r.max.x; r.min.x++){ r.max.x = r.min.x+1; - if(memcmp(byteaddr(bob.spr, r.min), byteaddr(pal[Cmask], ZP), bob.spr->depth/8) != 0){ - p = addpt(r.min,subpt(bob.p, Pt(Dx(bob.spr->r)/2,Dy(bob.spr->r)/2))); - p = rotatept(p, bob.roll, bob.p); - toroidwarp(&p); - memimagedraw(fb, Rpt(p,addpt(p,Pt(1,1))), bob.spr, r.min, nil, ZP, SoverD); + p = rotatept(r.min, bob.roll, Pt(Dx(bob.spr->r)/2,Dy(bob.spr->r)/2)); + if(memcmp(byteaddr(bob.spr, p), byteaddr(pal[Cmask], ZP), bob.spr->depth/8) != 0){ + dp = addpt(r.min, bob.p); + toroidwarp(&dp); + memimagedraw(fb, Rpt(dp,addpt(dp, Pt(1,1))), bob.spr, p, nil, ZP, SoverD); } } } |