diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-06-08 12:45:21 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-06-08 12:45:21 (GMT) |
| commit | 345de25641adc099d8f27ccae8e5313390c86eee (patch) | |
| tree | 9c65d748386ed3e72a2cc78492ca3a5918b3e0a2 /src | |
| parent | b5c9d86fbefdc3402be2e6615bae0bc444a1d491 (diff) | |
| download | powder-345de25641adc099d8f27ccae8e5313390c86eee.zip powder-345de25641adc099d8f27ccae8e5313390c86eee.tar.gz | |
Fix crash where source and destination scale where the same
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/graphics.c b/src/graphics.c index af62862..711edc7 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -158,7 +158,11 @@ pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh) //int i,j,x,y,w,h,r,g,b,c; pixel *q = NULL; //TODO: Actual resampling, this is just cheap nearest pixel crap - if(rw > sw && rh > sh){ + if(rw == sw && rh == sh){ + //Don't resample + q = malloc(rw*rh*PIXELSIZE); + memcpy(q, src, rw*rh*PIXELSIZE); + } else if(rw > sw && rh > sh){ float fx, fy, fyc, fxc, intp; pixel tr, tl, br, bl; q = malloc(rw*rh*PIXELSIZE); |
