mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
Hopefully faster if not cleaner GLShortBuffer replacement, called gVertexBuffer
This commit is contained in:
parent
cd03544404
commit
fe012a344f
@ -14,8 +14,8 @@ gFlagsGroup::gFlagsGroup()
|
|||||||
{
|
{
|
||||||
//static QColor col=Qt::black;
|
//static QColor col=Qt::black;
|
||||||
|
|
||||||
addGLBuf(quads=new GLShortBuffer(512,GL_QUADS));
|
addVertexBuffer(quads=new gVertexBuffer(512,GL_QUADS));
|
||||||
addGLBuf(lines=new GLShortBuffer(20,GL_LINE_LOOP));
|
addVertexBuffer(lines=new gVertexBuffer(20,GL_LINE_LOOP));
|
||||||
quads->setAntiAlias(true);
|
quads->setAntiAlias(true);
|
||||||
lines->setAntiAlias(false);
|
lines->setAntiAlias(false);
|
||||||
m_barh=0;
|
m_barh=0;
|
||||||
@ -75,17 +75,19 @@ void gFlagsGroup::paint(gGraph &w, int left, int top, int width, int height)
|
|||||||
for (int i=0;i<lvisible.size();i++) {
|
for (int i=0;i<lvisible.size();i++) {
|
||||||
// Alternating box color
|
// Alternating box color
|
||||||
if (i & 1) barcol=&col1; else barcol=&col2;
|
if (i & 1) barcol=&col1; else barcol=&col2;
|
||||||
quads->add(left, linetop, left, linetop+m_barh, left+width-1, linetop+m_barh, left+width-1, linetop, *barcol);
|
quads->add(left, linetop, left, linetop+m_barh, left+width-1, linetop+m_barh, left+width-1, linetop, barcol->rgba());
|
||||||
|
|
||||||
// Paint the actual flags
|
// Paint the actual flags
|
||||||
lvisible[i]->paint(w,left,linetop,width,m_barh);
|
lvisible[i]->paint(w,left,linetop,width,m_barh);
|
||||||
linetop+=m_barh;
|
linetop+=m_barh;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLShortBuffer *outlines=w.lines();
|
gVertexBuffer *outlines=w.lines();
|
||||||
QColor blk=Qt::black;
|
QColor blk=Qt::black;
|
||||||
outlines->add(left-1, top, left-1, top+height, left-1, top+height, left+width,top+height, blk);
|
outlines->add(left-1, top, left-1, top+height, blk.rgba());
|
||||||
outlines->add(left+width,top+height, left+width, top, left+width, top, left-1, top, blk);
|
outlines->add(left-1, top+height, left+width,top+height, blk.rgba());
|
||||||
|
outlines->add(left+width,top+height, left+width, top,blk.rgba());
|
||||||
|
outlines->add(left+width, top, left-1, top, blk.rgba());
|
||||||
|
|
||||||
//lines->add(left-1, top, left-1, top+height);
|
//lines->add(left-1, top, left-1, top+height);
|
||||||
//lines->add(left+width, top+height, left+width, top);
|
//lines->add(left+width, top+height, left+width, top);
|
||||||
@ -94,7 +96,7 @@ void gFlagsGroup::paint(gGraph &w, int left, int top, int width, int height)
|
|||||||
gFlagsLine::gFlagsLine(ChannelID code,QColor flag_color,QString label,bool always_visible,FlagType flt)
|
gFlagsLine::gFlagsLine(ChannelID code,QColor flag_color,QString label,bool always_visible,FlagType flt)
|
||||||
:Layer(code),m_label(label),m_always_visible(always_visible),m_flt(flt),m_flag_color(flag_color)
|
:Layer(code),m_label(label),m_always_visible(always_visible),m_flt(flt),m_flag_color(flag_color)
|
||||||
{
|
{
|
||||||
addGLBuf(quads=new GLShortBuffer(2048,GL_QUADS));
|
addVertexBuffer(quads=new gVertexBuffer(2048,GL_QUADS));
|
||||||
//addGLBuf(lines=new GLBuffer(flag_color,1024,GL_LINES));
|
//addGLBuf(lines=new GLBuffer(flag_color,1024,GL_LINES));
|
||||||
quads->setAntiAlias(true);
|
quads->setAntiAlias(true);
|
||||||
//lines->setAntiAlias(true);
|
//lines->setAntiAlias(true);
|
||||||
@ -138,7 +140,7 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
float bottom=top+height-2;
|
float bottom=top+height-2;
|
||||||
bool verts_exceeded=false;
|
bool verts_exceeded=false;
|
||||||
qint64 X,X2,L;
|
qint64 X,X2,L;
|
||||||
m_flag_color=schema::channel[m_code].defaultColor();
|
lines->setColor(schema::channel[m_code].defaultColor().rgba());
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||||
if (!(*s)->enabled()) continue;
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
if (X > maxx) break;
|
if (X > maxx) break;
|
||||||
x1=(X - minx) * xmult + left;
|
x1=(X - minx) * xmult + left;
|
||||||
if (m_flt==FT_Bar) {
|
if (m_flt==FT_Bar) {
|
||||||
lines->add(x1,bartop,x1,bottom,m_flag_color);
|
lines->add(x1,bartop,x1,bottom);
|
||||||
if (lines->full()) { verts_exceeded=true; break; }
|
if (lines->full()) { verts_exceeded=true; break; }
|
||||||
} else if (m_flt==FT_Span) {
|
} else if (m_flt==FT_Span) {
|
||||||
x2=(X2-minx)*xmult+left;
|
x2=(X2-minx)*xmult+left;
|
||||||
@ -163,7 +165,7 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
x1-=1;
|
x1-=1;
|
||||||
x2+=1;
|
x2+=1;
|
||||||
}*/
|
}*/
|
||||||
quads->add(x2,bartop,x1,bartop, x1,bottom,x2,bottom,m_flag_color);
|
quads->add(x2,bartop,x1,bartop, x1,bottom,x2,bottom,m_flag_color.rgba());
|
||||||
if (quads->full()) { verts_exceeded=true; break; }
|
if (quads->full()) { verts_exceeded=true; break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ class gFlagsLine:public Layer
|
|||||||
int total_lines,line_num;
|
int total_lines,line_num;
|
||||||
FlagType m_flt;
|
FlagType m_flt;
|
||||||
QColor m_flag_color;
|
QColor m_flag_color;
|
||||||
GLShortBuffer *quads, *lines;
|
gVertexBuffer *quads;
|
||||||
|
gVertexBuffer *lines;
|
||||||
int m_lx, m_ly;
|
int m_lx, m_ly;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ public:
|
|||||||
QVector<gFlagsLine *> & visibleLayers() { return lvisible; }
|
QVector<gFlagsLine *> & visibleLayers() { return lvisible; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GLShortBuffer *quads, *lines;
|
gVertexBuffer *quads, *lines;
|
||||||
QVector<gFlagsLine *> lvisible;
|
QVector<gFlagsLine *> lvisible;
|
||||||
float m_barh;
|
float m_barh;
|
||||||
bool m_empty;
|
bool m_empty;
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
gShadowArea::gShadowArea(QColor shadow_color,QColor line_color)
|
gShadowArea::gShadowArea(QColor shadow_color,QColor line_color)
|
||||||
:Layer(NoChannel),m_shadow_color(shadow_color),m_line_color(line_color)
|
:Layer(NoChannel),m_shadow_color(shadow_color),m_line_color(line_color)
|
||||||
{
|
{
|
||||||
addGLBuf(quads=new GLShortBuffer(20,GL_QUADS));
|
addVertexBuffer(quads=new gVertexBuffer(20,GL_QUADS));
|
||||||
addGLBuf(lines=new GLShortBuffer(20,GL_LINES));
|
addVertexBuffer(lines=new gVertexBuffer(20,GL_LINES));
|
||||||
quads->forceAntiAlias(true);
|
quads->forceAntiAlias(true);
|
||||||
lines->setAntiAlias(true);
|
lines->setAntiAlias(true);
|
||||||
lines->setSize(2);
|
lines->setSize(2);
|
||||||
@ -35,11 +35,11 @@ void gShadowArea::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
double px=((1/rmx)*(w.min_x-w.rmin_x))*width;
|
double px=((1/rmx)*(w.min_x-w.rmin_x))*width;
|
||||||
double py=((1/rmx)*(w.max_x-w.rmin_x))*width;
|
double py=((1/rmx)*(w.max_x-w.rmin_x))*width;
|
||||||
|
|
||||||
quads->add(start_px,top,start_px,top+height,start_px+px, top+height, start_px+px, top,m_shadow_color);
|
quads->add(start_px,top,start_px,top+height,start_px+px, top+height, start_px+px, top,m_shadow_color.rgba());
|
||||||
quads->add(start_px+py, top, start_px+py, top+height,end_px, top+height, end_px, top,m_shadow_color);
|
quads->add(start_px+py, top, start_px+py, top+height,end_px, top+height, end_px, top,m_shadow_color.rgba());
|
||||||
|
|
||||||
lines->add(start_px+px, top, start_px+py, top,m_line_color);
|
lines->add(start_px+px, top, start_px+py, top,m_line_color.rgba());
|
||||||
lines->add(start_px+px, top+height+1, start_px+py, top+height+1,m_line_color);
|
lines->add(start_px+px, top+height+1, start_px+py, top+height+1,m_line_color.rgba());
|
||||||
}
|
}
|
||||||
|
|
||||||
gFooBar::gFooBar(int offset,QColor handle_color,QColor line_color)
|
gFooBar::gFooBar(int offset,QColor handle_color,QColor line_color)
|
||||||
|
@ -21,8 +21,8 @@ class gShadowArea:public Layer
|
|||||||
protected:
|
protected:
|
||||||
QColor m_shadow_color;
|
QColor m_shadow_color;
|
||||||
QColor m_line_color;
|
QColor m_line_color;
|
||||||
GLShortBuffer *quads;
|
gVertexBuffer *quads;
|
||||||
GLShortBuffer *lines;
|
gVertexBuffer *lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class gFooBar
|
/*! \class gFooBar
|
||||||
|
@ -137,6 +137,243 @@ int GetXHeight(QFont *font)
|
|||||||
return fm.xHeight();
|
return fm.xHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline quint32 swaporder(quint32 color)
|
||||||
|
{
|
||||||
|
return ((color & 0xFF00FF00) |
|
||||||
|
((color & 0xFF0000) >> 16)|
|
||||||
|
((color & 0xFF) << 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
gVertexBuffer::gVertexBuffer(int max,int type)
|
||||||
|
:m_max(max), m_type(type), m_cnt(0), m_size(1), m_scissor(false), m_stippled(false), m_stipple(0xffff)
|
||||||
|
{
|
||||||
|
buffer=(gVertex *)calloc(max,sizeof(gVertex));
|
||||||
|
m_blendfunc1=GL_SRC_ALPHA;
|
||||||
|
m_blendfunc2=GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
m_antialias=m_forceantialias=false;
|
||||||
|
}
|
||||||
|
gVertexBuffer::~gVertexBuffer()
|
||||||
|
{
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
void gVertexBuffer::setColor(QColor col)
|
||||||
|
{
|
||||||
|
m_color=swaporder(col.rgba());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gVertexBuffer::draw()
|
||||||
|
{
|
||||||
|
bool antialias=m_forceantialias || (PROFILE.appearance->antiAliasing() && m_antialias);
|
||||||
|
if (m_stippled) antialias=false;
|
||||||
|
float size=m_size;
|
||||||
|
|
||||||
|
if (antialias) {
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(m_blendfunc1, m_blendfunc2);
|
||||||
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
size+=0.5;
|
||||||
|
} else if (m_type==GL_POLYGON) {
|
||||||
|
glEnable(GL_POLYGON_SMOOTH);
|
||||||
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
|
if (m_stippled) {
|
||||||
|
glLineStipple(1, m_stipple);
|
||||||
|
//size=1;
|
||||||
|
glEnable(GL_LINE_STIPPLE);
|
||||||
|
} else {
|
||||||
|
//glLineStipple(1, 0xFFFF);
|
||||||
|
}
|
||||||
|
glLineWidth(size);
|
||||||
|
|
||||||
|
} else if (m_type==GL_POINTS) {
|
||||||
|
glPointSize(size);
|
||||||
|
} else if (m_type==GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK,GL_FILL);
|
||||||
|
}
|
||||||
|
if (m_scissor) {
|
||||||
|
glScissor(s_x,s_y,s_width,s_height);
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glVertexPointer(2, GL_SHORT, 8, (GLvoid *)buffer);
|
||||||
|
glColorPointer(4, GL_UNSIGNED_BYTE, 8, ((char *)buffer)+4);
|
||||||
|
|
||||||
|
glDrawArrays(m_type, 0, m_cnt);
|
||||||
|
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
m_cnt=0;
|
||||||
|
if (m_scissor) {
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
m_scissor=false;
|
||||||
|
}
|
||||||
|
if (m_type==GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK,GL_FILL);
|
||||||
|
}
|
||||||
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
|
if (m_stippled) {
|
||||||
|
glDisable(GL_LINE_STIPPLE);
|
||||||
|
glLineStipple(1, 0xFFFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (antialias) {
|
||||||
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
|
glDisable(GL_LINE_SMOOTH);
|
||||||
|
} else if (m_type==GL_POLYGON) {
|
||||||
|
glDisable(GL_POLYGON_SMOOTH);
|
||||||
|
}
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, RGBA color)
|
||||||
|
{
|
||||||
|
if (m_cnt<m_max) {
|
||||||
|
gVertex & v=buffer[m_cnt];
|
||||||
|
|
||||||
|
v.color=swaporder(color);
|
||||||
|
v.x=x1;
|
||||||
|
v.y=y1;
|
||||||
|
|
||||||
|
m_cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, RGBA color)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max-1)) {
|
||||||
|
gVertex * v=&buffer[m_cnt];
|
||||||
|
|
||||||
|
v->x=x1;
|
||||||
|
v->y=y1;
|
||||||
|
v->color=swaporder(color);
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->x=x2;
|
||||||
|
v->y=y2;
|
||||||
|
v->color=swaporder(color);
|
||||||
|
|
||||||
|
m_cnt+=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max-3)) {
|
||||||
|
gVertex *v=&buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color=swaporder(color);
|
||||||
|
v->x=x1;
|
||||||
|
v->y=y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color=swaporder(color);
|
||||||
|
v->x=x2;
|
||||||
|
v->y=y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color=swaporder(color);
|
||||||
|
v->x=x3;
|
||||||
|
v->y=y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color=swaporder(color);
|
||||||
|
v->x=x4;
|
||||||
|
v->y=y4;
|
||||||
|
|
||||||
|
m_cnt+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color1, RGBA color2)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max-3)) {
|
||||||
|
gVertex *v=&buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color=swaporder(color1);
|
||||||
|
v->x=x1;
|
||||||
|
v->y=y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color=swaporder(color1);
|
||||||
|
v->x=x2;
|
||||||
|
v->y=y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color=swaporder(color2);
|
||||||
|
v->x=x3;
|
||||||
|
v->y=y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color=swaporder(color2);
|
||||||
|
v->x=x4;
|
||||||
|
v->y=y4;
|
||||||
|
|
||||||
|
m_cnt+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1)
|
||||||
|
{
|
||||||
|
if (m_cnt<m_max) {
|
||||||
|
gVertex & v=buffer[m_cnt];
|
||||||
|
|
||||||
|
v.color=m_color;
|
||||||
|
v.x=x1;
|
||||||
|
v.y=y1;
|
||||||
|
|
||||||
|
m_cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max-1)) {
|
||||||
|
gVertex * v=&buffer[m_cnt];
|
||||||
|
|
||||||
|
v->x=x1;
|
||||||
|
v->y=y1;
|
||||||
|
v->color=m_color;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->x=x2;
|
||||||
|
v->y=y2;
|
||||||
|
v->color=m_color;
|
||||||
|
|
||||||
|
m_cnt+=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max-3)) {
|
||||||
|
gVertex *v=&buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color=m_color;
|
||||||
|
v->x=x1;
|
||||||
|
v->y=y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color=m_color;
|
||||||
|
v->x=x2;
|
||||||
|
v->y=y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color=m_color;
|
||||||
|
v->x=x3;
|
||||||
|
v->y=y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color=m_color;
|
||||||
|
v->x=x4;
|
||||||
|
v->y=y4;
|
||||||
|
|
||||||
|
m_cnt+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GLBuffer::GLBuffer(int max,int type, bool stippled)
|
GLBuffer::GLBuffer(int max,int type, bool stippled)
|
||||||
:m_max(max), m_type(type), m_stippled(stippled)
|
:m_max(max), m_type(type), m_stippled(stippled)
|
||||||
{
|
{
|
||||||
@ -153,247 +390,6 @@ GLBuffer::GLBuffer(int max,int type, bool stippled)
|
|||||||
GLBuffer::~GLBuffer()
|
GLBuffer::~GLBuffer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
///////
|
|
||||||
|
|
||||||
void GLShortBuffer::add(GLshort x, GLshort y)
|
|
||||||
{
|
|
||||||
if (m_cnt<m_max+2) {
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.lock();
|
|
||||||
#endif
|
|
||||||
buffer[m_cnt++]=x;
|
|
||||||
buffer[m_cnt++]=y;
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.unlock();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
qDebug() << "GLBuffer overflow";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GLShortBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
|
|
||||||
{
|
|
||||||
if (m_cnt<m_max+4) {
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.lock();
|
|
||||||
#endif
|
|
||||||
buffer[m_cnt++]=x1;
|
|
||||||
buffer[m_cnt++]=y1;
|
|
||||||
buffer[m_cnt++]=x2;
|
|
||||||
buffer[m_cnt++]=y2;
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.unlock();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
qDebug() << "GLBuffer overflow";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GLShortBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,GLshort x3, GLshort y3, GLshort x4, GLshort y4)
|
|
||||||
{
|
|
||||||
if (m_cnt<m_max+8) {
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.lock();
|
|
||||||
#endif
|
|
||||||
buffer[m_cnt++]=x1;
|
|
||||||
buffer[m_cnt++]=y1;
|
|
||||||
buffer[m_cnt++]=x2;
|
|
||||||
buffer[m_cnt++]=y2;
|
|
||||||
buffer[m_cnt++]=x3;
|
|
||||||
buffer[m_cnt++]=y3;
|
|
||||||
buffer[m_cnt++]=x4;
|
|
||||||
buffer[m_cnt++]=y4;
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.unlock();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
qDebug() << "GLBuffer overflow";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GLShortBuffer::GLShortBuffer(int max,int type, bool stippled)
|
|
||||||
:GLBuffer(max,type,stippled)
|
|
||||||
{
|
|
||||||
buffer=(GLshort *)calloc(sizeof(GLshort),max+8);
|
|
||||||
colors=(GLubyte *)calloc(sizeof(GLubyte),max*4+(8*4));
|
|
||||||
}
|
|
||||||
GLShortBuffer::~GLShortBuffer()
|
|
||||||
{
|
|
||||||
if (colors) free(colors);
|
|
||||||
if (buffer) free(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLShortBuffer::add(GLshort x, GLshort y,QColor & color)
|
|
||||||
{
|
|
||||||
if (m_cnt<m_max+2) {
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.lock();
|
|
||||||
#endif
|
|
||||||
buffer[m_cnt++]=x;
|
|
||||||
buffer[m_cnt++]=y;
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.unlock();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
qDebug() << "GLBuffer overflow";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GLShortBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,QColor & color)
|
|
||||||
{
|
|
||||||
if (m_cnt<m_max+4) {
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.lock();
|
|
||||||
#endif
|
|
||||||
buffer[m_cnt++]=x1;
|
|
||||||
buffer[m_cnt++]=y1;
|
|
||||||
buffer[m_cnt++]=x2;
|
|
||||||
buffer[m_cnt++]=y2;
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.unlock();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
qDebug() << "GLBuffer overflow";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GLShortBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,GLshort x3, GLshort y3, GLshort x4, GLshort y4,QColor & color) // add with vertex colors
|
|
||||||
{
|
|
||||||
if (m_cnt<m_max+8) {
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.lock();
|
|
||||||
#endif
|
|
||||||
buffer[m_cnt++]=x1;
|
|
||||||
buffer[m_cnt++]=y1;
|
|
||||||
buffer[m_cnt++]=x2;
|
|
||||||
buffer[m_cnt++]=y2;
|
|
||||||
buffer[m_cnt++]=x3;
|
|
||||||
buffer[m_cnt++]=y3;
|
|
||||||
buffer[m_cnt++]=x4;
|
|
||||||
buffer[m_cnt++]=y4;
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
colors[m_colcnt++]=color.red();
|
|
||||||
colors[m_colcnt++]=color.green();
|
|
||||||
colors[m_colcnt++]=color.blue();
|
|
||||||
colors[m_colcnt++]=color.alpha();
|
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
|
||||||
mutex.unlock();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
qDebug() << "GLBuffer overflow";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GLShortBuffer::draw()
|
|
||||||
{
|
|
||||||
if (m_cnt>0) {
|
|
||||||
bool antialias=m_forceantialias || (PROFILE.ExistsAndTrue("UseAntiAliasing") && m_antialias);
|
|
||||||
if (m_stippled) antialias=false;
|
|
||||||
float size=m_size;
|
|
||||||
|
|
||||||
if (antialias) {
|
|
||||||
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
} else {
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(m_blendfunc1, m_blendfunc2);
|
|
||||||
}
|
|
||||||
//glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
|
||||||
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
|
||||||
glEnable(GL_LINE_SMOOTH);
|
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
|
||||||
size+=0.5;
|
|
||||||
} else if (m_type==GL_POLYGON) {
|
|
||||||
glEnable(GL_POLYGON_SMOOTH);
|
|
||||||
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
|
||||||
if (m_stippled) {
|
|
||||||
glLineStipple(1, 0xffff);
|
|
||||||
size=1;
|
|
||||||
glEnable(GL_LINE_STIPPLE);
|
|
||||||
} else {
|
|
||||||
glLineStipple(1, 0xFFFF);
|
|
||||||
}
|
|
||||||
glLineWidth(size);
|
|
||||||
|
|
||||||
} else if (m_type==GL_POINTS) {
|
|
||||||
glPointSize(size);
|
|
||||||
} else if (m_type==GL_POLYGON) {
|
|
||||||
glPolygonMode(GL_BACK,GL_FILL);
|
|
||||||
}
|
|
||||||
if (m_scissor) {
|
|
||||||
glScissor(s1,s2,s3,s4);
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
glVertexPointer(2, GL_SHORT, 0, buffer);
|
|
||||||
|
|
||||||
if (m_colcnt>0) {
|
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
|
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
|
||||||
} else {
|
|
||||||
glColor4ub(m_color.red(),m_color.green(),m_color.blue(),m_color.alpha());
|
|
||||||
}
|
|
||||||
glDrawArrays(m_type, 0, m_cnt >> 1);
|
|
||||||
// glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
if (m_colcnt>0) {
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
}
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
|
||||||
|
|
||||||
//qDebug() << "I Drawed" << m_cnt << "vertices";
|
|
||||||
m_cnt=0;
|
|
||||||
m_colcnt=0;
|
|
||||||
if (m_scissor) {
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
m_scissor=false;
|
|
||||||
}
|
|
||||||
if (m_type==GL_POLYGON) {
|
|
||||||
glPolygonMode(GL_BACK,GL_FILL);
|
|
||||||
}
|
|
||||||
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
|
||||||
if (m_stippled) {
|
|
||||||
glDisable(GL_LINE_STIPPLE);
|
|
||||||
glLineStipple(1, 0xFFFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (antialias) {
|
|
||||||
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
|
||||||
glDisable(GL_LINE_SMOOTH);
|
|
||||||
} else if (m_type==GL_POLYGON) {
|
|
||||||
glDisable(GL_POLYGON_SMOOTH);
|
|
||||||
}
|
|
||||||
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
} else {
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// GLFloatBuffer
|
// GLFloatBuffer
|
||||||
@ -778,6 +774,17 @@ void Layer::drawGLBuf(float linesize)
|
|||||||
float size;
|
float size;
|
||||||
if (!m_visible) return;
|
if (!m_visible) return;
|
||||||
GLBuffer *buf;
|
GLBuffer *buf;
|
||||||
|
gVertexBuffer *vb;
|
||||||
|
for (int i=0;i<mv_buffers.size();i++) {
|
||||||
|
vb=mv_buffers[i];
|
||||||
|
size=vb->size();
|
||||||
|
type=vb->type();
|
||||||
|
if ((linesize>size) && ((type==GL_LINES) || (type==GL_LINE_LOOP))) {
|
||||||
|
vb->setSize(linesize);
|
||||||
|
}
|
||||||
|
vb->draw();
|
||||||
|
vb->setSize(size);
|
||||||
|
}
|
||||||
for (int i=0;i<mgl_buffers.size();i++) {
|
for (int i=0;i<mgl_buffers.size();i++) {
|
||||||
buf=mgl_buffers[i];
|
buf=mgl_buffers[i];
|
||||||
size=buf->size();
|
size=buf->size();
|
||||||
@ -991,7 +998,7 @@ gGraph::gGraph(gGraphView *graphview,QString title,QString units, int height,sho
|
|||||||
m_selecting_area=m_blockzoom=false;
|
m_selecting_area=m_blockzoom=false;
|
||||||
m_lastx23=0;
|
m_lastx23=0;
|
||||||
|
|
||||||
m_quad=new GLShortBuffer(64,GL_QUADS);
|
m_quad=new gVertexBuffer(64,GL_QUADS);
|
||||||
m_quad->forceAntiAlias(true);
|
m_quad->forceAntiAlias(true);
|
||||||
f_miny=f_maxy=0;
|
f_miny=f_maxy=0;
|
||||||
m_enforceMinY=m_enforceMaxY=false;
|
m_enforceMinY=m_enforceMaxY=false;
|
||||||
@ -1172,8 +1179,8 @@ void gGraph::paint(int originX, int originY, int width, int height)
|
|||||||
|
|
||||||
if (m_selection.width()>0 && m_selecting_area) {
|
if (m_selection.width()>0 && m_selecting_area) {
|
||||||
QColor col(128,128,255,128);
|
QColor col(128,128,255,128);
|
||||||
quads()->add(originX+m_selection.x(),originY+top, originX+m_selection.x()+m_selection.width(),originY+top,col);
|
quads()->add(originX+m_selection.x(),originY+top, originX+m_selection.x()+m_selection.width(),originY+top,col.rgba());
|
||||||
quads()->add(originX+m_selection.x()+m_selection.width(),originY+height-bottom, originX+m_selection.x(),originY+height-bottom,col);
|
quads()->add(originX+m_selection.x()+m_selection.width(),originY+height-bottom, originX+m_selection.x(),originY+height-bottom,col.rgba());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void gGraphView::queGraph(gGraph * g,int left, int top, int width, int height)
|
void gGraphView::queGraph(gGraph * g,int left, int top, int width, int height)
|
||||||
@ -1666,22 +1673,25 @@ void gGraph::SetMaxY(EventDataType v)
|
|||||||
{
|
{
|
||||||
rmax_y=max_y=v;
|
rmax_y=max_y=v;
|
||||||
}
|
}
|
||||||
GLShortBuffer * gGraph::lines()
|
gVertexBuffer * gGraph::lines()
|
||||||
{
|
{
|
||||||
return m_graphview->lines;
|
return m_graphview->lines;
|
||||||
}
|
}
|
||||||
GLShortBuffer * gGraph::backlines()
|
gVertexBuffer * gGraph::backlines()
|
||||||
{
|
{
|
||||||
return m_graphview->backlines;
|
return m_graphview->backlines;
|
||||||
}
|
}
|
||||||
GLShortBuffer * gGraph::quads()
|
gVertexBuffer * gGraph::quads()
|
||||||
{
|
{
|
||||||
return m_graphview->quads;
|
return m_graphview->quads;
|
||||||
}
|
}
|
||||||
GLShortBuffer * gGraph::stippled()
|
//GLShortBuffer * gGraph::stippled()
|
||||||
{
|
//{
|
||||||
return m_graphview->stippled;
|
// return m_graphview->stippled;
|
||||||
}
|
//}
|
||||||
|
//gVertexBuffer * gGraph::vlines()
|
||||||
|
//{ return m_graphview->vlines; } // testing new vertexbuffer
|
||||||
|
|
||||||
short gGraph::marginLeft() { return m_marginleft; }//*m_graphview->printScaleX(); }
|
short gGraph::marginLeft() { return m_marginleft; }//*m_graphview->printScaleX(); }
|
||||||
short gGraph::marginRight() { return m_marginright; } //*m_graphview->printScaleX(); }
|
short gGraph::marginRight() { return m_marginright; } //*m_graphview->printScaleX(); }
|
||||||
short gGraph::marginTop() { return m_margintop; } //*m_graphview->printScaleY(); }
|
short gGraph::marginTop() { return m_margintop; } //*m_graphview->printScaleY(); }
|
||||||
@ -1862,13 +1872,16 @@ gGraphView::gGraphView(QWidget *parent, gGraphView * shared) :
|
|||||||
//gt->start();
|
//gt->start();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
lines=new GLShortBuffer(100000,GL_LINES); // big fat shared line list
|
lines=new gVertexBuffer(100000,GL_LINES); // big fat shared line list
|
||||||
backlines=new GLShortBuffer(10000,GL_LINES); // big fat shared line list
|
backlines=new gVertexBuffer(10000,GL_LINES); // big fat shared line list
|
||||||
quads=new GLShortBuffer(1024,GL_QUADS); // big fat shared line list
|
quads=new gVertexBuffer(1024,GL_QUADS); // big fat shared line list
|
||||||
quads->forceAntiAlias(true);
|
quads->forceAntiAlias(true);
|
||||||
stippled=new GLShortBuffer(20000,GL_LINES,true);
|
frontlines=new gVertexBuffer(20000,GL_LINES);
|
||||||
stippled->setSize(1.5);
|
|
||||||
stippled->forceAntiAlias(false);
|
//vlines=new gVertexBuffer(20000,GL_LINES);
|
||||||
|
|
||||||
|
//stippled->setSize(1.5);
|
||||||
|
//stippled->forceAntiAlias(false);
|
||||||
//lines->setSize(1.5);
|
//lines->setSize(1.5);
|
||||||
//backlines->setSize(1.5);
|
//backlines->setSize(1.5);
|
||||||
|
|
||||||
@ -1905,7 +1918,9 @@ gGraphView::~gGraphView()
|
|||||||
}
|
}
|
||||||
delete m_tooltip;
|
delete m_tooltip;
|
||||||
m_graphs.clear();
|
m_graphs.clear();
|
||||||
delete stippled;
|
//delete vlines;
|
||||||
|
//delete stippled;
|
||||||
|
delete frontlines;
|
||||||
delete lines;
|
delete lines;
|
||||||
delete backlines;
|
delete backlines;
|
||||||
delete quads;
|
delete quads;
|
||||||
@ -2423,11 +2438,11 @@ bool gGraphView::renderGraphs()
|
|||||||
if (m_showsplitter) {
|
if (m_showsplitter) {
|
||||||
// draw the splitter handle
|
// draw the splitter handle
|
||||||
QColor ca=QColor(128,128,128,255);
|
QColor ca=QColor(128,128,128,255);
|
||||||
backlines->add(0, py+h, w, py+h, ca);
|
backlines->add(0, py+h, w, py+h, ca.rgba());
|
||||||
ca=QColor(192,192,192,255);
|
ca=QColor(192,192,192,255);
|
||||||
backlines->add(0, py+h+1, w, py+h+1, ca);
|
backlines->add(0, py+h+1, w, py+h+1, ca.rgba());
|
||||||
ca=QColor(90,90,90,255);
|
ca=QColor(90,90,90,255);
|
||||||
backlines->add(0, py+h+2, w, py+h+2, ca);
|
backlines->add(0, py+h+2, w, py+h+2, ca.rgba());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2458,9 +2473,8 @@ bool gGraphView::renderGraphs()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//int elapsed=time.elapsed();
|
//int elapsed=time.elapsed();
|
||||||
QColor col=Qt::black;
|
//QColor col=Qt::black;
|
||||||
|
|
||||||
stippled->draw();
|
|
||||||
backlines->draw();
|
backlines->draw();
|
||||||
for (int i=0;i<m_graphs.size();i++) {
|
for (int i=0;i<m_graphs.size();i++) {
|
||||||
m_graphs[i]->drawGLBuf();
|
m_graphs[i]->drawGLBuf();
|
||||||
@ -2670,7 +2684,7 @@ void gGraphView::paintGL()
|
|||||||
int w,h;
|
int w,h;
|
||||||
GetTextExtent(ss,w,h);
|
GetTextExtent(ss,w,h);
|
||||||
QColor col=Qt::white;
|
QColor col=Qt::white;
|
||||||
quads->add(width()-m_graphs[0]->marginRight(),0,width()-m_graphs[0]->marginRight(),w,width(),w,width(),0,col);
|
quads->add(width()-m_graphs[0]->marginRight(),0,width()-m_graphs[0]->marginRight(),w,width(),w,width(),0,col.rgba());
|
||||||
quads->draw();
|
quads->draw();
|
||||||
AddTextQue(ss,width()+3,w/2,90,col,defaultfont);
|
AddTextQue(ss,width()+3,w/2,90,col,defaultfont);
|
||||||
DrawTextQue();
|
DrawTextQue();
|
||||||
|
@ -53,6 +53,95 @@ class gGraph;
|
|||||||
|
|
||||||
const int textque_max=512;
|
const int textque_max=512;
|
||||||
|
|
||||||
|
typedef quint32 RGBA;
|
||||||
|
/*union RGBA {
|
||||||
|
struct {
|
||||||
|
GLubyte red;
|
||||||
|
GLubyte green;
|
||||||
|
GLubyte blue;
|
||||||
|
GLubyte alpha;
|
||||||
|
} bytes;
|
||||||
|
quint32 value;
|
||||||
|
}; */
|
||||||
|
|
||||||
|
#ifdef BUILD_WITH_MSVC
|
||||||
|
__declspec(align(1))
|
||||||
|
#endif
|
||||||
|
struct gVertex
|
||||||
|
{
|
||||||
|
gVertex(GLshort _x, GLshort _y, GLuint _c) { x=_x; y=_y; color=_c; }
|
||||||
|
GLshort x;
|
||||||
|
GLshort y;
|
||||||
|
RGBA color;
|
||||||
|
}
|
||||||
|
#ifndef BUILD_WITH_MSVC
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
class gVertexBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gVertexBuffer(int max=2048,int type=GL_LINES);
|
||||||
|
~gVertexBuffer();
|
||||||
|
|
||||||
|
void add(GLshort x1, GLshort y1, RGBA color);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, RGBA color);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color, RGBA color2);
|
||||||
|
|
||||||
|
void add(GLshort x1, GLshort y1);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4);
|
||||||
|
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
void scissor(GLshort x, GLshort y, GLshort width, GLshort height) { s_x=x; s_y=y; s_width=width; s_height=height; m_scissor=true; }
|
||||||
|
|
||||||
|
void reset() { m_cnt=0; }
|
||||||
|
int Max() { return m_max; }
|
||||||
|
int cnt() { return m_cnt; }
|
||||||
|
GLuint type() { return m_type; }
|
||||||
|
float size() { return m_size; }
|
||||||
|
bool full() { return m_cnt>=m_max; }
|
||||||
|
|
||||||
|
void forceAntiAlias(bool b) { m_forceantialias=b; }
|
||||||
|
void setSize(float f) { m_size=f; }
|
||||||
|
void setAntiAlias(bool b) { m_antialias=b; }
|
||||||
|
void setStipple(GLshort stipple) { m_stipple=stipple; }
|
||||||
|
void setStippleOn(bool b) { m_stippled=b; }
|
||||||
|
void setColor(QColor col);
|
||||||
|
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1=b1; m_blendfunc2=b2; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \brief Maximum number of gVertex points contained in buffer
|
||||||
|
int m_max;
|
||||||
|
//! \brief Indicates type of GL vertex information (GL_LINES, GL_QUADS, etc)
|
||||||
|
GLuint m_type;
|
||||||
|
//! \brief Count of Vertex points used this draw cycle.
|
||||||
|
int m_cnt;
|
||||||
|
//! \brief Line/Point thickness
|
||||||
|
float m_size;
|
||||||
|
|
||||||
|
bool m_scissor;
|
||||||
|
bool m_antialias;
|
||||||
|
bool m_forceantialias;
|
||||||
|
bool m_stippled;
|
||||||
|
|
||||||
|
//! \brief Contains list of Vertex & Color points
|
||||||
|
gVertex * buffer;
|
||||||
|
//! \brief GL Scissor parameters
|
||||||
|
GLshort s_x,s_y,s_width,s_height;
|
||||||
|
//! \brief Current drawing color
|
||||||
|
GLuint m_color;
|
||||||
|
//! \brief Stipple bitfield
|
||||||
|
GLshort m_stipple;
|
||||||
|
//! \brief Source GL Blend Function
|
||||||
|
GLuint m_blendfunc1;
|
||||||
|
//! \brief Destination GL Blend Function
|
||||||
|
GLuint m_blendfunc2;
|
||||||
|
};
|
||||||
|
|
||||||
/*! \class GLBuffer
|
/*! \class GLBuffer
|
||||||
\brief Base Object to hold an OpenGL draw list
|
\brief Base Object to hold an OpenGL draw list
|
||||||
*/
|
*/
|
||||||
@ -90,9 +179,8 @@ protected:
|
|||||||
GLuint m_blendfunc1, m_blendfunc2;
|
GLuint m_blendfunc1, m_blendfunc2;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class GLShortBuffer
|
/* ! \class GLShortBuffer
|
||||||
\brief Holds an OpenGL draw list composed of 16bit integers and vertex colors
|
\brief Holds an OpenGL draw list composed of 16bit integers and vertex colors
|
||||||
*/
|
|
||||||
class GLShortBuffer:public GLBuffer
|
class GLShortBuffer:public GLBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -117,6 +205,7 @@ protected:
|
|||||||
GLshort * buffer;
|
GLshort * buffer;
|
||||||
GLubyte * colors;
|
GLubyte * colors;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
/*! \class GLFloatBuffer
|
/*! \class GLFloatBuffer
|
||||||
\brief Holds an OpenGL draw list composed of 32bit GLfloat objects and vertex colors
|
\brief Holds an OpenGL draw list composed of 32bit GLfloat objects and vertex colors
|
||||||
@ -268,6 +357,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
//! \brief Add a GLBuffer (vertex) object customized to this layer
|
//! \brief Add a GLBuffer (vertex) object customized to this layer
|
||||||
void addGLBuf(GLBuffer *buf) { mgl_buffers.push_back(buf); }
|
void addGLBuf(GLBuffer *buf) { mgl_buffers.push_back(buf); }
|
||||||
|
void addVertexBuffer(gVertexBuffer *buf) { mv_buffers.push_back(buf); }
|
||||||
//QRect bounds; // bounds, relative to top of individual graph.
|
//QRect bounds; // bounds, relative to top of individual graph.
|
||||||
Day *m_day;
|
Day *m_day;
|
||||||
bool m_visible;
|
bool m_visible;
|
||||||
@ -284,6 +374,7 @@ protected:
|
|||||||
|
|
||||||
//! \brief A vector containing all this layers custom drawing buffers
|
//! \brief A vector containing all this layers custom drawing buffers
|
||||||
QVector<GLBuffer *> mgl_buffers;
|
QVector<GLBuffer *> mgl_buffers;
|
||||||
|
QVector<gVertexBuffer *> mv_buffers;
|
||||||
|
|
||||||
//! \brief Mouse wheel moved somewhere over this layer
|
//! \brief Mouse wheel moved somewhere over this layer
|
||||||
virtual bool wheelEvent(QWheelEvent * event) { Q_UNUSED(event); return false; }
|
virtual bool wheelEvent(QWheelEvent * event) { Q_UNUSED(event); return false; }
|
||||||
@ -605,14 +696,20 @@ public:
|
|||||||
//! \brief Returns this graphs bottom margin
|
//! \brief Returns this graphs bottom margin
|
||||||
short marginBottom();
|
short marginBottom();
|
||||||
|
|
||||||
//! \brief Returns the main gGraphView objects GLShortBuffer line list.
|
//! \brief Returns the main gGraphView objects gVertexBuffer line list.
|
||||||
GLShortBuffer * lines();
|
gVertexBuffer * lines();
|
||||||
//! \brief Returns the main gGraphView objects GLShortBuffer background line list.
|
//! \brief Returns the main gGraphView objects gVertexBuffer background line list.
|
||||||
GLShortBuffer * backlines();
|
gVertexBuffer * backlines();
|
||||||
//! \brief Returns the main gGraphView objects GLShortBuffer quads list.
|
//! \brief Returns the main gGraphView objects gVertexBuffer front line list.
|
||||||
GLShortBuffer * quads();
|
gVertexBuffer * frontlines();
|
||||||
//! \brief Returns the main gGraphView objects GLShortBuffer stippled line list.
|
//! \brief Returns the main gGraphView objects gVertexBuffer quads list.
|
||||||
GLShortBuffer * stippled();
|
gVertexBuffer * quads();
|
||||||
|
|
||||||
|
// //! \brief Returns the main gGraphView objects gVertexBuffer stippled line list.
|
||||||
|
//GLShortBuffer * stippled();
|
||||||
|
|
||||||
|
//gVertexBuffer * vlines(); // testing new vertexbuffer
|
||||||
|
|
||||||
short left,right,top,bottom; // dirty magin hacks..
|
short left,right,top,bottom; // dirty magin hacks..
|
||||||
|
|
||||||
Layer * getLineChart();
|
Layer * getLineChart();
|
||||||
@ -666,7 +763,7 @@ protected:
|
|||||||
short m_group;
|
short m_group;
|
||||||
short m_lastx23;
|
short m_lastx23;
|
||||||
Day * m_day;
|
Day * m_day;
|
||||||
GLBuffer * m_quad;
|
gVertexBuffer * m_quad;
|
||||||
bool m_enforceMinY,m_enforceMaxY;
|
bool m_enforceMinY,m_enforceMaxY;
|
||||||
bool m_showTitle;
|
bool m_showTitle;
|
||||||
bool m_printing;
|
bool m_printing;
|
||||||
@ -829,7 +926,7 @@ public:
|
|||||||
//! \brief Sends day object to be distributed to all Graphs Layers objects
|
//! \brief Sends day object to be distributed to all Graphs Layers objects
|
||||||
void setDay(Day * day);
|
void setDay(Day * day);
|
||||||
|
|
||||||
GLShortBuffer * lines, * backlines, *quads, * stippled;
|
gVertexBuffer *lines, *backlines, *quads, *frontlines;
|
||||||
|
|
||||||
//! \brief pops a graph off the list for multithreaded drawing code
|
//! \brief pops a graph off the list for multithreaded drawing code
|
||||||
gGraph * popGraph(); // exposed for multithreaded drawing
|
gGraph * popGraph(); // exposed for multithreaded drawing
|
||||||
|
@ -18,15 +18,13 @@ gLineChart::gLineChart(ChannelID code,QColor col,bool square_plot, bool disable_
|
|||||||
addPlot(code,col,square_plot);
|
addPlot(code,col,square_plot);
|
||||||
m_line_color=col;
|
m_line_color=col;
|
||||||
m_report_empty=false;
|
m_report_empty=false;
|
||||||
addGLBuf(lines=new GLShortBuffer(100000,GL_LINES));
|
addVertexBuffer(lines=new gVertexBuffer(100000,GL_LINES));
|
||||||
lines->setColor(col);
|
lines->setColor(col);
|
||||||
lines->setAntiAlias(true);
|
lines->setAntiAlias(true);
|
||||||
lines->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
lines->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
gLineChart::~gLineChart()
|
gLineChart::~gLineChart()
|
||||||
{
|
{
|
||||||
//delete lines;
|
|
||||||
//delete outlines;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gLineChart::isEmpty()
|
bool gLineChart::isEmpty()
|
||||||
@ -162,8 +160,8 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
int minz,maxz;
|
int minz,maxz;
|
||||||
|
|
||||||
// Draw bounding box
|
// Draw bounding box
|
||||||
GLShortBuffer *outlines=w.lines();
|
gVertexBuffer *outlines=w.lines();
|
||||||
QColor blk=Qt::black;
|
GLuint blk=QColor(Qt::black).rgba();
|
||||||
outlines->add(left, top, left, top+height, blk);
|
outlines->add(left, top, left, top+height, blk);
|
||||||
outlines->add(left, top+height, left+width,top+height, blk);
|
outlines->add(left, top+height, left+width,top+height, blk);
|
||||||
outlines->add(left+width,top+height, left+width, top, blk);
|
outlines->add(left+width,top+height, left+width, top, blk);
|
||||||
@ -183,9 +181,12 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
int legendx=left+width;
|
int legendx=left+width;
|
||||||
|
|
||||||
int codepoints;
|
int codepoints;
|
||||||
|
//GLuint color;
|
||||||
for (int gi=0;gi<m_codes.size();gi++) {
|
for (int gi=0;gi<m_codes.size();gi++) {
|
||||||
ChannelID code=m_codes[gi];
|
ChannelID code=m_codes[gi];
|
||||||
m_line_color=m_colors[gi];
|
//m_line_color=m_colors[gi];
|
||||||
|
lines->setColor(m_colors[gi]);
|
||||||
|
//color=m_line_color.rgba();
|
||||||
|
|
||||||
codepoints=0;
|
codepoints=0;
|
||||||
for (int svi=0;svi<m_day->size();svi++) {
|
for (int svi=0;svi<m_day->size();svi++) {
|
||||||
@ -393,7 +394,7 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
// ay1=(m_drawlist[i-1].y()+m_drawlist[i].y()+m_drawlist[i+1].y())/3.0;
|
// ay1=(m_drawlist[i-1].y()+m_drawlist[i].y()+m_drawlist[i+1].y())/3.0;
|
||||||
ax1=m_drawlist[i].x();
|
ax1=m_drawlist[i].x();
|
||||||
ay1=m_drawlist[i].y();
|
ay1=m_drawlist[i].y();
|
||||||
lines->add(xst+i,yst-ax1,xst+i,yst-ay1,m_line_color);
|
lines->add(xst+i,yst-ax1,xst+i,yst-ay1);
|
||||||
|
|
||||||
if (lines->full()) break;
|
if (lines->full()) break;
|
||||||
}
|
}
|
||||||
@ -422,7 +423,7 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
firstpx=false;
|
firstpx=false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lines->add(lastpx,lastpy,px,py,m_line_color);
|
lines->add(lastpx,lastpy,px,py);
|
||||||
|
|
||||||
if (lines->full()) {
|
if (lines->full()) {
|
||||||
done=true;
|
done=true;
|
||||||
@ -457,7 +458,7 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
px=xst+((time2 - minx) * xmult);
|
px=xst+((time2 - minx) * xmult);
|
||||||
if (px>xst+width) px=xst+width;
|
if (px>xst+width) px=xst+width;
|
||||||
|
|
||||||
lines->add(lastpx,lastpy,px,py,m_line_color);
|
lines->add(lastpx,lastpy,px,py);
|
||||||
} else*/
|
} else*/
|
||||||
for (int i=0;i<siz;i++) {
|
for (int i=0;i<siz;i++) {
|
||||||
|
|
||||||
@ -485,15 +486,15 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
if (lastpx<xst) lastpx=xst;
|
if (lastpx<xst) lastpx=xst;
|
||||||
if (px>xst+width) px=xst+width;
|
if (px>xst+width) px=xst+width;
|
||||||
if (square_plot) {
|
if (square_plot) {
|
||||||
lines->add(lastpx,lastpy,px,lastpy,px,lastpy,px,py,m_line_color);
|
lines->add(lastpx,lastpy,px,lastpy,px,lastpy,px,py);
|
||||||
} else {
|
} else {
|
||||||
lines->add(lastpx,lastpy,px,py,m_line_color);
|
lines->add(lastpx,lastpy,px,py);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (square_plot) {
|
if (square_plot) {
|
||||||
lines->add(lastpx,lastpy,px,lastpy,px,lastpy,px,py,m_line_color);
|
lines->add(lastpx,lastpy,px,lastpy,px,lastpy,px,py);
|
||||||
} else {
|
} else {
|
||||||
lines->add(lastpx,lastpy,px,py,m_line_color);
|
lines->add(lastpx,lastpy,px,py);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +529,7 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
legendx-=bw/2;
|
legendx-=bw/2;
|
||||||
|
|
||||||
int tp=top-5-bw/2;
|
int tp=top-5-bw/2;
|
||||||
w.quads()->add(legendx-bw,tp+bw/2,legendx,tp+bw/2,legendx,tp-bw/2,legendx-bw,tp-bw/2,m_line_color);
|
w.quads()->add(legendx-bw,tp+bw/2,legendx,tp+bw/2,legendx,tp-bw/2,legendx-bw,tp-bw/2,m_line_color.rgba());
|
||||||
legendx-=hi+bw/2;
|
legendx-=hi+bw/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,7 +552,7 @@ AHIChart::AHIChart(const QColor col)
|
|||||||
:Layer(NoChannel),m_color(col)
|
:Layer(NoChannel),m_color(col)
|
||||||
{
|
{
|
||||||
m_miny=m_maxy=0;
|
m_miny=m_maxy=0;
|
||||||
addGLBuf(lines=new GLShortBuffer(100000,GL_LINES));
|
addVertexBuffer(lines=new gVertexBuffer(100000,GL_LINES));
|
||||||
lines->setColor(col);
|
lines->setColor(col);
|
||||||
lines->setAntiAlias(true);
|
lines->setAntiAlias(true);
|
||||||
lines->setSize(1.5);
|
lines->setSize(1.5);
|
||||||
@ -570,8 +571,8 @@ void AHIChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Draw bounding box
|
// Draw bounding box
|
||||||
GLShortBuffer *outlines=w.lines();
|
gVertexBuffer *outlines=w.lines();
|
||||||
QColor blk=Qt::black;
|
GLuint blk=QColor(Qt::black).rgba();
|
||||||
outlines->add(left, top, left, top+height, blk);
|
outlines->add(left, top, left, top+height, blk);
|
||||||
outlines->add(left, top+height, left+width,top+height, blk);
|
outlines->add(left, top+height, left+width,top+height, blk);
|
||||||
outlines->add(left+width,top+height, left+width, top, blk);
|
outlines->add(left+width,top+height, left+width, top, blk);
|
||||||
@ -600,6 +601,7 @@ void AHIChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
double lastpx,lastpy;
|
double lastpx,lastpy;
|
||||||
double top1=top+height;
|
double top1=top+height;
|
||||||
bool done=false;
|
bool done=false;
|
||||||
|
GLuint color=m_color.rgba();
|
||||||
for (int i=0;i<m_time.size();i++) {
|
for (int i=0;i<m_time.size();i++) {
|
||||||
qint64 ti=m_time[i];
|
qint64 ti=m_time[i];
|
||||||
EventDataType v=m_data[i];
|
EventDataType v=m_data[i];
|
||||||
@ -617,7 +619,7 @@ void AHIChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
} else {
|
} else {
|
||||||
px=left+(double(ti-minx)*xmult);
|
px=left+(double(ti-minx)*xmult);
|
||||||
py=top1-(double(v-miny)*ymult);
|
py=top1-(double(v-miny)*ymult);
|
||||||
lines->add(px,py,lastpx,lastpy,m_color);
|
lines->add(px,py,lastpx,lastpy);
|
||||||
}
|
}
|
||||||
lastpx=px;
|
lastpx=px;
|
||||||
lastpy=py;
|
lastpy=py;
|
||||||
|
@ -49,7 +49,7 @@ protected:
|
|||||||
EventDataType m_miny;
|
EventDataType m_miny;
|
||||||
EventDataType m_maxy;
|
EventDataType m_maxy;
|
||||||
QColor m_color;
|
QColor m_color;
|
||||||
GLShortBuffer * lines;
|
gVertexBuffer * lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class gLineChart
|
/*! \class gLineChart
|
||||||
@ -116,8 +116,9 @@ protected:
|
|||||||
bool m_disable_accel;
|
bool m_disable_accel;
|
||||||
QColor m_line_color;
|
QColor m_line_color;
|
||||||
|
|
||||||
GLShortBuffer * lines;
|
gVertexBuffer * lines;
|
||||||
GLShortBuffer * outlines;
|
//GLShortBuffer * lines;
|
||||||
|
//GLShortBuffer * outlines;
|
||||||
|
|
||||||
//! \brief Used by accelerated waveform plots. Must be >= Screen Resolution (or at least graph width)
|
//! \brief Used by accelerated waveform plots. Must be >= Screen Resolution (or at least graph width)
|
||||||
static const int max_drawlist_size=10000;
|
static const int max_drawlist_size=10000;
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
gLineOverlayBar::gLineOverlayBar(ChannelID code,QColor color,QString label,FlagType flt)
|
gLineOverlayBar::gLineOverlayBar(ChannelID code,QColor color,QString label,FlagType flt)
|
||||||
:Layer(code),m_flag_color(color),m_label(label),m_flt(flt)
|
:Layer(code),m_flag_color(color),m_label(label),m_flt(flt)
|
||||||
{
|
{
|
||||||
addGLBuf(points=new GLShortBuffer(2048,GL_POINTS));
|
addVertexBuffer(points=new gVertexBuffer(2048,GL_POINTS));
|
||||||
points->setSize(4);
|
points->setSize(4);
|
||||||
points->setColor(m_flag_color);
|
points->setColor(m_flag_color);
|
||||||
addGLBuf(quads=new GLShortBuffer(2048,GL_QUADS));
|
addVertexBuffer(quads=new gVertexBuffer(2048,GL_QUADS));
|
||||||
//addGLBuf(lines=new GLBuffer(color,1024,GL_LINES));
|
//addGLBuf(lines=new GLBuffer(color,1024,GL_LINES));
|
||||||
points->setAntiAlias(true);
|
points->setAntiAlias(true);
|
||||||
quads->setAntiAlias(true);
|
quads->setAntiAlias(true);
|
||||||
@ -33,7 +33,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
|||||||
if (!m_visible) return;
|
if (!m_visible) return;
|
||||||
if (!m_day) return;
|
if (!m_day) return;
|
||||||
|
|
||||||
lines=w.lines();
|
gVertexBuffer * lines=w.lines();
|
||||||
int start_py=topp;
|
int start_py=topp;
|
||||||
|
|
||||||
double xx=w.max_x-w.min_x;
|
double xx=w.max_x-w.min_x;
|
||||||
@ -56,10 +56,13 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
|||||||
m_sum=0;
|
m_sum=0;
|
||||||
m_flag_color=schema::channel[m_code].defaultColor();
|
m_flag_color=schema::channel[m_code].defaultColor();
|
||||||
|
|
||||||
|
lines->setColor(m_flag_color);
|
||||||
|
points->setColor(m_flag_color);
|
||||||
if (m_flt==FT_Span) {
|
if (m_flt==FT_Span) {
|
||||||
m_flag_color.setAlpha(128);
|
m_flag_color.setAlpha(128);
|
||||||
}
|
}
|
||||||
EventStoreType raw;
|
EventStoreType raw;
|
||||||
|
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||||
if (!(*s)->enabled()) continue;
|
if (!(*s)->enabled()) continue;
|
||||||
cei=(*s)->eventlist.find(m_code);
|
cei=(*s)->eventlist.find(m_code);
|
||||||
@ -92,7 +95,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
|||||||
if (x2<left) x2=left;
|
if (x2<left) x2=left;
|
||||||
if (x1>width+left) x1=width+left;
|
if (x1>width+left) x1=width+left;
|
||||||
//double w1=x2-x1;
|
//double w1=x2-x1;
|
||||||
quads->add(x2,start_py, x1,start_py, x1,start_py+height, x2,start_py+height,m_flag_color);
|
quads->add(x2,start_py, x1,start_py, x1,start_py+height, x2,start_py+height,m_flag_color.rgba());
|
||||||
if (quads->full()) { verts_exceeded=true; break; }
|
if (quads->full()) { verts_exceeded=true; break; }
|
||||||
} else if (m_flt==FT_Dot) {
|
} else if (m_flt==FT_Dot) {
|
||||||
if ((PROFILE.appearance->overlayType()==ODT_Bars) || (xx<3600000)) {
|
if ((PROFILE.appearance->overlayType()==ODT_Bars) || (xx<3600000)) {
|
||||||
@ -101,7 +104,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
|||||||
if (points->full()) { verts_exceeded=true; break; }
|
if (points->full()) { verts_exceeded=true; break; }
|
||||||
} else {
|
} else {
|
||||||
// thin lines down the bottom
|
// thin lines down the bottom
|
||||||
lines->add(x1,start_py+1,x1,start_py+1+12,m_flag_color);
|
lines->add(x1,start_py+1,x1,start_py+1+12);
|
||||||
if (lines->full()) { verts_exceeded=true; break; }
|
if (lines->full()) { verts_exceeded=true; break; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -111,10 +114,10 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
|||||||
z=top;
|
z=top;
|
||||||
|
|
||||||
points->add(x1,top);
|
points->add(x1,top);
|
||||||
lines->add(x1,top,x1,bottom,m_flag_color);
|
lines->add(x1,top,x1,bottom);
|
||||||
if (points->full()) { verts_exceeded=true; break; }
|
if (points->full()) { verts_exceeded=true; break; }
|
||||||
} else {
|
} else {
|
||||||
lines->add(x1,z,x1,z-12,m_flag_color);
|
lines->add(x1,z,x1,z-12);
|
||||||
}
|
}
|
||||||
if (lines->full()) { verts_exceeded=true; break; }
|
if (lines->full()) { verts_exceeded=true; break; }
|
||||||
if (xx<(1800000)) {
|
if (xx<(1800000)) {
|
||||||
|
@ -40,7 +40,8 @@ class gLineOverlayBar:public Layer
|
|||||||
int m_count;
|
int m_count;
|
||||||
double m_sum;
|
double m_sum;
|
||||||
|
|
||||||
GLShortBuffer *points,*quads, *lines;
|
gVertexBuffer *quads;
|
||||||
|
gVertexBuffer *points;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class gLineOverlaySummary
|
/*! \class gLineOverlaySummary
|
||||||
|
@ -100,8 +100,8 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
bool line_first=true;
|
bool line_first=true;
|
||||||
int line_last;
|
int line_last;
|
||||||
|
|
||||||
GLShortBuffer *quads=w.quads();
|
gVertexBuffer *quads=w.quads();
|
||||||
GLShortBuffer *lines2=w.lines();
|
gVertexBuffer *lines2=w.lines();
|
||||||
for (unsigned m=0;m<size;m++) {
|
for (unsigned m=0;m<size;m++) {
|
||||||
data=m_values[m];
|
data=m_values[m];
|
||||||
|
|
||||||
@ -157,11 +157,11 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
QColor & col=m_colors[m % m_colors.size()];
|
QColor & col=m_colors[m % m_colors.size()];
|
||||||
float bw=xmult*float(data);
|
float bw=xmult*float(data);
|
||||||
|
|
||||||
quads->add(xp,start_py,xp+bw,start_py,m_gradient_color);
|
quads->add(xp,start_py,xp+bw,start_py,m_gradient_color.rgba());
|
||||||
quads->add(xp+bw,start_py+height,xp,start_py+height,col);
|
quads->add(xp+bw,start_py+height,xp,start_py+height,col.rgba());
|
||||||
|
|
||||||
lines2->add(xp,start_py,xp+bw,start_py,m_outline_color);
|
lines2->add(xp,start_py,xp+bw,start_py,m_outline_color.rgba());
|
||||||
lines2->add(xp+bw,start_py+height,xp,start_py+height,m_outline_color);
|
lines2->add(xp+bw,start_py+height,xp,start_py+height,m_outline_color.rgba());
|
||||||
|
|
||||||
if (!m_names[m].isEmpty()) {
|
if (!m_names[m].isEmpty()) {
|
||||||
int px,py;
|
int px,py;
|
||||||
|
@ -51,6 +51,8 @@ protected:
|
|||||||
QColor m_gradient_color;
|
QColor m_gradient_color;
|
||||||
QColor m_outline_color;
|
QColor m_outline_color;
|
||||||
bool m_empty;
|
bool m_empty;
|
||||||
|
|
||||||
|
// gah.. can't convert these
|
||||||
GLFloatBuffer *poly,*lines;
|
GLFloatBuffer *poly,*lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ SummaryChart::SummaryChart(QString label,GraphType type)
|
|||||||
:Layer(NoChannel),m_label(label),m_graphtype(type)
|
:Layer(NoChannel),m_label(label),m_graphtype(type)
|
||||||
{
|
{
|
||||||
//QColor color=Qt::black;
|
//QColor color=Qt::black;
|
||||||
addGLBuf(quads=new GLShortBuffer(20000,GL_QUADS));
|
addVertexBuffer(quads=new gVertexBuffer(20000,GL_QUADS));
|
||||||
addGLBuf(lines=new GLShortBuffer(20000,GL_LINES));
|
addVertexBuffer(lines=new gVertexBuffer(20000,GL_LINES));
|
||||||
quads->forceAntiAlias(true);
|
quads->forceAntiAlias(true);
|
||||||
lines->setSize(1.5);
|
lines->setSize(2);
|
||||||
lines->setBlendFunc(GL_ONE, GL_ONE);
|
lines->setBlendFunc(GL_SRC_COLOR, GL_ZERO);
|
||||||
lines->forceAntiAlias(false);
|
lines->forceAntiAlias(false);
|
||||||
|
|
||||||
m_empty=true;
|
m_empty=true;
|
||||||
@ -313,10 +313,10 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
if (!m_visible) return;
|
if (!m_visible) return;
|
||||||
|
|
||||||
rtop=top;
|
rtop=top;
|
||||||
GLShortBuffer *outlines=w.lines();
|
gVertexBuffer *outlines=w.lines();
|
||||||
QColor blk=Qt::black;
|
outlines->setColor(Qt::black);
|
||||||
outlines->add(left, top, left, top+height, left, top+height, left+width,top+height, blk);
|
outlines->add(left, top, left, top+height, left, top+height, left+width,top+height);
|
||||||
outlines->add(left+width,top+height, left+width, top, left+width, top, left, top, blk);
|
outlines->add(left+width,top+height, left+width, top, left+width, top, left, top);
|
||||||
//if (outlines->full()) qDebug() << "WTF??? Outlines full in SummaryChart::paint()";
|
//if (outlines->full()) qDebug() << "WTF??? Outlines full in SummaryChart::paint()";
|
||||||
|
|
||||||
qint64 minx=w.min_x, maxx=w.max_x;
|
qint64 minx=w.min_x, maxx=w.max_x;
|
||||||
@ -439,7 +439,7 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
if (x2<x1)
|
if (x2<x1)
|
||||||
goto jumpnext;
|
goto jumpnext;
|
||||||
//continue;
|
//continue;
|
||||||
ChannelID code;
|
//ChannelID code;
|
||||||
|
|
||||||
if (m_graphtype==GT_SESSIONS) {
|
if (m_graphtype==GT_SESSIONS) {
|
||||||
int j;
|
int j;
|
||||||
@ -450,7 +450,9 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
if (zd==hl_day) {
|
if (zd==hl_day) {
|
||||||
col=QColor("gold");
|
col=QColor("gold");
|
||||||
}
|
}
|
||||||
QColor col2=brighten(col);
|
GLuint col1=col.rgba();
|
||||||
|
GLuint col2=brighten(col).rgba();
|
||||||
|
outlines->setColor(Qt::black);
|
||||||
|
|
||||||
for (j=0;j<d.value().size();j++) {
|
for (j=0;j<d.value().size();j++) {
|
||||||
tmp2=times.value()[j]-miny;
|
tmp2=times.value()[j]-miny;
|
||||||
@ -461,11 +463,10 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
//tmp-=miny;
|
//tmp-=miny;
|
||||||
h=tmp*ymult;
|
h=tmp*ymult;
|
||||||
|
|
||||||
quads->add(x1,py,x1,py-h,col);
|
quads->add(x1,py,x1,py-h,x2,py-h,x2,py,col1,col2);
|
||||||
quads->add(x2,py-h,x2,py,col2);
|
|
||||||
if (h>0 && barw>2) {
|
if (h>0 && barw>2) {
|
||||||
outlines->add(x1,py,x1,py-h,x1,py-h,x2,py-h,blk);
|
outlines->add(x1,py,x1,py-h,x1,py-h,x2,py-h);
|
||||||
outlines->add(x1,py,x2,py,x2,py,x2,py-h,blk);
|
outlines->add(x1,py,x2,py,x2,py,x2,py-h);
|
||||||
} // if (bar
|
} // if (bar
|
||||||
//py-=h;
|
//py-=h;
|
||||||
totalvalues[0]+=tmp;
|
totalvalues[0]+=tmp;
|
||||||
@ -526,18 +527,21 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
h=tmp*ymult; // height in pixels
|
h=tmp*ymult; // height in pixels
|
||||||
|
|
||||||
if (m_graphtype==GT_BAR) {
|
if (m_graphtype==GT_BAR) {
|
||||||
QColor col2=brighten(col);
|
GLuint col1=col.rgba();
|
||||||
|
GLuint col2=brighten(col).rgba();
|
||||||
|
|
||||||
quads->add(x1,py,x1,py-h,col);
|
quads->add(x1,py,x1,py-h,col1);
|
||||||
quads->add(x2,py-h,x2,py,col2);
|
quads->add(x2,py-h,x2,py,col2);
|
||||||
if (h>0 && barw>2) {
|
if (h>0 && barw>2) {
|
||||||
outlines->add(x1,py,x1,py-h,x1,py-h,x2,py-h,blk);
|
outlines->add(x1,py,x1,py-h,x1,py-h,x2,py-h);
|
||||||
outlines->add(x1,py,x2,py,x2,py,x2,py-h,blk);
|
outlines->add(x1,py,x2,py,x2,py,x2,py-h);
|
||||||
if (outlines->full()) qDebug() << "WTF??? Outlines full in SummaryChart::paint()";
|
if (outlines->full()) qDebug() << "WTF??? Outlines full in SummaryChart::paint()";
|
||||||
} // if (bar
|
} // if (bar
|
||||||
py-=h;
|
py-=h;
|
||||||
} else if (m_graphtype==GT_LINE) { // if (m_graphtype==GT_BAR
|
} else if (m_graphtype==GT_LINE) { // if (m_graphtype==GT_BAR
|
||||||
col.setAlpha(128);
|
col.setAlpha(128);
|
||||||
|
GLuint col1=col.rgba();
|
||||||
|
GLuint col2=m_colors[j].rgba();
|
||||||
px2=px+barw;
|
px2=px+barw;
|
||||||
py2=(top+height-2)-h;
|
py2=(top+height-2)-h;
|
||||||
//py2+=j;
|
//py2+=j;
|
||||||
@ -547,11 +551,12 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
lastdaygood=false;
|
lastdaygood=false;
|
||||||
}
|
}
|
||||||
if (lastdaygood) {
|
if (lastdaygood) {
|
||||||
if (lastY[j]!=py2) // vertical line
|
if (lastY[j]!=py2) {// vertical line
|
||||||
lines->add(lastX[j],lastY[j],px,py2,m_colors[j]);
|
lines->add(lastX[j],lastY[j],px,py2,col2);
|
||||||
lines->add(px-1,py2,px2+1,py2,col);
|
}
|
||||||
|
lines->add(px-1,py2,px2+1,py2,col1);
|
||||||
} else {
|
} else {
|
||||||
lines->add(x1-1,py2,x2+1,py2,col);
|
lines->add(x1-1,py2,x2+1,py2,col1);
|
||||||
}
|
}
|
||||||
lastX[j]=px2;
|
lastX[j]=px2;
|
||||||
lastY[j]=py2;
|
lastY[j]=py2;
|
||||||
@ -629,7 +634,7 @@ jumpnext:
|
|||||||
float wt=20*w.printScaleX();
|
float wt=20*w.printScaleX();
|
||||||
px-=wt+x;
|
px-=wt+x;
|
||||||
w.renderText(a,px+wt,py+1);
|
w.renderText(a,px+wt,py+1);
|
||||||
quads->add(px+wt-y/4-y,py-y,px+wt-y/4,py-y,px+wt-y/4,py+1,px+wt-y/4-y,py+1,m_colors[j]);
|
quads->add(px+wt-y/4-y,py-y,px+wt-y/4,py-y,px+wt-y/4,py+1,px+wt-y/4-y,py+1,m_colors[j].rgba());
|
||||||
//lines->add(px,py,px+20,py,m_colors[j]);
|
//lines->add(px,py,px+20,py,m_colors[j]);
|
||||||
//lines->add(px,py+1,px+20,py+1,m_colors[j]);
|
//lines->add(px,py+1,px+20,py+1,m_colors[j]);
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ class SummaryChart:public Layer
|
|||||||
QHash<int,EventDataType> m_hours;
|
QHash<int,EventDataType> m_hours;
|
||||||
QHash<int,Day *> m_days;
|
QHash<int,Day *> m_days;
|
||||||
|
|
||||||
GLShortBuffer *quads;
|
gVertexBuffer *quads;
|
||||||
GLShortBuffer *lines;
|
gVertexBuffer *lines;
|
||||||
bool m_empty;
|
bool m_empty;
|
||||||
int m_fday;
|
int m_fday;
|
||||||
QString m_label;
|
QString m_label;
|
||||||
|
@ -135,8 +135,8 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
aligned_start+=step;
|
aligned_start+=step;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor linecol=Qt::black;
|
gVertexBuffer *lines=w.backlines();
|
||||||
GLShortBuffer *lines=w.backlines();
|
lines->setColor(Qt::black);
|
||||||
|
|
||||||
|
|
||||||
//int utcoff=m_utcfix ? tz_hours : 0;
|
//int utcoff=m_utcfix ? tz_hours : 0;
|
||||||
@ -163,13 +163,13 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
for (int i=0;i<num_minor_ticks;i++) {
|
for (int i=0;i<num_minor_ticks;i++) {
|
||||||
py-=step_pixels;
|
py-=step_pixels;
|
||||||
if (py<start_px) continue;
|
if (py<start_px) continue;
|
||||||
lines->add(py,top,py,mintop,linecol);
|
lines->add(py,top,py,mintop);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (qint64 i=aligned_start;i<maxx;i+=step) {
|
for (qint64 i=aligned_start;i<maxx;i+=step) {
|
||||||
px=(i-minx)*xmult;
|
px=(i-minx)*xmult;
|
||||||
px+=left;
|
px+=left;
|
||||||
lines->add(px,top,px,majtop,linecol);
|
lines->add(px,top,px,majtop);
|
||||||
qint64 j=i;
|
qint64 j=i;
|
||||||
if (!m_utcfix) j+=tz_offset;
|
if (!m_utcfix) j+=tz_offset;
|
||||||
int ms=j % 1000;
|
int ms=j % 1000;
|
||||||
@ -206,7 +206,7 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
for (int j=1;j<num_minor_ticks;j++) {
|
for (int j=1;j<num_minor_ticks;j++) {
|
||||||
py+=step_pixels;
|
py+=step_pixels;
|
||||||
if (py>=left+width) break;
|
if (py>=left+width) break;
|
||||||
lines->add(py,top,py,mintop,linecol);
|
lines->add(py,top,py,mintop);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines->full()) {
|
if (lines->full()) {
|
||||||
|
@ -31,7 +31,7 @@ gXGrid::~gXGrid()
|
|||||||
}
|
}
|
||||||
void gXGrid::paint(gGraph & w,int left,int top, int width, int height)
|
void gXGrid::paint(gGraph & w,int left,int top, int width, int height)
|
||||||
{
|
{
|
||||||
GLShortBuffer * stippled, * lines;
|
gVertexBuffer * stippled, * lines;
|
||||||
|
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
@ -91,13 +91,13 @@ void gXGrid::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stippled=w.stippled();
|
stippled=w.backlines();
|
||||||
lines=w.backlines();
|
lines=w.backlines();
|
||||||
for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) {
|
for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) {
|
||||||
ty=(i - miny) * ymult;
|
ty=(i - miny) * ymult;
|
||||||
h=top+height-ty;
|
h=top+height-ty;
|
||||||
if (m_show_major_lines && (i > miny)) {
|
if (m_show_major_lines && (i > miny)) {
|
||||||
stippled->add(left,h,left+width,h,m_major_color);
|
stippled->add(left,h,left+width,h,m_major_color.rgba());
|
||||||
}
|
}
|
||||||
double z=(min_ytick/4)*ymult;
|
double z=(min_ytick/4)*ymult;
|
||||||
double g=h;
|
double g=h;
|
||||||
@ -109,7 +109,7 @@ void gXGrid::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
if (m_show_minor_lines) {// && (i > miny)) {
|
if (m_show_minor_lines) {// && (i > miny)) {
|
||||||
stippled->add(left,g,left+width,g,m_minor_color);
|
stippled->add(left,g,left+width,g,m_minor_color.rgba());
|
||||||
}
|
}
|
||||||
if (stippled->full()) {
|
if (stippled->full()) {
|
||||||
break;
|
break;
|
||||||
@ -200,7 +200,7 @@ void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
}
|
}
|
||||||
lines=w.backlines();
|
lines=w.backlines();
|
||||||
|
|
||||||
|
GLuint line_color=m_line_color.rgba();
|
||||||
for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) {
|
for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) {
|
||||||
ty=(i - miny) * ymult;
|
ty=(i - miny) * ymult;
|
||||||
if (dy<5) {
|
if (dy<5) {
|
||||||
@ -216,14 +216,14 @@ void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
|
|||||||
if (h<top) continue;
|
if (h<top) continue;
|
||||||
w.renderText(fd,left+width-8-x,(h+(y/2.0)),0,m_text_color);
|
w.renderText(fd,left+width-8-x,(h+(y/2.0)),0,m_text_color);
|
||||||
|
|
||||||
lines->add(left+width-4,h,left+width,h,m_line_color);
|
lines->add(left+width-4,h,left+width,h,line_color);
|
||||||
|
|
||||||
double z=(min_ytick/4)*ymult;
|
double z=(min_ytick/4)*ymult;
|
||||||
double g=h;
|
double g=h;
|
||||||
for (int i=0;i<3;i++) {
|
for (int i=0;i<3;i++) {
|
||||||
g+=z;
|
g+=z;
|
||||||
if (g>top+height) break;
|
if (g>top+height) break;
|
||||||
lines->add(left+width-3,g,left+width,g,m_line_color);
|
lines->add(left+width-3,g,left+width,g,line_color);
|
||||||
if (lines->full()) {
|
if (lines->full()) {
|
||||||
qWarning() << "vertarray bounds exceeded in gYAxis for " << w.title() << "graph" << "MinY =" <<miny << "MaxY =" << maxy << "min_ytick=" <<min_ytick;
|
qWarning() << "vertarray bounds exceeded in gYAxis for " << w.title() << "graph" << "MinY =" <<miny << "MaxY =" << maxy << "min_ytick=" <<min_ytick;
|
||||||
break;
|
break;
|
||||||
|
@ -109,7 +109,7 @@ class gYAxis:public Layer
|
|||||||
|
|
||||||
QColor m_line_color;
|
QColor m_line_color;
|
||||||
QColor m_text_color;
|
QColor m_text_color;
|
||||||
GLShortBuffer * lines;
|
gVertexBuffer * lines;
|
||||||
virtual bool mouseMoveEvent(QMouseEvent * event);
|
virtual bool mouseMoveEvent(QMouseEvent * event);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -12,6 +12,7 @@ License: GPL
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "profiles.h"
|
#include "profiles.h"
|
||||||
|
@ -584,7 +584,7 @@ void Daily::on_calendar_selectionChanged()
|
|||||||
// GraphView->fadeOut();
|
// GraphView->fadeOut();
|
||||||
Unload(previous_date);
|
Unload(previous_date);
|
||||||
}
|
}
|
||||||
bool fadedir=previous_date < ui->calendar->selectedDate();
|
//bool fadedir=previous_date < ui->calendar->selectedDate();
|
||||||
ZombieMeterMoved=false;
|
ZombieMeterMoved=false;
|
||||||
Load(ui->calendar->selectedDate());
|
Load(ui->calendar->selectedDate());
|
||||||
//GraphView->fadeIn(fadedir);
|
//GraphView->fadeIn(fadedir);
|
||||||
@ -929,14 +929,11 @@ void Daily::Load(QDate date)
|
|||||||
CPAP_TidalVolume, OXI_Pulse, OXI_SPO2
|
CPAP_TidalVolume, OXI_Pulse, OXI_SPO2
|
||||||
};
|
};
|
||||||
int numchans=sizeof(chans)/sizeof(ChannelID);
|
int numchans=sizeof(chans)/sizeof(ChannelID);
|
||||||
int suboffset=0;
|
//int suboffset=0;
|
||||||
for (int i=0;i<numchans;i++) {
|
for (int i=0;i<numchans;i++) {
|
||||||
|
|
||||||
ChannelID code=chans[i];
|
ChannelID code=chans[i];
|
||||||
if (cpap && cpap->channelHasData(code)) {
|
if (cpap && cpap->channelHasData(code)) {
|
||||||
if (code==CPAP_RespRate) {
|
|
||||||
int i=5;
|
|
||||||
}
|
|
||||||
//if (code==CPAP_LeakTotal) suboffset=PROFILEIntentionalLeak"].toDouble(); else suboffset=0;
|
//if (code==CPAP_LeakTotal) suboffset=PROFILEIntentionalLeak"].toDouble(); else suboffset=0;
|
||||||
QString tooltip=schema::channel[code].description();
|
QString tooltip=schema::channel[code].description();
|
||||||
if (!schema::channel[code].units().isEmpty()) tooltip+=" ("+schema::channel[code].units()+")";
|
if (!schema::channel[code].units().isEmpty()) tooltip+=" ("+schema::channel[code].units()+")";
|
||||||
|
@ -2295,9 +2295,3 @@ void MainWindow::on_summaryView_linkClicked(const QUrl &arg1)
|
|||||||
qDebug() << arg1;
|
qDebug() << arg1;
|
||||||
on_recordsBox_linkClicked(arg1);
|
on_recordsBox_linkClicked(arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_summaryView_urlChanged(const QUrl &arg1)
|
|
||||||
{
|
|
||||||
// qDebug() << arg1;
|
|
||||||
// on_recordsBox_linkClicked(arg1);
|
|
||||||
}
|
|
||||||
|
@ -275,8 +275,6 @@ private slots:
|
|||||||
|
|
||||||
void on_summaryView_linkClicked(const QUrl &arg1);
|
void on_summaryView_linkClicked(const QUrl &arg1);
|
||||||
|
|
||||||
void on_summaryView_urlChanged(const QUrl &arg1);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
Loading…
Reference in New Issue
Block a user