1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

GLScopeNG: suppress VLAs

This commit is contained in:
f4exb 2018-03-01 02:33:18 +01:00
parent c9fd26f661
commit 9c882a59aa
2 changed files with 40 additions and 10 deletions

View File

@ -213,7 +213,8 @@ void GLScopeNG::paintGL()
{
tickList = &m_y1Scale.getTickList();
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickY1.m_array;
int effectiveTicks = 0;
for (int i= 0; i < tickList->count(); i++)
@ -243,7 +244,8 @@ void GLScopeNG::paintGL()
{
tickList = &m_x1Scale.getTickList();
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickX1.m_array;
int effectiveTicks = 0;
for(int i= 0; i < tickList->count(); i++) {
tick = &(*tickList)[i];
@ -386,7 +388,8 @@ void GLScopeNG::paintGL()
{
tickList = &m_y2Scale.getTickList();
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickY2.m_array;
int effectiveTicks = 0;
for (int i= 0; i < tickList->count(); i++)
@ -416,7 +419,8 @@ void GLScopeNG::paintGL()
{
tickList = &m_x2Scale.getTickList();
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickX2.m_array;
int effectiveTicks = 0;
for(int i= 0; i < tickList->count(); i++) {
tick = &(*tickList)[i];
@ -566,7 +570,8 @@ void GLScopeNG::paintGL()
// Horizontal Y1
tickList = &m_y1Scale.getTickList();
{
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickY1.m_array;
int effectiveTicks = 0;
for (int i= 0; i < tickList->count(); i++)
@ -594,7 +599,8 @@ void GLScopeNG::paintGL()
// Vertical X1
tickList = &m_x1Scale.getTickList();
{
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickX1.m_array;
int effectiveTicks = 0;
for(int i= 0; i < tickList->count(); i++) {
tick = &(*tickList)[i];
@ -655,7 +661,8 @@ void GLScopeNG::paintGL()
// Horizontal Y2
tickList = &m_y2Scale.getTickList();
{
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickY2.m_array;
int effectiveTicks = 0;
for(int i= 0; i < tickList->count(); i++) {
tick = &(*tickList)[i];
@ -782,7 +789,8 @@ void GLScopeNG::paintGL()
// Horizontal Y2
tickList = &m_y2Scale.getTickList();
{
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickY2.m_array;
int effectiveTicks = 0;
for(int i= 0; i < tickList->count(); i++) {
tick = &(*tickList)[i];
@ -805,7 +813,8 @@ void GLScopeNG::paintGL()
// Vertical X2
tickList = &m_x2Scale.getTickList();
{
GLfloat q3[4*tickList->count()];
//GLfloat q3[4*tickList->count()];
GLfloat *q3 = m_q3TickX2.m_array;
int effectiveTicks = 0;
for(int i= 0; i < tickList->count(); i++) {
tick = &(*tickList)[i];
@ -871,7 +880,8 @@ void GLScopeNG::paintGL()
if(end - start < 2)
start--;
GLfloat q3[2*(end - start)];
//GLfloat q3[2*(end - start)];
GLfloat *q3 = m_q3Polar.m_array;
const float *trace0 = (*m_traces)[0];
memcpy(q3, &(trace0[2*start+1]), (2*(end - start) - 1)*sizeof(float)); // copy X values
@ -1018,6 +1028,19 @@ void GLScopeNG::applyConfig()
{
setPolarDisplays();
}
m_q3TickY1.allocate(4*m_y1Scale.getTickList().count());
m_q3TickY2.allocate(4*m_y2Scale.getTickList().count());
m_q3TickX1.allocate(4*m_x1Scale.getTickList().count());
m_q3TickX2.allocate(4*m_x1Scale.getTickList().count());
int start = (m_timeOfsProMill/1000.0) * m_traceSize;
int end = std::min(start + m_traceSize/m_timeBase, m_traceSize);
if(end - start < 2)
start--;
m_q3Polar.allocate(2*(end - start));
}
void GLScopeNG::setUniqueDisplays()

View File

@ -31,6 +31,7 @@
#include "gui/glshadertextured.h"
#include "util/export.h"
#include "util/bitfieldindex.h"
#include "util/incrementalarray.h"
class QPainter;
@ -131,6 +132,12 @@ private:
GLShaderTextured m_glShaderBottom2Scale;
GLShaderTextured m_glShaderPowerOverlay;
IncrementalArray<GLfloat> m_q3Polar;
IncrementalArray<GLfloat> m_q3TickY1;
IncrementalArray<GLfloat> m_q3TickY2;
IncrementalArray<GLfloat> m_q3TickX1;
IncrementalArray<GLfloat> m_q3TickX2;
static const int m_topMargin = 5;
static const int m_botMargin = 20;
static const int m_leftMargin = 35;