summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-06-03 22:54:08 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-03 22:54:08 (GMT)
commit41d8e316cd9dc9c30a5d7c314af741eeaa048b66 (patch)
tree5647a20dc0a5ddcd050b378564d54726bfb6258d /src
parent45e91c15b200749e52b7510601a0046855d94c24 (diff)
downloadpowder-41d8e316cd9dc9c30a5d7c314af741eeaa048b66.zip
powder-41d8e316cd9dc9c30a5d7c314af741eeaa048b66.tar.gz
Use bilinear interpolation for everything
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/graphics.c b/src/graphics.c
index df5b96c..990fae5 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -147,7 +147,8 @@ pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh)
pixel *q;
q = malloc(rw*rh*PIXELSIZE);
//TODO: Actual resampling, this is just cheap nearest pixel crap
- if(rw > sw && rh > sh){
+ //if(rw > sw && rh > sh){
+ //if(1){
float fx, fy, fyc, fxc, intp;
pixel tr, tl, br, bl;
//Bilinear interpolation for upscaling
@@ -168,13 +169,13 @@ pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh)
(int)(((((float)PIXB(tl))*(1.0f-fxc))+(((float)PIXB(tr))*(fxc)))*(1.0f-fyc) + ((((float)PIXB(bl))*(1.0f-fxc))+(((float)PIXB(br))*(fxc)))*(fyc))
);
}
- } else {
- for (y=0; y<rh; y++)
- for (x=0; x<rw; x++)
- {
- q[rw*y+x] = src[sw*(y*sh/rh)+(x*sw/rw)];
- }
- }
+ //} else {
+ // for (y=0; y<rh; y++)
+ // for (x=0; x<rw; x++)
+ // {
+ // q[rw*y+x] = src[sw*(y*sh/rh)+(x*sw/rw)];
+ // }
+ //}
//*qw = w;
//*qh = h;
return q;