Windows GL Font test #1

This commit is contained in:
Mark Watkins 2011-09-11 23:58:26 +10:00
parent 49730b949e
commit 87e7882dea
4 changed files with 19 additions and 5 deletions

View File

@ -1284,27 +1284,41 @@ void gGraphView::DrawTextQue()
glPushAttrib(GL_COLOR_BUFFER_BIT);
//glFlush();
//glEnable(GL_BLEND);
QPainter painter(QGLContext::currentContext()->device());
int w,h;
QPaintDevice *pd=QGLContext::currentContext()->device();
/* #ifdef Q_WS_WIN32
QPixmap *pixmap=dynamic_cast<QPixmap *>(pd);
#endif */
for (int i=0;i<m_textque_items;i++) {
// GL Font drawing is ass in Qt.. :(
TextQue & q=m_textque[i];
if (q.angle==0) {
qglColor(q.color);
renderText(q.x,q.y,q.text,*q.font);
//painter.drawText(q.x, q.y, q.text);
} else {
//glRotatef(90,0,0,-1);
QPainter painter;
/*#ifdef Q_WS_WIN32
if (pixmap) {
painter.begin(pd);
} else
#endif */
painter.begin(this);
QBrush b(q.color);
painter.setBrush(b);
painter.setFont(*q.font);
GetTextExtent(q.text, w, h, q.font);
painter.translate(q.x, q.y);
painter.rotate(-q.angle);
painter.drawText(floor(-w/2.0), floor(-h/2.0), q.text);
painter.rotate(+q.angle);
painter.translate(-q.x, -q.y);
painter.end();
/*QString c;
int x=q.x-4;
int y=q.y-(w)/2;
@ -1325,7 +1339,6 @@ void gGraphView::DrawTextQue()
q.text.clear();
//q.text.squeeze();
}
painter.end();
glPopAttrib();
//qDebug() << "rendered" << m_textque_items << "text items";
m_textque_items=0;

View File

@ -50,6 +50,7 @@ int main(int argc, char *argv[])
#ifdef Q_WS_X11
XInitThreads();
#endif
QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
QApplication a(argc, argv);
a.setApplicationName("SleepyHead");

View File

@ -168,7 +168,7 @@ void Overview::on_printButton_clicked()
{
if (!report) {
report=new Report(this,profile,NULL,this);
report=new Report(this,profile,m_shared,this);
}
if (report) {

View File

@ -103,7 +103,7 @@ QPixmap Report::Snapshot(gGraph * graph)
GraphView->SetXBounds(first,last);
int w=this->width()-20;
QPixmap pixmap=GraphView->renderPixmap(w,240,false); //gwwidth,gwheight,false);
QPixmap pixmap=GraphView->renderPixmap(w,240,false);
return pixmap;
}