差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン | |||
| cgfs:draw_lines [2025/05/18 15:40] – freemikan | cgfs:draw_lines [2025/11/19 15:11] (現在) – using std::swap; freemikan | ||
|---|---|---|---|
| 行 41: | 行 41: | ||
| void DrawLine(vec2 const &p0, vec2 const &p1, Color const &color) { | void DrawLine(vec2 const &p0, vec2 const &p1, Color const &color) { | ||
| + | using std::swap; | ||
| + | |||
| auto x0 = p0.x; | auto x0 = p0.x; | ||
| auto y0 = p0.y; | auto y0 = p0.y; | ||
| 行 48: | 行 50: | ||
| if (std:: | if (std:: | ||
| if (x0 > x1) { | if (x0 > x1) { | ||
| - | | + | swap(x0, x1); |
| - | | + | swap(y0, y1); |
| } | } | ||
| auto i0 = static_cast< | auto i0 = static_cast< | ||
| 行 62: | 行 64: | ||
| } else { | } else { | ||
| if (y0 > y1) { | if (y0 > y1) { | ||
| - | | + | swap(y0, y1); |
| - | | + | swap(x0, x1); |
| } | } | ||
