Hopefully solve some rare font black box issues

This commit is contained in:
Mark Watkins 2011-08-26 02:20:33 +10:00
parent 2cbe6f49c2
commit b8014fdaca
4 changed files with 21 additions and 16 deletions

View File

@ -76,8 +76,8 @@ void gFlagsGroup::paint(gGraph &w, int left, int top, int width, int height)
}
// Draw the outer rectangle outline
glLineWidth(1);
glBegin(GL_LINE_LOOP);
glLineWidth(1);
w.qglColor(Qt::black);
glVertex2f(left-1, top);
glVertex2f(left-1, top+height);
@ -176,6 +176,8 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
// glScissor(left,top,width,height);
//glEnable(GL_SCISSOR_TEST);
glEnableClientState(GL_VERTEX_ARRAY);
bool antialias=pref["UseAntiAliasing"].toBool();
if (antialias) {
glEnable(GL_BLEND);
@ -185,7 +187,6 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
glLineWidth (1.5);
} else glLineWidth (1);
glEnableClientState(GL_VERTEX_ARRAY);
w.qglColor(m_flag_color);
if (quadcnt>0) {
glVertexPointer(2, GL_SHORT, 0, quadarray);
@ -195,11 +196,11 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
glVertexPointer(2, GL_SHORT, 0, vertarray);
glDrawArrays(GL_LINES, 0, vertcnt>>1);
}
glDisableClientState(GL_VERTEX_ARRAY);
if (antialias) {
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
glDisableClientState(GL_VERTEX_ARRAY);
//glDisable(GL_SCISSOR_TEST);
}

View File

@ -24,7 +24,6 @@ void gShadowArea::paint(gGraph & w,int left, int top, int width, int height)
int start_px=left;
int end_px=left+width;
glDisable(GL_DEPTH_TEST);
float h=top;
double rmx=w.rmax_x-w.rmin_x;
@ -33,8 +32,8 @@ void gShadowArea::paint(gGraph & w,int left, int top, int width, int height)
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
w.qglColor(m_shadow_color);
glVertex2f(start_px, top);
@ -46,8 +45,8 @@ void gShadowArea::paint(gGraph & w,int left, int top, int width, int height)
glVertex2f(start_px+py, top+height);
glVertex2f(end_px, top+height);
glVertex2f(end_px, top);
glDisable(GL_BLEND);
glEnd();
glDisable(GL_BLEND);
//glFlush();
}
@ -71,11 +70,10 @@ void gFooBar::paint(gGraph & w,int left, int top, int width, int height)
int start_px=left;
int end_px=left+width;
glDisable(GL_DEPTH_TEST);
float h=top;
glLineWidth(1);
glBegin(GL_LINES);
glLineWidth(1);
w.qglColor(m_line_color);
glVertex2f(start_px, h);
glVertex2f(start_px+width, h);
@ -85,8 +83,8 @@ void gFooBar::paint(gGraph & w,int left, int top, int width, int height)
double px=((1/rmx)*(w.min_x-w.rmin_x))*width;
double py=((1/rmx)*(w.max_x-w.rmin_x))*width;
glLineWidth(4);
glBegin(GL_LINES);
glLineWidth(4);
w.qglColor(m_handle_color);
glVertex2f(start_px+px-4,h);
glVertex2f(start_px+py+4,h);

View File

@ -221,6 +221,11 @@ void gGraph::renderText(QString text, int x,int y, float angle, QColor color, QF
// I tried queuing this but got crappy memory leaks.. for now I don't give a crap if this is slow.
QPainter *painter=m_graphview->painter;
glPushAttrib(GL_COLOR_BUFFER_BIT);
glEnable(GL_BLEND);
//glEnable(GL_TEXTURE_2D);
//glEnable(GL_DEPTH_BUFFER);
painter->endNativePainting();
QBrush b(color);
painter->setBrush(b);
@ -238,8 +243,10 @@ void gGraph::renderText(QString text, int x,int y, float angle, QColor color, QF
painter->translate(-x,-y);
}
painter->beginNativePainting();
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_BUFFER);
glDisable(GL_BLEND);
//glDisable(GL_TEXTURE_2D);
glPopAttrib();
//glEnable(GL_DEPTH_BUFFER);
}
@ -310,16 +317,16 @@ void gGraph::paint(int originX, int originY, int width, int height)
if (m_selection.width()>0 && m_selecting_area) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
glColor4ub(128,128,128,128);
glVertex2i(originX+m_selection.x(),originY+top);
glVertex2i(originX+m_selection.x()+m_selection.width(),originY+top);
glColor4ub(128,128,255,128);
glVertex2i(originX+m_selection.x()+m_selection.width(),originY+height-top-bottom);
glVertex2i(originX+m_selection.x(),originY+height-top-bottom);
glDisable(GL_BLEND);
glEnd();
glDisable(GL_BLEND);
}
}

View File

@ -93,7 +93,6 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
quadarray[quadcnt++]=start_py+height;
quadarray[quadcnt++]=x1;
quadarray[quadcnt++]=start_py+height;
qDebug()<< x1 << x2 << start_py << height;
if (quadcnt>=maxverts) { verts_exceeded=true; break; }
} else if (m_flt==FT_Dot) {
//if (pref["AlwaysShowOverlayBars"].toBool()) {
@ -147,7 +146,6 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
}
bool antialias=pref["UseAntiAliasing"].toBool();
glEnableClientState(GL_VERTEX_ARRAY);
if (antialias) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //_MINUS_SRC_ALPHA);
@ -155,6 +153,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glLineWidth (1.5);
} else glLineWidth (1);
glEnableClientState(GL_VERTEX_ARRAY);
w.qglColor(m_flag_color);
if (quadcnt>0) {
@ -170,12 +169,12 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
glVertexPointer(2, GL_SHORT, 0, pointarray);
glDrawArrays(GL_POINTS, 0, pointcnt>>1);
}
glDisableClientState(GL_VERTEX_ARRAY);
if (antialias) {
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
glDisableClientState(GL_VERTEX_ARRAY);
//glDisable(GL_SCISSOR_TEST);
}