Fix first rotated tile on each row.
The first tile on each row seemed to be missing values. This was due to the ‘continue’ statement that would prevent src_rotated_point to be incremented properly.
This commit is contained in:
parent
7f29bd192a
commit
e3e0d3c20a
2
TODO.md
2
TODO.md
|
@ -21,4 +21,4 @@
|
|||
[ ] Image borders
|
||||
|
||||
# Bugs
|
||||
[ ] first tile on each row is missing
|
||||
[X] first tile on each row is missing
|
||||
|
|
16
rotation.cpp
16
rotation.cpp
|
@ -786,18 +786,16 @@ rotate(TiledImage<W, H> const& src, double angle)
|
|||
DPoint src_rotated_point(rot_origin_in_src.x + x_index * src_delta_x.x + y_index * src_delta_y.x,
|
||||
rot_origin_in_src.y + x_index * src_delta_x.y + y_index * src_delta_y.y);
|
||||
|
||||
for (unsigned int i = 0; i < W; ++i, ++x_index)
|
||||
for (unsigned int i = 0; i < W; ++i)
|
||||
{
|
||||
unsigned int const rot_index = (j * W + i) * 3;
|
||||
Point const rot_point(x_index, y_index);
|
||||
|
||||
if (src_rotated_point.x < 0 || src_rotated_point.x > src.width
|
||||
|| src_rotated_point.y < 0 || src_rotated_point.y > src.height)
|
||||
continue;
|
||||
|
||||
rotate_pixel(src,
|
||||
src_rotated_point,
|
||||
rotated->tiles[rot_tile_index], rot_index);
|
||||
if (src_rotated_point.x >= 0 && src_rotated_point.x < src.width
|
||||
&& src_rotated_point.y >= 0 && src_rotated_point.y < src.height)
|
||||
{
|
||||
rotate_pixel(src, src_rotated_point,
|
||||
rotated->tiles[rot_tile_index], rot_index);
|
||||
}
|
||||
|
||||
src_rotated_point.x += src_delta_x.x;
|
||||
src_rotated_point.y += src_delta_x.y;
|
||||
|
|
Loading…
Reference in a new issue