Removed buggy gToolTip pixmap caching code

This commit is contained in:
Mark Watkins 2013-11-09 14:36:02 +10:00
parent eba087315b
commit e3cecdbe4c
2 changed files with 37 additions and 86 deletions

View File

@ -787,20 +787,13 @@ void gToolTip::paint() //actually paints it.
int x=m_pos.x();// - tw / 2;
int y=m_pos.y();// - th;
QPainter painter;
QPainter painter(m_graphview);
if (!usepixmap | (usepixmap && m_invalidate)) {
painter.begin(m_graphview);
QRect br;
QRect rect(x,y,0,0);
painter.setFont(*defaultfont);
rect=painter.boundingRect(rect,Qt::AlignCenter,m_text);
if (!usepixmap) {
int w=rect.width()+m_spacer*2;
int xx=rect.x()-m_spacer;
if (xx<0) xx=0;
@ -809,8 +802,6 @@ void gToolTip::paint() //actually paints it.
rect.setTop(rect.y()-rect.height()/2);
rect.setWidth(w);
//rect.setHeight(rect.height());
int z=rect.x()+rect.width();
if (z>m_graphview->width()-10) {
rect.setLeft(m_graphview->width()-2-rect.width());//m_pos.x()-m_spacer);
@ -821,25 +812,6 @@ void gToolTip::paint() //actually paints it.
rect.setY(0);
rect.setHeight(h);
}
if (!m_image.isNull()) {
m_graphview->deleteTexture(m_textureID);
m_textureID=0;
m_image=QImage();
m_invalidate=true;
}
} else {
rect.setCoords(0,0,rect.width()+m_spacer*2,rect.height()+m_spacer*2);
painter.end();
if (!m_image.isNull()) {
m_graphview->deleteTexture(m_textureID);
}
m_image=QImage(rect.width()+2,rect.height()+2,QImage::Format_ARGB32_Premultiplied);
m_image.fill(Qt::transparent);
painter.begin(&m_image);
painter.setCompositionMode(QPainter::CompositionMode_Source);
}
lines_drawn_this_frame+=4;
quads_drawn_this_frame+=1;
@ -857,28 +829,6 @@ void gToolTip::paint() //actually paints it.
painter.drawText(rect,Qt::AlignCenter,m_text);
painter.end();
if (usepixmap) {
//m_image=m_image.
// m_textureID=m_graphview->bindTexture(m_image,GL_TEXTURE_2D,GL_RGBA,QGLContext::NoBindOption);
m_invalidate=false;
}
}
if (usepixmap) {
x-=m_spacer+m_image.width()/2;
y-=m_image.height()/2;
if (y<0) y=0;
if (x<0) x=0;
if ((x+m_image.width()) > (m_graphview->width()-10)) x=m_graphview->width()-10 - m_image.width();
if (usepixmap && !m_image.isNull()) {
painter.begin(m_graphview);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.drawImage(QPoint(x,y),m_image);
}
}
}
void gToolTip::timerDone()
{

View File

@ -413,7 +413,7 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
//EventStoreType * dptr;
short px2,py2;
qint64 ms_per_day=86400000L;
const qint64 ms_per_day=86400000L;
for (qint64 Q=minx;Q<=maxx+ms_per_day;Q+=ms_per_day) {
zd=Q/ms_per_day;
d=m_values.find(zd);
@ -487,7 +487,8 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
total_hours+=hours;
total_days++;
} else {
if (!d.value().contains(0)) goto jumpnext;
if (!d.value().contains(0))
goto jumpnext;
total=d.value()[0];
//if (total>0) {
if (day) {