Fix to "mirror" edge condition class

Originally committed to SVN as r1657.
This commit is contained in:
Niels Martin Hansen 2007-12-29 22:28:41 +00:00
parent 44a414e893
commit a24a1c8e4e

View file

@ -35,6 +35,7 @@
#include <stdint.h>
#include <omp.h>
#include <math.h>
#include <assert.h>
// Forward
@ -631,8 +632,8 @@ namespace EdgeCondition {
while (y < 0) y += img.height*2;
while (x >= img.width*2) x -= img.width*2;
while (y >= img.height*2) y -= img.height*2;
if (x >= img.width) x = img.width - x;
if (y >= img.height) y = img.height - y;
if (x >= img.width) x = img.width*2 - x;
if (y >= img.height) y = img.height*2 - y;
return img.Pixel(x,y);
}
};
@ -647,6 +648,9 @@ inline PixFmt GetPixelBilinear(BaseImage<PixFmt> &img, double x, double y)
PixFmt res;
double xpct = x - floor(x), ypct = y - floor(y);
if (xpct == 0 && ypct == 0)
return EdgeCond::get(img, (int)x, (int)y);
const PixFmt &src11 = EdgeCond::get(img, (int)x, (int)y);
const PixFmt &src12 = EdgeCond::get(img, (int)x, 1+(int)y);
const PixFmt &src21 = EdgeCond::get(img, 1+(int)x, (int)y);