diff --git a/TODO.md b/TODO.md index c2f70b1..5c7f8c5 100644 --- a/TODO.md +++ b/TODO.md @@ -21,4 +21,4 @@ [ ] Image borders # Bugs -[ ] first tile on each row is missing +[X] first tile on each row is missing diff --git a/rotation.cpp b/rotation.cpp index e912f07..d641a3c 100644 --- a/rotation.cpp +++ b/rotation.cpp @@ -786,18 +786,16 @@ rotate(TiledImage 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;