Remove pixel_size in rotate_pixel().
It is now specialized for PGM format.
This commit is contained in:
parent
ea7855b9dd
commit
2491796107
12
rotation.cpp
12
rotation.cpp
|
@ -340,15 +340,13 @@ void rotate_pixel(Image const& src,
|
||||||
int const src_y = src_rotated_point.y >> q_pow;
|
int const src_y = src_rotated_point.y >> q_pow;
|
||||||
|
|
||||||
// Bilinear interpolation
|
// Bilinear interpolation
|
||||||
unsigned int const src_index_1 = (src_y * src.width + src_x) * src.pixel_size;
|
unsigned int const src_index_1 = src_y * src.width + src_x;
|
||||||
unsigned int const src_index_2 = src_index_1 + src.pixel_size;
|
unsigned int const src_index_3 = src_index_1 + src.width;
|
||||||
unsigned int const src_index_3 = src_index_1 + src.pixel_size * src.width;
|
|
||||||
unsigned int const src_index_4 = src_index_3 + src.pixel_size;
|
|
||||||
|
|
||||||
pvalue_t const src_tl = src.buffer[src_index_1];
|
pvalue_t const src_tl = src.buffer[src_index_1];
|
||||||
pvalue_t const src_tr = src.buffer[src_index_2];
|
pvalue_t const src_tr = src.buffer[src_index_1 + 1];
|
||||||
pvalue_t const src_bl = src.buffer[src_index_3];
|
pvalue_t const src_bl = src.buffer[src_index_3];
|
||||||
pvalue_t const src_br = src.buffer[src_index_4];
|
pvalue_t const src_br = src.buffer[src_index_3 + 1];
|
||||||
|
|
||||||
unsigned int const x_delta = (src_rotated_point.x >> (q_pow - q_inter_pow)) & mask;
|
unsigned int const x_delta = (src_rotated_point.x >> (q_pow - q_inter_pow)) & mask;
|
||||||
unsigned int const y_delta = (src_rotated_point.y >> (q_pow - q_inter_pow)) & mask;
|
unsigned int const y_delta = (src_rotated_point.y >> (q_pow - q_inter_pow)) & mask;
|
||||||
|
@ -402,7 +400,7 @@ Image* rotate(Image const& src, double angle)
|
||||||
round_if_very_small(src_delta_y.x);
|
round_if_very_small(src_delta_y.x);
|
||||||
round_if_very_small(src_delta_y.y);
|
round_if_very_small(src_delta_y.y);
|
||||||
|
|
||||||
// Quantized position on a grid
|
// Quantized position on a 1024x1024 grid
|
||||||
int const q_pos_pow = 10;
|
int const q_pos_pow = 10;
|
||||||
int const q_pos = 1 << q_pos_pow;
|
int const q_pos = 1 << q_pos_pow;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue