(float x, float y)
| 777 | |
| 778 | |
| 779 | @Override |
| 780 | public void vertex(float x, float y) { |
| 781 | curveVertexCount = 0; |
| 782 | //float vertex[]; |
| 783 | |
| 784 | if (vertexCount == vertices.length) { |
| 785 | float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT]; |
| 786 | System.arraycopy(vertices, 0, temp, 0, vertexCount); |
| 787 | vertices = temp; |
| 788 | //message(CHATTER, "allocating more vertices " + vertices.length); |
| 789 | } |
| 790 | // not everyone needs this, but just easier to store rather |
| 791 | // than adding another moving part to the code... |
| 792 | vertices[vertexCount][X] = x; |
| 793 | vertices[vertexCount][Y] = y; |
| 794 | vertexCount++; |
| 795 | |
| 796 | switch (shape) { |
| 797 | |
| 798 | case POINTS: |
| 799 | point(x, y); |
| 800 | break; |
| 801 | |
| 802 | case LINES: |
| 803 | if ((vertexCount % 2) == 0) { |
| 804 | line(vertices[vertexCount-2][X], |
| 805 | vertices[vertexCount-2][Y], x, y); |
| 806 | } |
| 807 | break; |
| 808 | |
| 809 | case TRIANGLES: |
| 810 | if ((vertexCount % 3) == 0) { |
| 811 | triangle(vertices[vertexCount - 3][X], |
| 812 | vertices[vertexCount - 3][Y], |
| 813 | vertices[vertexCount - 2][X], |
| 814 | vertices[vertexCount - 2][Y], |
| 815 | x, y); |
| 816 | } |
| 817 | break; |
| 818 | |
| 819 | case TRIANGLE_STRIP: |
| 820 | if (vertexCount >= 3) { |
| 821 | triangle(vertices[vertexCount - 2][X], |
| 822 | vertices[vertexCount - 2][Y], |
| 823 | vertices[vertexCount - 1][X], |
| 824 | vertices[vertexCount - 1][Y], |
| 825 | vertices[vertexCount - 3][X], |
| 826 | vertices[vertexCount - 3][Y]); |
| 827 | } |
| 828 | break; |
| 829 | |
| 830 | case TRIANGLE_FAN: |
| 831 | if (vertexCount >= 3) { |
| 832 | // This is an unfortunate implementation because the stroke for an |
| 833 | // adjacent triangle will be repeated. However, if the stroke is not |
| 834 | // redrawn, it will replace the adjacent line (when it lines up |
| 835 | // perfectly) or show a faint line (when off by a small amount). |
| 836 | // The alternative would be to wait, then draw the shape as a |
nothing calls this directly
no test coverage detected