MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / FixRectCornerFlags

Function FixRectCornerFlags

KBotExt/imgui/imgui_draw.cpp:1316–1348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1314
1315IM_STATIC_ASSERT(ImDrawFlags_RoundCornersTopLeft == (1 << 4));
1316static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)
1317{
1318#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1319 // Obsoleted in 1.82 (from February 2021)
1320 // Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All)
1321 // ~0 --> ImDrawFlags_RoundCornersAll or 0
1322 if (flags == ~0)
1323 return ImDrawFlags_RoundCornersAll;
1324
1325 // Legacy Support for hard coded 0x01 to 0x0F (matching 15 out of 16 old flags combinations)
1326 // 0x01 --> ImDrawFlags_RoundCornersTopLeft (VALUE 0x01 OVERLAPS ImDrawFlags_Closed but ImDrawFlags_Closed is never valid in this path!)
1327 // 0x02 --> ImDrawFlags_RoundCornersTopRight
1328 // 0x03 --> ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight
1329 // 0x04 --> ImDrawFlags_RoundCornersBotLeft
1330 // 0x05 --> ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBotLeft
1331 // ...
1332 // 0x0F --> ImDrawFlags_RoundCornersAll or 0
1333 // (See all values in ImDrawCornerFlags_)
1334 if (flags >= 0x01 && flags <= 0x0F)
1335 return (flags << 4);
1336
1337 // We cannot support hard coded 0x00 with 'float rounding > 0.0f' --> replace with ImDrawFlags_RoundCornersNone or use 'float rounding = 0.0f'
1338#endif
1339
1340 // If this triggers, please update your code replacing hardcoded values with new ImDrawFlags_RoundCorners* values.
1341 // Note that ImDrawFlags_Closed (== 0x01) is an invalid flag for AddRect(), AddRectFilled(), PathRect() etc...
1342 IM_ASSERT((flags & 0x0F) == 0 && "Misuse of legacy hardcoded ImDrawCornerFlags values!");
1343
1344 if ((flags & ImDrawFlags_RoundCornersMask_) == 0)
1345 flags |= ImDrawFlags_RoundCornersAll;
1346
1347 return flags;
1348}
1349
1350void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags)
1351{

Callers 2

PathRectMethod · 0.85
AddImageRoundedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected