Commit c4f6b338 authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

QT: Fixed drawing rotated text in Glow, QT rotates clockwise, not anti-clockwise like GTK.

parent 13ca247b
...@@ -2917,10 +2917,7 @@ int GlowDrawQt::text_qt(GlowWind* wind, int x, int y, char* text, int len, ...@@ -2917,10 +2917,7 @@ int GlowDrawQt::text_qt(GlowWind* wind, int x, int y, char* text, int len,
str = QString::fromUtf8(text); str = QString::fromUtf8(text);
} }
if (rot != 0) { painter->rotate(rot);
rot = 360 - rot;
painter->rotate(rot);
}
painter->setFont(get_font(font_idx, painter_type, size)); painter->setFont(get_font(font_idx, painter_type, size));
...@@ -2932,19 +2929,19 @@ int GlowDrawQt::text_qt(GlowWind* wind, int x, int y, char* text, int len, ...@@ -2932,19 +2929,19 @@ int GlowDrawQt::text_qt(GlowWind* wind, int x, int y, char* text, int len,
int px, py; int px, py;
if (rot == 180) { if (rot == 180) {
px = -x - width; px = -x - width;
py = (int)(-y - FONT_DESCENT * height); py = -y - FONT_DESCENT * height;
} else if (rot == 90) { } else if (rot == 270) {
px = -y - width + height / 2; px = -y - width + height / 2;
py = x; py = x;
} else if (rot == 270) { } else if (rot == 90) {
px = y - width; px = y - width;
py = -x - height; py = -x - height;
} else { } else {
px = x; px = x;
py = (int)(y - (1.0 - FONT_DESCENT) * height); py = y - (1.0 - FONT_DESCENT) * height;
} }
painter->drawText(px, py, rect.width(), rect.height(), Qt::TextDontClip, str); painter->drawText(px, py, rect.width(), rect.height(), Qt::TextDontClip, str);
painter->rotate(-rot);
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment