diff -Naur qt-everywhere-opensource-src-4.7.0-orig/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp qt-everywhere-opensource-src-4.7.0/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp --- qt-everywhere-opensource-src-4.7.0-orig/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp 2010-09-10 13:05:21 +0400 +++ qt-everywhere-opensource-src-4.7.0/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp 2010-10-10 12:13:18 +0400 @@ -51,6 +51,8 @@ #include "Pattern.h" #include "Pen.h" +#include + #include #include #include @@ -780,8 +782,31 @@ if (paintingDisabled()) return; +#if !defined(Q_WS_X11) IntPoint endPoint = origin + IntSize(width, 0); drawLine(origin, endPoint); +#else + IntPoint p1 = origin; + IntPoint p2 = origin + IntSize(width, 0); + + // if paintengine type is X11 to avoid artifacts + // like bug https://bugs.webkit.org/show_bug.cgi?id=42248 + QPainter* p = m_data->p(); + if (p->paintEngine()->type() == QPaintEngine::X11) { + // If stroke thiknes is odd we need decrease Y coordinate by 1, + // because inside methotod adjustLineToPixelBoundaries(...), which + // called from drawLine(...), Y coordinate will be increased by 0.5f + // and then inside Qt painting engine will be rounded to next greater + // integer value + float strokeWidth = strokeThickness(); + if (static_cast(strokeWidth) % 2) { //odd + p1.setY(p1.y() - 1); + p2.setY(p2.y() - 1); + } + } + + drawLine(p1, p2); +#endif // !defined(Q_WS_X11) } void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint&, int, bool)