mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Remove even more sprintf with snprintf
This commit is contained in:
parent
57f46bfc00
commit
96412c79fe
19
.vscode/c_cpp_properties.json
vendored
Normal file
19
.vscode/c_cpp_properties.json
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Mac",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"${workspaceFolder}/../Specter/Specter/vendor/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"macFrameworkPath": [
|
||||||
|
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
|
||||||
|
],
|
||||||
|
"compilerPath": "/usr/bin/clang",
|
||||||
|
"intelliSenseMode": "macos-clang-x64",
|
||||||
|
"cppStandard": "c++20"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
|
@ -1815,7 +1815,7 @@ void PlotPieChart(const char* const label_ids[], const T* values, int count, dou
|
||||||
double percent = normalize ? (double)values[i] / sum : (double)values[i];
|
double percent = normalize ? (double)values[i] / sum : (double)values[i];
|
||||||
a1 = a0 + 2 * IM_PI * percent;
|
a1 = a0 + 2 * IM_PI * percent;
|
||||||
if (item->Show) {
|
if (item->Show) {
|
||||||
sprintf(buffer, fmt, (double)values[i]);
|
snprintf(buffer, sizeof(buffer), fmt, (double)values[i]);
|
||||||
ImVec2 size = ImGui::CalcTextSize(buffer);
|
ImVec2 size = ImGui::CalcTextSize(buffer);
|
||||||
double angle = a0 + (a1 - a0) * 0.5;
|
double angle = a0 + (a1 - a0) * 0.5;
|
||||||
ImVec2 pos = PlotToPixels(center.x + 0.5 * radius * cos(angle), center.y + 0.5 * radius * sin(angle),IMPLOT_AUTO,IMPLOT_AUTO);
|
ImVec2 pos = PlotToPixels(center.x + 0.5 * radius * cos(angle), center.y + 0.5 * radius * sin(angle),IMPLOT_AUTO,IMPLOT_AUTO);
|
||||||
|
@ -1978,7 +1978,7 @@ void RenderHeatmap(Transformer transformer, ImDrawList& DrawList, const T* value
|
||||||
p.y = yref + ydir * (0.5*h + r*h);
|
p.y = yref + ydir * (0.5*h + r*h);
|
||||||
ImVec2 px = transformer(p);
|
ImVec2 px = transformer(p);
|
||||||
char buff[32];
|
char buff[32];
|
||||||
sprintf(buff, fmt, values[i]);
|
snprintf(buff, sizeof(buff), fmt, values[i]);
|
||||||
ImVec2 size = ImGui::CalcTextSize(buff);
|
ImVec2 size = ImGui::CalcTextSize(buff);
|
||||||
double t = ImClamp(ImRemap01((double)values[i], scale_min, scale_max),0.0,1.0);
|
double t = ImClamp(ImRemap01((double)values[i], scale_min, scale_max),0.0,1.0);
|
||||||
ImVec4 color = SampleColormap((float)t);
|
ImVec4 color = SampleColormap((float)t);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user