Skip to content

Commit 0f0a95d

Browse files
committed
Rename horizontal_line_segment() to horizontal_...()
Assuming it's a typo. Add wrappers with the old name for backwards compatibility.
1 parent a03765d commit 0f0a95d

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

bitmap_image.hpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ class image_drawer
21952195
plot_pen_pixel(x2,y2);
21962196
}
21972197

2198-
void horiztonal_line_segment(int x1, int x2, int y)
2198+
void horizontal_line_segment(int x1, int x2, int y)
21992199
{
22002200
if (x1 > x2)
22012201
{
@@ -2208,6 +2208,11 @@ class image_drawer
22082208
}
22092209
}
22102210

2211+
void horiztonal_line_segment(int x1, int x2, int y)
2212+
{
2213+
horizontal_line_segment(x1, x2, y);
2214+
}
2215+
22112216
void vertical_line_segment(int y1, int y2, int x)
22122217
{
22132218
if (y1 > y2)
@@ -2461,7 +2466,7 @@ class cartesian_canvas
24612466
}
24622467
}
24632468

2464-
void horiztonal_line_segment(double x1, double x2, double y)
2469+
void horizontal_line_segment(double x1, double x2, double y)
24652470
{
24662471
x1 = clamp_x(x1);
24672472
x2 = clamp_x(x2);
@@ -2471,7 +2476,12 @@ class cartesian_canvas
24712476
const int sc_x2 = static_cast<int>(cart_to_screen_x(x2));
24722477
const int sc_y = static_cast<int>(cart_to_screen_y(y ));
24732478

2474-
draw_.horiztonal_line_segment(sc_x1, sc_x2, sc_y);
2479+
draw_.horizontal_line_segment(sc_x1, sc_x2, sc_y);
2480+
}
2481+
2482+
void horiztonal_line_segment(double x1, double x2, double y)
2483+
{
2484+
horizontal_line_segment(x1, x2, y);
24752485
}
24762486

24772487
void vertical_line_segment(double y1, double y2, double x)
@@ -2564,7 +2574,7 @@ class cartesian_canvas
25642574

25652575
for (double y = p0.second; y <= p1.second; y += 0.5)
25662576
{
2567-
canvas.horiztonal_line_segment(x0, x1, y);
2577+
canvas.horizontal_line_segment(x0, x1, y);
25682578

25692579
x0 += m0;
25702580
x1 += m1;
@@ -2581,7 +2591,7 @@ class cartesian_canvas
25812591

25822592
for (double y = p2.second; y >= p0.second; y -= 0.5)
25832593
{
2584-
canvas.horiztonal_line_segment(x0, x1, y);
2594+
canvas.horizontal_line_segment(x0, x1, y);
25852595

25862596
x0 -= m0;
25872597
x1 -= m1;
@@ -2628,14 +2638,14 @@ class cartesian_canvas
26282638
{
26292639
for (double i = cx - x; i <= cx + x; i += delta)
26302640
{
2631-
horiztonal_line_segment(cx - x, cx + x, cy + y);
2632-
horiztonal_line_segment(cx - x, cx + x, cy - y);
2641+
horizontal_line_segment(cx - x, cx + x, cy + y);
2642+
horizontal_line_segment(cx - x, cx + x, cy - y);
26332643
}
26342644

26352645
for (double i = cx - y; i <= cx + y; i += delta)
26362646
{
2637-
horiztonal_line_segment(cx - y, cx + y, cy + x);
2638-
horiztonal_line_segment(cx - y, cx + y, cy - x);
2647+
horizontal_line_segment(cx - y, cx + y, cy + x);
2648+
horizontal_line_segment(cx - y, cx + y, cy - x);
26392649
}
26402650

26412651
y += delta;

bitmap_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ void test19()
530530

531531
canvas.rectangle(canvas.min_x(), canvas.min_y(), canvas.max_x(), canvas.max_y());
532532

533-
canvas.horiztonal_line_segment(canvas.min_x(), canvas.max_x(), -400.0);
533+
canvas.horizontal_line_segment(canvas.min_x(), canvas.max_x(), -400.0);
534534

535535
canvas.line_segment(-500.0, 600.0, 600.0, -500.0);
536536

0 commit comments

Comments
 (0)