diff --git a/u02/src/star_tool.cpp b/u02/src/star_tool.cpp index b4fdb5b..13342ff 100644 --- a/u02/src/star_tool.cpp +++ b/u02/src/star_tool.cpp @@ -56,7 +56,7 @@ void star_tool::draw(int x0, int y0, int x1, int y1) { const std::vector> points = star(spikes, radius_factor * r, r, x0, y0, angle); - for (int i = 1; i <= points.size(); i++) { + for (size_t i = 1; i <= points.size(); i++) { blt->draw(round(points[i - 1].first), round(points[i - 1].second), round(points[i % points.size()].first), round(points[i % points.size()].second)); diff --git a/u02/src/sweep_line_tool.cpp b/u02/src/sweep_line_tool.cpp index 1e3a488..f132275 100644 --- a/u02/src/sweep_line_tool.cpp +++ b/u02/src/sweep_line_tool.cpp @@ -44,21 +44,23 @@ void sweep_line_tool::draw() { draw(10, 10, 90, 30, 30, 90); } void sweep_line_tool::draw(int _x, int _y) { draw(); } void sweep_line_tool::draw(int x0, int y0, int x1, int y1, int x2, int y2) { - // Terminology: - // - // (x0, y0) - // + - // | \ - // | \ m_1 - // |first\ - // | pass \ - // m_shared |---------+ (x1, y1) - // |second / - // |pass / - // | / m_2 - // | / - // + - // (x2, y2) + /* + * Terminology: + * + * (x0, y0) + * + + * | \ + * | \ m_1 + * |first\ + * | pass \ + * m_shared |---------+ (x1, y1) + * |second / + * |pass / + * | / m_2 + * | / + * + + * (x2, y2) + */ // Sort triangle points (in place) so that y0 < y1 < y2 sort_triangle_points(x0, y0, x1, y1, x2, y2); diff --git a/u02/src/tests.cpp b/u02/src/tests.cpp index 30ffebb..4682ba8 100644 --- a/u02/src/tests.cpp +++ b/u02/src/tests.cpp @@ -128,6 +128,7 @@ TEST_CASE("Bresenham/DDA line tool (prop: for every row/column, only one pixel " const int tool_idx = GENERATE(0, 1); switch (tool_idx) { case 0: + default: // required to make static compiler warnings happy tool = tool_bresenham; break; case 1: @@ -192,7 +193,6 @@ TEST_CASE("Bresenham/DDA line tool (prop: for every row/column, only one pixel " TEST_CASE("Fill (recursive and non recursive) test shape") { canvas_buffer *canvas = new canvas_buffer(100, 100); - bresenham_line_tool *tool_line = new bresenham_line_tool(*canvas); recursive_fill_tool *tool_fill_recursive = new recursive_fill_tool(*canvas); non_recursive_fill_tool *tool_fill_non_recursive = new non_recursive_fill_tool(*canvas); @@ -201,6 +201,7 @@ TEST_CASE("Fill (recursive and non recursive) test shape") { const int tool_fill_idx = GENERATE(0, 1); switch (tool_fill_idx) { case 0: + default: // required to make static compiler warnings happy tool_fill = tool_fill_recursive; break; case 1: