Changeset 118020 in webkit


Ignore:
Timestamp:
May 22, 2012 12:23:18 PM (12 years ago)
Author:
rafael.lobo@openbossa.org
Message:

[Qt] canvas/philip/tests/2d.path.stroke.overlap.html fails with Qt-4.6.2 or higher
https://bugs.webkit.org/show_bug.cgi?id=40362

Reviewed by Noam Rosenthal.

Source/WebCore:

Before drawing the stroke from a certain path, it should make the union of the stroke areas.
The previous implementation didn't consider that so the intersection was painted twice.
By using QPainterPathStroker, we create a QPainterPath on top of the platform path, and
then we fill it with the expected brush. This way we avoid repainting areas.

  • platform/graphics/qt/GraphicsContextQt.cpp:

(WebCore::fillPathStroke):
(WebCore):
(WebCore::GraphicsContext::strokePath):

LayoutTests:

  • platform/qt/Skipped: Unskip test after fix.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r118013 r118020  
     12012-05-22  Rafael Brandao  <rafael.lobo@openbossa.org>
     2
     3        [Qt] canvas/philip/tests/2d.path.stroke.overlap.html fails with Qt-4.6.2 or higher
     4        https://bugs.webkit.org/show_bug.cgi?id=40362
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        * platform/qt/Skipped: Unskip test after fix.
     9
    1102012-05-22  Emil A Eklund  <eae@chromium.org>
    211
  • trunk/LayoutTests/platform/qt/Skipped

    r117939 r118020  
    21242124# ============================================================================= #
    21252125
    2126 # [Qt] canvas/philip/tests/2d.path.stroke.overlap.html fails with Qt-4.6.2 or higher
    2127 # https://bugs.webkit.org/show_bug.cgi?id=40362
    2128 canvas/philip/tests/2d.path.stroke.overlap.html
    2129 
    21302126# [Qt] editing/execCommand/move-selection-back-line.html fails with Qt >= 4.7.1
    21312127# https://bugs.webkit.org/show_bug.cgi?id=50144
  • trunk/Source/WebCore/ChangeLog

    r118018 r118020  
     12012-05-22  Rafael Brandao  <rafael.lobo@openbossa.org>
     2
     3        [Qt] canvas/philip/tests/2d.path.stroke.overlap.html fails with Qt-4.6.2 or higher
     4        https://bugs.webkit.org/show_bug.cgi?id=40362
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Before drawing the stroke from a certain path, it should make the union of the stroke areas.
     9        The previous implementation didn't consider that so the intersection was painted twice.
     10        By using QPainterPathStroker, we create a QPainterPath on top of the platform path, and
     11        then we fill it with the expected brush. This way we avoid repainting areas.
     12
     13        * platform/graphics/qt/GraphicsContextQt.cpp:
     14        (WebCore::fillPathStroke):
     15        (WebCore):
     16        (WebCore::GraphicsContext::strokePath):
     17
    1182012-05-21  Gavin Barraclough  <barraclough@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r113059 r118020  
    6060#include <QPainter>
    6161#include <QPainterPath>
     62#include <QPainterPathStroker>
    6263#include <QPixmap>
    6364#include <QPolygonF>
     
    528529}
    529530
     531inline static void fillPathStroke(QPainter* painter, QPainterPathStroker& pathStroker, const QPainterPath& platformPath, const QBrush& brush)
     532{
     533    QPainterPath stroke = pathStroker.createStroke(platformPath);
     534    painter->fillPath(stroke, brush);
     535}
     536
    530537void GraphicsContext::strokePath(const Path& path)
    531538{
     
    537544    QPainterPath platformPath = path.platformPath();
    538545    platformPath.setFillRule(toQtFillRule(fillRule()));
     546    QPainterPathStroker pathStroker;
     547    pathStroker.setJoinStyle(pen.joinStyle());
     548    pathStroker.setDashOffset(pen.dashOffset());
     549    pathStroker.setMiterLimit(pen.miterLimit());
     550    pathStroker.setCapStyle(pen.capStyle());
     551    pathStroker.setWidth(pen.widthF());
    539552
    540553    if (hasShadow()) {
     
    550563                    QBrush brush(*m_state.strokeGradient->platformGradient());
    551564                    brush.setTransform(m_state.strokeGradient->gradientSpaceTransform());
    552                     QPen shadowPen(pen);
    553                     shadowPen.setBrush(brush);
    554                     shadowPainter->strokePath(platformPath, shadowPen);
    555                 } else {
    556                     shadowPainter->strokePath(platformPath, pen);
    557                 }
     565                    fillPathStroke(shadowPainter, pathStroker, platformPath, brush);
     566                } else
     567                    fillPathStroke(shadowPainter, pathStroker, platformPath, pen.brush());
    558568                shadow->endShadowLayer(this);
    559569            }
     
    565575            QPen shadowPen(pen);
    566576            shadowPen.setColor(shadowColor);
    567             p->strokePath(platformPath, shadowPen);
     577            fillPathStroke(p, pathStroker, platformPath, shadowPen.brush());
    568578            p->translate(-offset);
    569579        }
     
    572582    if (m_state.strokePattern) {
    573583        AffineTransform affine;
    574         pen.setBrush(QBrush(m_state.strokePattern->createPlatformPattern(affine)));
    575         p->setPen(pen);
    576         p->strokePath(platformPath, pen);
     584        QBrush brush = m_state.strokePattern->createPlatformPattern(affine);
     585        fillPathStroke(p, pathStroker, platformPath, brush);
    577586    } else if (m_state.strokeGradient) {
    578587        QBrush brush(*m_state.strokeGradient->platformGradient());
    579588        brush.setTransform(m_state.strokeGradient->gradientSpaceTransform());
    580         pen.setBrush(brush);
    581         p->setPen(pen);
    582         p->strokePath(platformPath, pen);
     589        fillPathStroke(p, pathStroker, platformPath, brush);
    583590    } else
    584         p->strokePath(platformPath, pen);
     591        fillPathStroke(p, pathStroker, platformPath, pen.brush());
    585592}
    586593
Note: See TracChangeset for help on using the changeset viewer.