Changeset 69923 in webkit


Ignore:
Timestamp:
Oct 17, 2010 7:31:14 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-17 Sergey A. Sukiyazov <sergey.sukiyazov@gmail.com>

Reviewed by Andreas Kling

[Qt] Hovering the mouse over links produce a trail of underlined links (X11 paint engine)
https://bugs.webkit.org/show_bug.cgi?id=42248

The problem will appear because coordinates of points may increase by 0.05f (if line width is odd) inside
method GraphicsContext::adjustLineToPixelBoundaries(...) and become outside of text bounding rect htere,
then the new point coordinates will be passed to Qt graphics engine.

The solution decreases Y cordinates of points inside drawLineForText(...) method only if Qt graphics engine
is X11. The Y coordinates will be increase by 0.5f inside method adjustLineToPixelBoundaries(...), which
called from drawLine(...), and then inside Qt painting engine will be rounded to next greater integer value.

NOTE: This changes will affect only Qt X11 verision and if only X11 Painting Engine will be used.

No new tests.

  • platform/graphics/qt/GraphicsContextQt.cpp: (WebCore::GraphicsContext::drawLineForText):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69922 r69923  
     12010-10-17  Sergey A. Sukiyazov  <sergey.sukiyazov@gmail.com>
     2
     3        Reviewed by Andreas Kling
     4
     5        [Qt] Hovering the mouse over links produce a trail of underlined links (X11 paint engine)
     6        https://bugs.webkit.org/show_bug.cgi?id=42248
     7
     8        The problem will appear because coordinates of points may increase by 0.05f (if line width is odd) inside
     9        method GraphicsContext::adjustLineToPixelBoundaries(...) and become outside of text bounding rect htere,
     10        then the new point coordinates will be passed to Qt graphics engine.
     11
     12        The solution decreases Y cordinates of points inside drawLineForText(...) method only if Qt graphics engine
     13        is X11. The Y coordinates will be increase by 0.5f inside method adjustLineToPixelBoundaries(...),  which
     14        called from drawLine(...), and then inside Qt painting engine will be rounded to next greater integer value.
     15
     16        NOTE: This changes will affect only Qt X11 verision and if only X11 Painting Engine will be used.
     17
     18        No new tests.
     19
     20        * platform/graphics/qt/GraphicsContextQt.cpp:
     21        (WebCore::GraphicsContext::drawLineForText):
     22
    1232010-10-17  Rob Buis  <rwlbuis@gmail.com>
    224
  • trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r69579 r69923  
    844844        return;
    845845
     846    IntPoint startPoint = origin;
    846847    IntPoint endPoint = origin + IntSize(width, 0);
    847     drawLine(origin, endPoint);
     848
     849    // If paintengine type is X11 to avoid artifacts
     850    // like bug https://bugs.webkit.org/show_bug.cgi?id=42248
     851#if defined(Q_WS_X11)
     852    QPainter* p = m_data->p();
     853    if (p->paintEngine()->type() == QPaintEngine::X11) {
     854        // If stroke thickness is odd we need decrease Y coordinate by 1 pixel,
     855        // because inside method adjustLineToPixelBoundaries(...), which
     856        // called from drawLine(...), Y coordinate will be increased by 0.5f
     857        // and then inside Qt painting engine will be rounded to next greater
     858        // integer value.
     859        float strokeWidth = strokeThickness();
     860        if (static_cast<int>(strokeWidth) % 2) {
     861            startPoint.setY(startPoint.y() - 1);
     862            endPoint.setY(endPoint.y() - 1);
     863        }
     864    }
     865#endif // defined(Q_WS_X11)
     866
     867    drawLine(startPoint, endPoint);
    848868}
    849869
Note: See TracChangeset for help on using the changeset viewer.