[cairo-commit] rcairo/src/lib/cairo/context path.rb,1.2,1.3
Kouhei Sutou
commit at pdx.freedesktop.org
Wed May 2 19:03:16 PDT 2007
Committed by: kou
Update of /cvs/cairo/rcairo/src/lib/cairo/context
In directory kemper:/tmp/cvs-serv2604/src/lib/cairo/context
Modified Files:
path.rb
Log Message:
* src/rb_cairo.h, src/rb_cairo_path.c: added Cairo::Point and
Cairo::PathData.
* src/lib/cairo/point.rb (Cairo::Point#distance): moved from
Cairo::Context::Path::Point.
* src/lib/cairo/context/path.rb (Cairo::Context::Path::Point):
removed.
* src/lib/cairo.rb, src/lib/cairo/context/path.rb: used Cairo::Point.
Index: path.rb
===================================================================
RCS file: /cvs/cairo/rcairo/src/lib/cairo/context/path.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- path.rb 30 Apr 2007 09:20:27 -0000 1.2
+++ path.rb 3 May 2007 02:03:06 -0000 1.3
@@ -1,15 +1,6 @@
module Cairo
class Context
module Path
- module Point
- module_function
- def distance(a, b)
- ax, ay = a
- bx, by = b
- Math.sqrt((bx - ax) ** 2 + (by - ay) ** 2)
- end
- end
-
def transform_path(path, &block)
save do
new_path
@@ -110,12 +101,12 @@
when PATH_MOVE_TO
current_point = points[0]
when PATH_LINE_TO
- result = Point.distance(current_point, points[0])
+ result = current_point.distance(points[0])
current_point = points[0]
when PATH_CURVE_TO
- result = Point.distance(current_point, points[0])
- result += Point.distance(points[0], points[1])
- result += Point.distance(points[1], points[2])
+ result = current_point.distance(points[0])
+ result += points[0].distance(points[1])
+ result += points[1].distance(points[2])
current_point = points[2]
when PATH_CLOSE_PATH
end
More information about the cairo-commit
mailing list