MCPcopy Create free account
hub / github.com/RenderKit/embree / FixRectCornerFlags

Function FixRectCornerFlags

tutorials/common/imgui/imgui_draw.cpp:1313–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

PathRectMethod · 0.85
AddImageRoundedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected