[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/unity/WebKit/WebCore/kcanvas
From:       Rob Buis <buis () kde ! org>
Date:       2006-08-16 15:41:21
Message-ID: 1155742881.347041.2924.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 573540 by buis:

Implement strokeContainsPoint. We need some extra info here since
QPainterPath does not know about style info like stroke width, whereas
CGPath does. Note that this could change later on, but for now it fixes
some hit testing problems.


 M  +1 -1      KCanvasPath.h  
 M  +2 -1      RenderPath.cpp  
 M  +8 -3      device/qt/KCanvasPathQt.cpp  
 M  +1 -1      device/qt/KCanvasPathQt.h  
 M  +1 -1      device/quartz/KCanvasPathQuartz.h  
 M  +1 -1      device/quartz/KCanvasPathQuartz.mm  


--- branches/work/unity/WebKit/WebCore/kcanvas/KCanvasPath.h #573539:573540
@@ -65,7 +65,7 @@
 
     virtual FloatRect boundingBox() = 0;
     virtual FloatRect strokeBoundingBox(const KRenderingStrokePainter&) = 0;
-    virtual bool strokeContainsPoint(const FloatPoint&) = 0;
+    virtual bool strokeContainsPoint(const FloatPoint&, const \
KRenderingStrokePainter&) = 0;  virtual bool containsPoint(const FloatPoint&, \
KCWindRule) = 0;  };
 
--- branches/work/unity/WebKit/WebCore/kcanvas/RenderPath.cpp #573539:573540
@@ -98,7 +98,8 @@
     if (!KSVGPainterFactory::strokePaintServer(style(), this))
         return false;
 
-    return path()->strokeContainsPoint(mapAbsolutePointToLocal(point));
+    KRenderingStrokePainter strokePainter = \
KSVGPainterFactory::strokePainter(style(), this); +    return \
path()->strokeContainsPoint(mapAbsolutePointToLocal(point), strokePainter);  }
 
 FloatRect RenderPath::strokeBBox() const
--- branches/work/unity/WebKit/WebCore/kcanvas/device/qt/KCanvasPathQt.cpp \
#573539:573540 @@ -23,6 +23,9 @@
 
 #include "config.h"
 #include "KCanvasPathQt.h"
+#include "render_style.h"
+#include "KRenderingStrokePainter.h"
+#include <QPainterPathStroker>
 
 namespace WebCore {
 
@@ -70,10 +73,12 @@
     return boundingBox();
 }
 
-bool KCanvasPathQt::strokeContainsPoint(const FloatPoint &point)
+bool KCanvasPathQt::strokeContainsPoint(const FloatPoint &point, const \
KRenderingStrokePainter& strokePainter)  {
-    qDebug("KCanvasPathQt::strokeContainsPoint() TODO!");    
-    return containsPoint(point, RULE_EVENODD);
+    QPainterPathStroker s;
+    s.setWidth(strokePainter.strokeWidth());
+    QPainterPath outline = s.createStroke(m_path);
+    return outline.contains(point);
 }
 
 bool KCanvasPathQt::containsPoint(const FloatPoint &point, KCWindRule rule)
--- branches/work/unity/WebKit/WebCore/kcanvas/device/qt/KCanvasPathQt.h \
#573539:573540 @@ -45,7 +45,7 @@
 
     virtual FloatRect boundingBox();
     virtual FloatRect strokeBoundingBox(const KRenderingStrokePainter \
                &strokePainter);
-    virtual bool strokeContainsPoint(const FloatPoint &point);
+    virtual bool strokeContainsPoint(const FloatPoint &point, const \
KRenderingStrokePainter &strokePainter);  virtual bool containsPoint(const FloatPoint \
&point, KCWindRule rule);  
     // Qt specific stuff
--- branches/work/unity/WebKit/WebCore/kcanvas/device/quartz/KCanvasPathQuartz.h \
#573539:573540 @@ -48,7 +48,7 @@
     virtual FloatRect boundingBox();
     virtual FloatRect strokeBoundingBox(const KRenderingStrokePainter&);
     virtual bool containsPoint(const FloatPoint&, KCWindRule);
-    virtual bool strokeContainsPoint(const FloatPoint&);
+    virtual bool strokeContainsPoint(const FloatPoint&, const \
KRenderingStrokePainter&);  
     CGPathRef cgPath() const { return m_cgPath; }
     
--- branches/work/unity/WebKit/WebCore/kcanvas/device/quartz/KCanvasPathQuartz.mm \
#573539:573540 @@ -131,7 +131,7 @@
     return pathContainsPoint(m_cgPath, point, fillRule == RULE_EVENODD ? \
kCGPathEOFill : kCGPathFill);  }
 
-bool KCanvasPathQuartz::strokeContainsPoint(const FloatPoint& point)
+bool KCanvasPathQuartz::strokeContainsPoint(const FloatPoint& point, const \
KRenderingStrokePainter&)  {
     return pathContainsPoint(m_cgPath, point, kCGPathStroke);
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic