Chromium Code Reviews| Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| index 0c7b1131fd98c2dbb60f52e0861fd67454a15a78..0ff779f867e9c7f4df093cd18a17529939dd313c 100644 |
| --- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| +++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| @@ -999,6 +999,16 @@ void CanvasRenderingContext2D::clip(DOMPath* domPath, const String& windingRuleS |
| bool CanvasRenderingContext2D::isPointInPath(const float x, const float y, const String& windingRuleString) |
| { |
| + return isPointInPathInternal(m_path, x, y, windingRuleString); |
| +} |
| + |
| +bool CanvasRenderingContext2D::isPointInPath(DOMPath* domPath, const float x, const float y, const String& windingRuleString) |
| +{ |
| + return isPointInPathInternal(domPath->path(), x, y, windingRuleString); |
|
Rik
2014/02/25 07:46:45
should you check if the pointer is valid?
|
| +} |
| + |
| +bool CanvasRenderingContext2D::isPointInPathInternal(const Path& path, const float x, const float y, const String& windingRuleString) |
| +{ |
| GraphicsContext* c = drawingContext(); |
| if (!c) |
| return false; |
| @@ -1015,12 +1025,21 @@ bool CanvasRenderingContext2D::isPointInPath(const float x, const float y, const |
| if (!parseWinding(windingRuleString, windRule)) |
| return false; |
| - return m_path.contains(transformedPoint, windRule); |
| + return path.contains(transformedPoint, windRule); |
| } |
| - |
| bool CanvasRenderingContext2D::isPointInStroke(const float x, const float y) |
| { |
| + return isPointInStrokeInternal(m_path, x, y); |
| +} |
| + |
| +bool CanvasRenderingContext2D::isPointInStroke(DOMPath* domPath, const float x, const float y) |
| +{ |
| + return isPointInStrokeInternal(domPath->path(), x, y); |
| +} |
| + |
| +bool CanvasRenderingContext2D::isPointInStrokeInternal(const Path& path, const float x, const float y) |
| +{ |
| GraphicsContext* c = drawingContext(); |
| if (!c) |
| return false; |
| @@ -1039,7 +1058,7 @@ bool CanvasRenderingContext2D::isPointInStroke(const float x, const float y) |
| strokeData.setLineJoin(getLineJoin()); |
| strokeData.setMiterLimit(miterLimit()); |
| strokeData.setLineDash(getLineDash(), lineDashOffset()); |
| - return m_path.strokeContains(transformedPoint, strokeData); |
| + return path.strokeContains(transformedPoint, strokeData); |
| } |
| void CanvasRenderingContext2D::clearRect(float x, float y, float width, float height) |