Deduce src points needed for interpolation.
Computing the four points is too heavy.
This commit is contained in:
parent
36c47fd13e
commit
05777d59f8
|
@ -467,9 +467,10 @@ void rotate_pixel(Image const& src, Image& rotated,
|
||||||
|
|
||||||
// Bilinear interpolation
|
// Bilinear interpolation
|
||||||
unsigned int src_index_1 = (floor(src_rotated_point.y) * src.width + floor(src_rotated_point.x)) * 3;
|
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_2 = src_index_1 + 3;
|
||||||
unsigned int src_index_3 = (ceil(src_rotated_point.y) * src.width + floor(src_rotated_point.x)) * 3;
|
unsigned int src_index_3 = src_index_1 + 3 * src.width;
|
||||||
unsigned int src_index_4 = (ceil(src_rotated_point.y) * src.width + ceil(src_rotated_point.x)) * 3;
|
unsigned int src_index_4 = src_index_3 + 3;
|
||||||
|
|
||||||
if (src_index_1 >= src_limit || src_index_1 >= src_limit)
|
if (src_index_1 >= src_limit || src_index_1 >= src_limit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue