MCPcopy Create free account
hub / github.com/axmolengine/axmol / _drawPoly

Method _drawPoly

core/2d/DrawNode.cpp:1036–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036void DrawNode::_drawPoly(const Vec2* verts,
1037 unsigned int count,
1038 bool closedPolygon,
1039 const Color4F& color,
1040 float thickness,
1041 bool isconvex)
1042{
1043 if (thickness == 1.0f && !properties.drawOrder)
1044 {
1045 auto _vertices = _transform(verts, count, closedPolygon);
1046
1047 unsigned int vertex_count = (closedPolygon) ? 2 * count : 2 * (count - 1);
1048
1049 auto line = expandBufferAndGetPointer(_lines, vertex_count);
1050 _linesDirty = true;
1051
1052 int ii = 0;
1053 for (unsigned int i = 0; i < count - 1; i++)
1054 {
1055 line[ii++] = {_vertices[i], color, Vec2::ZERO};
1056 line[ii++] = {_vertices[i + 1], color, Vec2::ZERO};
1057 }
1058 if (closedPolygon)
1059 {
1060 line[ii++] = {_vertices[count - 1], color, Vec2::ZERO};
1061 line[ii++] = line[0];
1062 }
1063 }
1064 else
1065 {
1066 _drawPolygon(verts, count, Color4F::TRANSPARENT, color, closedPolygon, thickness, isconvex);
1067 }
1068}
1069
1070void DrawNode::_drawSegment(const Vec2& from,
1071 const Vec2& to,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected