Deduce src points needed for interpolation.

Computing the four points is too heavy.
master
Fabien Freling 2014-06-28 18:35:48 +02:00
parent 36c47fd13e
commit 05777d59f8
1 changed files with 4 additions and 3 deletions

View File

@ -467,9 +467,10 @@ void rotate_pixel(Image const& src, Image& rotated,
// Bilinear interpolation
unsigned int src_index_1 = (floor(src_rotated_point.y) * src.width + floor(src_rotated_point.x)) * 3;
unsigned int src_index_2 = (floor(src_rotated_point.y) * src.width + ceil(src_rotated_point.x)) * 3;
unsigned int src_index_3 = (ceil(src_rotated_point.y) * src.width + floor(src_rotated_point.x)) * 3;
unsigned int src_index_4 = (ceil(src_rotated_point.y) * src.width + ceil(src_rotated_point.x)) * 3;
unsigned int src_index_2 = src_index_1 + 3;
unsigned int src_index_3 = src_index_1 + 3 * src.width;
unsigned int src_index_4 = src_index_3 + 3;
if (src_index_1 >= src_limit || src_index_1 >= src_limit)
return;