mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-26 18:07:18 +00:00
Fix antialiasing problem in straight lines within polylines. Prepare for optional antialiasing.
* QLPainter::lines(): use QPainter::drawLine() multiple times instead QPainter::drawPolyline(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18196 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5221ba70b0
commit
58cc6d28e8
@ -98,7 +98,8 @@ void QLPainter::line(int x1, int y1, int x2, int y2,
|
||||
return;
|
||||
|
||||
setQPainterPen(col, ls, lw);
|
||||
setRenderHint(Antialiasing, x1 != x2 && y1 != y2);
|
||||
bool const do_antialiasing = x1 != x2 && y1 != y2;
|
||||
setRenderHint(Antialiasing, do_antialiasing);
|
||||
drawLine(x1, y1, x2, y2);
|
||||
setRenderHint(Antialiasing, false);
|
||||
}
|
||||
@ -109,26 +110,17 @@ void QLPainter::lines(int const * xp, int const * yp, int np,
|
||||
line_style ls,
|
||||
line_width lw)
|
||||
{
|
||||
// FIXME ?
|
||||
|
||||
// Must use new as np is not known at compile time.
|
||||
boost::scoped_array<QPoint> points(new QPoint[np]);
|
||||
|
||||
bool antialias = false;
|
||||
for (int i = 0; i < np; ++i) {
|
||||
points[i].setX(xp[i]);
|
||||
points[i].setY(yp[i]);
|
||||
if (i != 0)
|
||||
antialias |= xp[i-1] != xp[i] && yp[i-1] != yp[i];
|
||||
}
|
||||
|
||||
if (!isDrawingEnabled())
|
||||
return;
|
||||
|
||||
setQPainterPen(col, ls, lw);
|
||||
setRenderHint(Antialiasing, antialias);
|
||||
drawPolyline(points.get(), np);
|
||||
setRenderHint(Antialiasing, false);
|
||||
for (int i = 1; i < np; ++i) {
|
||||
bool const do_antialiasing = false &&
|
||||
xp[i-1] != xp[i] && yp[i-1] != yp[i];
|
||||
setRenderHint(Antialiasing, do_antialiasing);
|
||||
drawLine(xp[i-1], yp[i-1], xp[i], yp[i]);
|
||||
setRenderHint(Antialiasing, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +151,8 @@ void QLPainter::arc(int x, int y, unsigned int w, unsigned int h,
|
||||
|
||||
// LyX usings 1/64ths degree, Qt usings 1/16th
|
||||
setQPainterPen(col);
|
||||
setRenderHint(Antialiasing, true);
|
||||
bool const do_antialiasing = true;
|
||||
setRenderHint(Antialiasing, do_antialiasing);
|
||||
drawArc(x, y, w, h, a1 / 4, a2 / 4);
|
||||
setRenderHint(Antialiasing, false);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user