Changeset 58207 in webkit


Ignore:
Timestamp:
Apr 23, 2010 8:27:37 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-23 Qi Zhang <qi.2.zhang@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] LayoutTests/fast/canvas/pointInPath.html passed, actually it failed
https://bugs.webkit.org/show_bug.cgi?id=37276

pointInPath.html passed because the expected.txt expect it fail, it is wrong.

  • platform/qt/fast/canvas/pointInPath-expected.txt: Removed.

2010-04-23 Qi Zhang <qi.2.zhang@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] LayoutTests/fast/canvas/pointInPath.html passed, actually it failed
https://bugs.webkit.org/show_bug.cgi?id=37276

QPainterPath::contains doesn't count the point on the bound.

  • platform/graphics/qt/PathQt.cpp: (WebCore::isPointOnPathBorder): (WebCore::Path::contains):
Location:
trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58203 r58207  
     12010-04-23  Qi Zhang  <qi.2.zhang@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] LayoutTests/fast/canvas/pointInPath.html passed, actually it failed
     6        https://bugs.webkit.org/show_bug.cgi?id=37276
     7
     8        pointInPath.html passed because the expected.txt expect it fail, it is wrong.
     9
     10        * platform/qt/fast/canvas/pointInPath-expected.txt: Removed.
     11
    1122010-04-23  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/WebCore/ChangeLog

    r58206 r58207  
     12010-04-23  Qi Zhang  <qi.2.zhang@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] LayoutTests/fast/canvas/pointInPath.html passed, actually it failed
     6        https://bugs.webkit.org/show_bug.cgi?id=37276
     7
     8        QPainterPath::contains doesn't count the point on the bound.
     9
     10        * platform/graphics/qt/PathQt.cpp:
     11        (WebCore::isPointOnPathBorder):
     12        (WebCore::Path::contains):
     13
    1142010-04-23  Sam Weinig  <sam@webkit.org>
    215
  • trunk/WebCore/platform/graphics/qt/PathQt.cpp

    r56382 r58207  
    7070}
    7171
     72// Check whether a point is on the border
     73bool isPointOnPathBorder(const QPolygonF& border, const QPointF& p)
     74{
     75    QPointF p1 = border.at(0);
     76    QPointF p2;
     77
     78    for (int i = 1; i < border.size(); ++i) {
     79        p2 = border.at(i);
     80        //  (x1<=x<=x2||x1=>x>=x2) && (y1<=y<=y2||y1=>y>=y2)  && (y2-y1)(x-x1) == (y-y1)(x2-x1)
     81        //  In which, (y2-y1)(x-x1) == (y-y1)(x2-x1) is from (y2-y1)/(x2-x1) == (y-y1)/(x-x1)
     82        //  it want to check the slope between p1 and p2 is same with slope between p and p1,
     83        //  if so then the three points lie on the same line.
     84        //  In which, (x1<=x<=x2||x1=>x>=x2) && (y1<=y<=y2||y1=>y>=y2) want to make sure p is
     85        //  between p1 and p2, not outside.
     86        if (((p.x() <= p1.x() && p.x() >= p2.x()) || (p.x() >= p1.x() && p.x() <= p2.x()))
     87            && ((p.y() <= p1.y() && p.y() >= p2.y()) || (p.y() >= p1.y() && p.y() <= p2.y()))
     88            && (p2.y() - p1.y()) * (p.x() - p1.x()) == (p.y() - p1.y()) * (p2.x() - p1.x())) {
     89            return true;
     90        }
     91        p1 = p2;
     92    }
     93    return false;
     94}
     95
    7296bool Path::contains(const FloatPoint& point, WindRule rule) const
    7397{
     
    76100
    77101    bool contains = m_path.contains(point);
     102   
     103    if (!contains) {
     104        // check whether the point is on the border
     105        contains = isPointOnPathBorder(m_path.toFillPolygon(), point);
     106    }
    78107
    79108    const_cast<QPainterPath*>(&m_path)->setFillRule(savedRule);
Note: See TracChangeset for help on using the changeset viewer.