MCPcopy Create free account
hub / github.com/Kitware/VTK / DrawPolygon

Method DrawPolygon

Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1373–1401  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1371
1372//------------------------------------------------------------------------------
1373void vtkOpenGLContextDevice2D::DrawPolygon(float* f, int n)
1374{
1375 if (SkipDraw())
1376 {
1377 return;
1378 }
1379
1380 if (!f || n <= 0)
1381 {
1382 vtkWarningMacro(<< "Points supplied that were not of type float.");
1383 return;
1384 }
1385
1386 // convert polygon to triangles
1387 std::vector<float> tverts;
1388 int numTVerts = 3 * (n - 2);
1389 tverts.reserve(numTVerts * 2);
1390 for (int i = 0; i < n - 2; i++)
1391 {
1392 tverts.push_back(f[0]);
1393 tverts.push_back(f[1]);
1394 tverts.push_back(f[i * 2 + 2]);
1395 tverts.push_back(f[i * 2 + 3]);
1396 tverts.push_back(f[i * 2 + 4]);
1397 tverts.push_back(f[i * 2 + 5]);
1398 }
1399
1400 this->CoreDrawTriangles(tverts);
1401}
1402
1403//------------------------------------------------------------------------------
1404void vtkOpenGLContextDevice2D::DrawColoredPolygon(

Callers 1

DrawEllipticArcMethod · 0.95

Calls 4

CoreDrawTrianglesMethod · 0.95
SkipDrawFunction · 0.85
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected