]> git.lyx.org Git - features.git/commitdiff
antialiasing for fonts by Stefan
authorUwe Stöhr <uwestoehr@web.de>
Thu, 29 Mar 2007 23:08:29 +0000 (23:08 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Thu, 29 Mar 2007 23:08:29 +0000 (23:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17639 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/QLPainter.C

index 9e76264bf2e72efcd29c913ca29a26ea225f0692..a9b3bef2ed6d07ad4923d2812126fe419a4d78cc 100644 (file)
@@ -98,7 +98,9 @@ void QLPainter::line(int x1, int y1, int x2, int y2,
                return;
 
        setQPainterPen(col, ls, lw);
+       setRenderHint(Antialiasing, x1 != x2 && y1 != y2);
        drawLine(x1, y1, x2, y2);
+       setRenderHint(Antialiasing, false);
 }
 
 
@@ -112,16 +114,21 @@ void QLPainter::lines(int const * xp, int const * yp, int np,
        // 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);
 }
 
 
@@ -152,7 +159,9 @@ 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);
        drawArc(x, y, w, h, a1 / 4, a2 / 4);
+       setRenderHint(Antialiasing, false);
 }
 
 
@@ -277,3 +286,4 @@ int QLPainter::text(int x, int y, docstring const & s,
 } // namespace frontend
 } // namespace lyx
 
+