mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Fix EventBreakdown chart fonts on retina
This commit is contained in:
parent
2e3313d5e7
commit
cbbae2e700
@ -2079,16 +2079,23 @@ Layer * gGraph::getLineChart()
|
|||||||
void gGraphView::DrawTextQue(QPainter &painter)
|
void gGraphView::DrawTextQue(QPainter &painter)
|
||||||
{
|
{
|
||||||
int w,h;
|
int w,h;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
int dpr=devicePixelRatio();
|
||||||
|
#endif
|
||||||
for (int i=0;i<m_textque_items;i++) {
|
for (int i=0;i<m_textque_items;i++) {
|
||||||
TextQue &q = m_textque[i];
|
TextQue &q = m_textque[i];
|
||||||
painter.setFont(*q.font);
|
|
||||||
painter.setBrush(q.color);
|
painter.setBrush(q.color);
|
||||||
painter.setRenderHint(QPainter::TextAntialiasing,q.antialias);
|
painter.setRenderHint(QPainter::TextAntialiasing,q.antialias);
|
||||||
|
|
||||||
if (q.angle==0) { // normal text
|
if (q.angle==0) { // normal text
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
painter.drawText(q.x*devicePixelRatio(),q.y*devicePixelRatio(),q.text);
|
QFont font=*q.font;
|
||||||
|
font.setPointSizeF(q.font->pointSizeF()*dpr);
|
||||||
|
painter.setFont(font);
|
||||||
|
|
||||||
|
painter.drawText(q.x*dpr,q.y*dpr,q.text);
|
||||||
#else
|
#else
|
||||||
|
painter.setFont(*q.font);
|
||||||
painter.drawText(q.x,q.y,q.text);
|
painter.drawText(q.x,q.y,q.text);
|
||||||
#endif
|
#endif
|
||||||
} else { // rotated text
|
} else { // rotated text
|
||||||
@ -2141,8 +2148,9 @@ QImage gGraphView::fboRenderPixmap(int w,int h)
|
|||||||
return pm;
|
return pm;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
w*=devicePixelRatio();
|
float dpr=devicePixelRatio();
|
||||||
h*=devicePixelRatio();
|
w*=dpr;
|
||||||
|
h*=dpr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((w > max_fbo_width) || (h > max_fbo_height)) {
|
if ((w > max_fbo_width) || (h > max_fbo_height)) {
|
||||||
@ -2937,7 +2945,8 @@ void gGraphView::resizeGL(int w, int h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
glOrtho(0, w/devicePixelRatio(), h/devicePixelRatio(), 0, -1, 1);
|
float dpr=devicePixelRatio();
|
||||||
|
glOrtho(0, w/dpr, h/dpr, 0, -1, 1);
|
||||||
#else
|
#else
|
||||||
glOrtho(0, w, h, 0, -1, 1);
|
glOrtho(0, w, h, 0, -1, 1);
|
||||||
#endif
|
#endif
|
||||||
@ -2952,8 +2961,9 @@ void gGraphView::renderSomethingFun(float alpha)
|
|||||||
float w=width();
|
float w=width();
|
||||||
float h=height();
|
float h=height();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
w*=devicePixelRatio();
|
float dpr=devicePixelRatio();
|
||||||
h*=devicePixelRatio();
|
w*=dpr;
|
||||||
|
h*=dpr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glViewport(0, 0, w, h);
|
glViewport(0, 0, w, h);
|
||||||
|
@ -581,8 +581,8 @@ jumpnext:
|
|||||||
//lastQ=Q;
|
//lastQ=Q;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
float dpr=w.graphView()->devicePixelRatio();
|
float dpr=w.graphView()->devicePixelRatio();
|
||||||
lines->scissor(left*dpr,w.flipY(top+height+2)*dpr,(width+1)*dpr,(height+1)*dpr);
|
lines->scissor(left*dpr,w.flipY(top+height+2)*dpr,(width+1)*dpr,(height+1)*dpr);
|
||||||
#else
|
#else
|
||||||
lines->scissor(left,w.flipY(top+height+2),width+1,height+2);
|
lines->scissor(left,w.flipY(top+height+2),width+1,height+2);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user