MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / GetBounds

Method GetBounds

TheForceEngine/TFE_Polygon/clipper.cpp:1295–1332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1293//------------------------------------------------------------------------------
1294
1295IntRect ClipperBase::GetBounds()
1296{
1297 IntRect result;
1298 MinimaList::iterator lm = m_MinimaList.begin();
1299 if (lm == m_MinimaList.end())
1300 {
1301 result.left = result.top = result.right = result.bottom = 0;
1302 return result;
1303 }
1304 result.left = lm->LeftBound->Bot.X;
1305 result.top = lm->LeftBound->Bot.Y;
1306 result.right = lm->LeftBound->Bot.X;
1307 result.bottom = lm->LeftBound->Bot.Y;
1308 while (lm != m_MinimaList.end())
1309 {
1310 //todo - needs fixing for open paths
1311 result.bottom = std::max(result.bottom, lm->LeftBound->Bot.Y);
1312 TEdge* e = lm->LeftBound;
1313 for (;;) {
1314 TEdge* bottomE = e;
1315 while (e->NextInLML)
1316 {
1317 if (e->Bot.X < result.left) result.left = e->Bot.X;
1318 if (e->Bot.X > result.right) result.right = e->Bot.X;
1319 e = e->NextInLML;
1320 }
1321 result.left = std::min(result.left, e->Bot.X);
1322 result.right = std::max(result.right, e->Bot.X);
1323 result.left = std::min(result.left, e->Top.X);
1324 result.right = std::max(result.right, e->Top.X);
1325 result.top = std::min(result.top, e->Top.Y);
1326 if (bottomE == lm->LeftBound) e = lm->RightBound;
1327 else break;
1328 }
1329 ++lm;
1330 }
1331 return result;
1332}
1333//------------------------------------------------------------------------------
1334
1335void ClipperBase::InsertScanbeam(const cInt Y)

Callers 1

ExecuteMethod · 0.80

Calls 4

maxFunction · 0.85
minFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected