Perilous code
Jul. 15th, 2005 11:21 am// Pascal lacks signed shift ops--shr clobbers neg values TempColor.A := -XC * Sample.A div $10000; TempColor.R := -XC * Sample.R div $10000; TempColor.G := -XC * Sample.G div $10000; TempColor.B := -XC * Sample.B div $10000;
Hey, I wonder if the compiler will replace all this fixed-point math, PER SOURCE PIXEL, with proper shifts! Because there's more where that came from. I have a feeling this is gonna crawl. XD
Ed: Squee! Look at the pretty colors! Hmm, it is spectacularly broken. Dracus go hit code with big stick now!
Ed2: Almost got it. Seems to be some roundoff crap going on, causing pathological behavior (undersampling and pixel junk) at specific values. But it is not too much slower than the axis-aligned zoom, and with some optimization it should be usable. Another nice thing is that I normalize the affine vectors so I sample at the source frequency no matter what. This lends itself to a quality slider, you could sample half the freq instead and quadruple the speed.
Sadly, zooming from 100% -> 90% there is a sudden, slight but noticable appearance of fuzzy. I'm not sure what's causing that, possibly the wimpy lerp eating all the sharp edges. Cubic or Gaussian would be nicer.