u02: Fix warnings by -Wall
This actually found one logic bug.
This commit is contained in:
parent
f46e54a156
commit
1bd2d3a2a5
|
@ -56,7 +56,7 @@ void star_tool::draw(int x0, int y0, int x1, int y1) {
|
|||
const std::vector<std::pair<float, float>> 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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
Reference in a new issue