mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-28 21:37:50 +02:00
Bugfix
This commit is contained in:
@ -1,9 +1,17 @@
|
||||
#include <gui/widgets/symbol_diagram.h>
|
||||
|
||||
namespace ImGui {
|
||||
SymbolDiagram::SymbolDiagram(float scale) {
|
||||
SymbolDiagram::SymbolDiagram(float scale, int count) {
|
||||
_scale = scale;
|
||||
memset(buffer, 0, 1024 * sizeof(float));
|
||||
sampleCount = count;
|
||||
|
||||
buffer = new float[count];
|
||||
|
||||
memset(buffer, 0, sampleCount * sizeof(float));
|
||||
}
|
||||
|
||||
SymbolDiagram::~SymbolDiagram() {
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
void SymbolDiagram::draw(const ImVec2& size_arg) {
|
||||
@ -23,9 +31,9 @@ namespace ImGui {
|
||||
|
||||
window->DrawList->AddRectFilled(min, ImVec2(min.x+size.x, min.y+size.y), IM_COL32(0,0,0,255));
|
||||
ImU32 col = ImGui::GetColorU32(ImGuiCol_CheckMark, 0.7f);
|
||||
float increment = size.x / 1024.0f;
|
||||
float increment = size.x / (float)sampleCount;
|
||||
float val;
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
for (int i = 0; i < sampleCount; i++) {
|
||||
val = buffer[i] * _scale;
|
||||
if (val > 1.0f || val < -1.0f) { continue; }
|
||||
window->DrawList->AddCircleFilled(ImVec2(((float)i * increment) + min.x, ((val + 1) * (size.y*0.5f)) + min.y), 2, col);
|
||||
|
@ -8,7 +8,8 @@
|
||||
namespace ImGui {
|
||||
class SymbolDiagram {
|
||||
public:
|
||||
SymbolDiagram(float _scale = 1.0f);
|
||||
SymbolDiagram(float _scale = 1.0f, int count = 1024);
|
||||
~SymbolDiagram();
|
||||
|
||||
void draw(const ImVec2& size_arg = ImVec2(0, 0));
|
||||
|
||||
@ -18,8 +19,9 @@ namespace ImGui {
|
||||
|
||||
private:
|
||||
std::mutex bufferMtx;
|
||||
float buffer[1024];
|
||||
float* buffer;
|
||||
float _scale;
|
||||
int sampleCount = 0;
|
||||
|
||||
};
|
||||
}
|
@ -682,6 +682,7 @@ namespace ImGui {
|
||||
|
||||
if (waterfallVisible) {
|
||||
FFTAreaHeight = std::min<int>(FFTAreaHeight, widgetSize.y - 50);
|
||||
newFFTAreaHeight = FFTAreaHeight;
|
||||
fftHeight = FFTAreaHeight - 50;
|
||||
waterfallHeight = widgetSize.y - fftHeight - 52;
|
||||
}
|
||||
|
Reference in New Issue
Block a user