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