< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m

Print this page
*** 86,28 ***
  
          if (x1 > x2) {
              float t = fx1; fx1 = fx2; fx2 = t;
          }
  
!         struct Vertex v1 = {{fx1 + 0.2f, fy}};
!         struct Vertex v2 = {{fx2 + 1.2f, fy}};
!         verts[0] = v1;
!         verts[1] = v2;
      } else if (x1 == x2) {
          // vertical
          float fx  = ((float)x1) + 0.2f;
          float fy1 = (float)y1;
          float fy2 = (float)y2;
  
          if (y1 > y2) {
              float t = fy1; fy1 = fy2; fy2 = t;
          }
  
!         struct Vertex v1 = {{fx, fy1 + 0.2f}};
!         struct Vertex v2 = {{fx, fy2 + 1.2f}};
!         verts[0] = v1;
!         verts[1] = v2;
      } else {
          // diagonal
          float fx1 = (float)x1;
          float fy1 = (float)y1;
          float fx2 = (float)x2;
--- 86,28 ---
  
          if (x1 > x2) {
              float t = fx1; fx1 = fx2; fx2 = t;
          }
  
!         verts[0].position[0] = fx1 + 0.2f;
!         verts[0].position[1] = fy;
!         verts[1].position[0] = fx2 + 1.2f;
!         verts[1].position[1] = fy;
      } else if (x1 == x2) {
          // vertical
          float fx  = ((float)x1) + 0.2f;
          float fy1 = (float)y1;
          float fy2 = (float)y2;
  
          if (y1 > y2) {
              float t = fy1; fy1 = fy2; fy2 = t;
          }
  
!         verts[0].position[0] = fx;
!         verts[0].position[1] = fy1 + 0.2f;
!         verts[1].position[0] = fx;
!         verts[1].position[1] = fy2 + 1.2f;
      } else {
          // diagonal
          float fx1 = (float)x1;
          float fy1 = (float)y1;
          float fx2 = (float)x2;

*** 126,14 ***
              fy2 += 1.0f;
          } else {
              fy1 += 0.8f;
              fy2 -= 0.2f;
          }
!         struct Vertex v1 = {{fx1, fy1}};
!         struct Vertex v2 = {{fx2, fy2}};
!         verts[0] = v1;
!         verts[1] = v2;
      }
  
      [mtlEncoder setVertexBytes:verts length:sizeof(verts) atIndex:MeshVertexBuffer];
      [mtlEncoder drawPrimitives:MTLPrimitiveTypeLine vertexStart:0 vertexCount:2];
  }
--- 126,14 ---
              fy2 += 1.0f;
          } else {
              fy1 += 0.8f;
              fy2 -= 0.2f;
          }
!         verts[0].position[0] = fx1;
!         verts[0].position[1] = fy1;
!         verts[1].position[0] = fx2;
!         verts[1].position[1] = fy2;
      }
  
      [mtlEncoder setVertexBytes:verts length:sizeof(verts) atIndex:MeshVertexBuffer];
      [mtlEncoder drawPrimitives:MTLPrimitiveTypeLine vertexStart:0 vertexCount:2];
  }
< prev index next >