| 3157 | } |
| 3158 | |
| 3159 | void ImGui::PopStyleVar(int count) |
| 3160 | { |
| 3161 | ImGuiContext& g = *GImGui; |
| 3162 | if (g.StyleVarStack.Size < count) |
| 3163 | { |
| 3164 | IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times: stack underflow."); |
| 3165 | count = g.StyleVarStack.Size; |
| 3166 | } |
| 3167 | while (count > 0) |
| 3168 | { |
| 3169 | // We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it. |
| 3170 | ImGuiStyleMod& backup = g.StyleVarStack.back(); |
| 3171 | const ImGuiDataVarInfo* info = GetStyleVarInfo(backup.VarIdx); |
| 3172 | void* data = info->GetVarPtr(&g.Style); |
| 3173 | if (info->Type == ImGuiDataType_Float && info->Count == 1) { ((float*)data)[0] = backup.BackupFloat[0]; } |
| 3174 | else if (info->Type == ImGuiDataType_Float && info->Count == 2) { ((float*)data)[0] = backup.BackupFloat[0]; ((float*)data)[1] = backup.BackupFloat[1]; } |
| 3175 | g.StyleVarStack.pop_back(); |
| 3176 | count--; |
| 3177 | } |
| 3178 | } |
| 3179 | |
| 3180 | const char* ImGui::GetStyleColorName(ImGuiCol idx) |
| 3181 | { |