Browse Source

Refactor to remove instance_eval

When you have a hammer...
dev
Andy Meneely 11 years ago
parent
commit
243b3836c4
  1. 2
      lib/squib/graphics/shapes.rb

2
lib/squib/graphics/shapes.rb

@ -84,7 +84,6 @@ module Squib
x, y, n = poly.x, poly.y, poly.n x, y, n = poly.x, poly.y, poly.n
inner_radius, outer_radius = poly.inner_radius, poly.outer_radius inner_radius, outer_radius = poly.inner_radius, poly.outer_radius
use_cairo do |cc| use_cairo do |cc|
poly.instance_eval do
cc.rotate_about(x, y, trans.angle) cc.rotate_about(x, y, trans.angle)
cc.move_to(x + outer_radius, y) #i = 0, so cos(0)=1 and sin(0)=0 cc.move_to(x + outer_radius, y) #i = 0, so cos(0)=1 and sin(0)=0
theta = Math::PI / n.to_f # i.e. (2*pi) / (2*n) theta = Math::PI / n.to_f # i.e. (2*pi) / (2*n)
@ -93,7 +92,6 @@ module Squib
cc.line_to(x + radius * Math::cos(i * theta), cc.line_to(x + radius * Math::cos(i * theta),
y + radius * Math::sin(i * theta)) y + radius * Math::sin(i * theta))
end end
end
cc.close_path cc.close_path
cc.fill_n_stroke(draw) cc.fill_n_stroke(draw)
end end

Loading…
Cancel
Save