差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
cgfs:draw_lines [2025/05/18 15:40] freemikancgfs: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::abs(x1 - x0) > std::abs(y1 - y0)) {     if (std::abs(x1 - x0) > std::abs(y1 - y0)) {
         if (x0 > x1) {         if (x0 > x1) {
-            std::swap(x0, x1); +            swap(x0, x1); 
-            std::swap(y0, y1);+            swap(y0, y1);
         }         }
         auto i0 = static_cast<int>(std::floor(x0));         auto i0 = static_cast<int>(std::floor(x0));
行 62: 行 64:
     } else {     } else {
         if (y0 > y1) {         if (y0 > y1) {
-            std::swap(y0, y1); +            swap(y0, y1); 
-            std::swap(x0, x1);+            swap(x0, x1);
         }         }
  
文書の先頭へ