2011-03-08 Andreas Kling <kling@webkit.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Mar 2011 11:18:08 +0000 (11:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Mar 2011 11:18:08 +0000 (11:18 +0000)
        Reviewed by Antonio Gomes.

        Path: Make measurement functions const
        https://bugs.webkit.org/show_bug.cgi?id=55914

        * platform/graphics/Path.cpp:
        (WebCore::Path::length):
        (WebCore::Path::pointAtLength):
        (WebCore::Path::normalAngleAtLength):
        * platform/graphics/Path.h:
        * platform/graphics/cairo/PathCairo.cpp:
        (WebCore::Path::strokeBoundingRect):
        * platform/graphics/cg/PathCG.cpp:
        (WebCore::Path::strokeBoundingRect):
        * platform/graphics/openvg/PathOpenVG.cpp:
        (WebCore::Path::strokeBoundingRect):
        (WebCore::Path::length):
        (WebCore::Path::pointAtLength):
        (WebCore::Path::normalAngleAtLength):
        * platform/graphics/qt/PathQt.cpp:
        (WebCore::Path::strokeBoundingRect):
        (WebCore::Path::length):
        (WebCore::Path::pointAtLength):
        (WebCore::Path::normalAngleAtLength):
        * platform/graphics/skia/PathSkia.cpp:
        (WebCore::Path::strokeBoundingRect):
        * platform/graphics/wince/PathWinCE.cpp:
        (WebCore::Path::strokeBoundingRect):
        * platform/graphics/wx/PathWx.cpp:
        (WebCore::Path::strokeBoundingRect):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80557 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Path.cpp
Source/WebCore/platform/graphics/Path.h
Source/WebCore/platform/graphics/cairo/PathCairo.cpp
Source/WebCore/platform/graphics/cg/PathCG.cpp
Source/WebCore/platform/graphics/openvg/PathOpenVG.cpp
Source/WebCore/platform/graphics/qt/PathQt.cpp
Source/WebCore/platform/graphics/skia/PathSkia.cpp
Source/WebCore/platform/graphics/wince/PathWinCE.cpp
Source/WebCore/platform/graphics/wx/PathWx.cpp

index 13b01ec..d6c7446 100644 (file)
@@ -1,3 +1,36 @@
+2011-03-08  Andreas Kling  <kling@webkit.org>
+
+        Reviewed by Antonio Gomes.
+
+        Path: Make measurement functions const
+        https://bugs.webkit.org/show_bug.cgi?id=55914
+
+        * platform/graphics/Path.cpp:
+        (WebCore::Path::length):
+        (WebCore::Path::pointAtLength):
+        (WebCore::Path::normalAngleAtLength):
+        * platform/graphics/Path.h:
+        * platform/graphics/cairo/PathCairo.cpp:
+        (WebCore::Path::strokeBoundingRect):
+        * platform/graphics/cg/PathCG.cpp:
+        (WebCore::Path::strokeBoundingRect):
+        * platform/graphics/openvg/PathOpenVG.cpp:
+        (WebCore::Path::strokeBoundingRect):
+        (WebCore::Path::length):
+        (WebCore::Path::pointAtLength):
+        (WebCore::Path::normalAngleAtLength):
+        * platform/graphics/qt/PathQt.cpp:
+        (WebCore::Path::strokeBoundingRect):
+        (WebCore::Path::length):
+        (WebCore::Path::pointAtLength):
+        (WebCore::Path::normalAngleAtLength):
+        * platform/graphics/skia/PathSkia.cpp:
+        (WebCore::Path::strokeBoundingRect):
+        * platform/graphics/wince/PathWinCE.cpp:
+        (WebCore::Path::strokeBoundingRect):
+        * platform/graphics/wx/PathWx.cpp:
+        (WebCore::Path::strokeBoundingRect):
+
 2011-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Reviewed by Martin Robinson.
index 55760b1..d501716 100644 (file)
@@ -83,14 +83,14 @@ static void pathLengthApplierFunction(void* info, const PathElement* element)
     }
 }
 
-float Path::length()
+float Path::length() const
 {
     PathTraversalState traversalState(PathTraversalState::TraversalTotalLength);
     apply(&traversalState, pathLengthApplierFunction);
     return traversalState.m_totalLength;
 }
 
-FloatPoint Path::pointAtLength(float length, bool& ok)
+FloatPoint Path::pointAtLength(float length, bool& ok) const
 {
     PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength);
     traversalState.m_desiredLength = length;
@@ -99,7 +99,7 @@ FloatPoint Path::pointAtLength(float length, bool& ok)
     return traversalState.m_current;
 }
 
-float Path::normalAngleAtLength(float length, bool& ok)
+float Path::normalAngleAtLength(float length, bool& ok) const
 {
     PathTraversalState traversalState(PathTraversalState::TraversalNormalAngleAtLength);
     traversalState.m_desiredLength = length;
index 31f2cd6..c2ca576 100644 (file)
@@ -112,11 +112,11 @@ namespace WebCore {
         bool contains(const FloatPoint&, WindRule rule = RULE_NONZERO) const;
         bool strokeContains(StrokeStyleApplier*, const FloatPoint&) const;
         FloatRect boundingRect() const;
-        FloatRect strokeBoundingRect(StrokeStyleApplier* = 0);
+        FloatRect strokeBoundingRect(StrokeStyleApplier* = 0) const;
         
-        float length();
-        FloatPoint pointAtLength(float length, bool& ok);
-        float normalAngleAtLength(float length, bool& ok);
+        float length() const;
+        FloatPoint pointAtLength(float length, bool& ok) const;
+        float normalAngleAtLength(float length, bool& ok) const;
 
         void clear();
         bool isEmpty() const;
index 7a09a52..533df10 100644 (file)
@@ -281,7 +281,7 @@ FloatRect Path::boundingRect() const
     return FloatRect(x0, y0, x1 - x0, y1 - y0);
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
 {
     cairo_t* cr = platformPath()->context();
     if (applier) {
index d6a1e6e..b8fc7d4 100644 (file)
@@ -166,7 +166,7 @@ FloatRect Path::boundingRect() const
     return CGPathGetBoundingBox(m_path);
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
 {
     CGContextRef context = scratchContext();
 
index 39a4b06..95df242 100644 (file)
@@ -169,7 +169,7 @@ FloatRect Path::boundingRect() const
     return FloatRect(FloatPoint(minX, minY), FloatSize(width, height));
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
 {
     notImplemented();
 
@@ -464,7 +464,7 @@ void Path::transform(const AffineTransform& transformation)
 // functions and Path::apply() doesn't really work as long as we rely on VGPath
 // as primary path storage.
 
-float Path::length()
+float Path::length() const
 {
     m_path->makeCompatibleContextCurrent();
     VGfloat length = vgPathLength(m_path->vgPath(), 0, vgGetParameteri(m_path->vgPath(), VG_PATH_NUM_SEGMENTS));
@@ -472,7 +472,7 @@ float Path::length()
     return length;
 }
 
-FloatPoint Path::pointAtLength(float length, bool& ok)
+FloatPoint Path::pointAtLength(float length, bool& ok) const
 {
     VGfloat x = 0, y = 0;
     m_path->makeCompatibleContextCurrent();
@@ -483,7 +483,7 @@ FloatPoint Path::pointAtLength(float length, bool& ok)
     return FloatPoint(x, y);
 }
 
-float Path::normalAngleAtLength(float length, bool& ok)
+float Path::normalAngleAtLength(float length, bool& ok) const
 {
     VGfloat tangentX, tangentY;
     m_path->makeCompatibleContextCurrent();
index ad482f7..6b30fdf 100644 (file)
@@ -154,7 +154,7 @@ FloatRect Path::boundingRect() const
     return m_path.boundingRect();
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
 {
     GraphicsContext* context = scratchContext();
     QPainterPathStroker stroke;
@@ -409,12 +409,12 @@ void Path::transform(const AffineTransform& transform)
         m_path = qTransform.map(m_path);
 }
 
-float Path::length()
+float Path::length() const
 {
     return m_path.length();
 }
 
-FloatPoint Path::pointAtLength(float length, bool& ok)
+FloatPoint Path::pointAtLength(float length, bool& ok) const
 {
     ok = (length >= 0 && length <= m_path.length());
 
@@ -424,7 +424,7 @@ FloatPoint Path::pointAtLength(float length, bool& ok)
     return point;
 }
 
-float Path::normalAngleAtLength(float length, bool& ok)
+float Path::normalAngleAtLength(float length, bool& ok) const
 {
     ok = (length >= 0 && length <= m_path.length());
 
index 0344086..b037a0d 100644 (file)
@@ -228,7 +228,7 @@ void Path::transform(const AffineTransform& xform)
     m_path->transform(xform);
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
 {
     GraphicsContext* scratch = scratchContext();
     scratch->save();
index fa4c8fb..9c9112b 100644 (file)
@@ -133,7 +133,7 @@ void Path::transform(const AffineTransform& t)
     m_path->transform(t);
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier *)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier*) const
 {
     notImplemented();
     return FloatRect();
index f5355f2..a95cc1c 100644 (file)
@@ -105,7 +105,7 @@ FloatRect Path::boundingRect() const
     return FloatRect();
 }
 
-FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
 {
     notImplemented();
     return FloatRect();