lib/shoes/swt/gradient.rb in shoes-swt-4.0.0.pre6 vs lib/shoes/swt/gradient.rb in shoes-swt-4.0.0.pre7
- old
+ new
@@ -43,13 +43,12 @@
def create_pattern(dsl)
width = dsl.element_width * 0.5
height = dsl.element_height * 0.5
angle = normalize_angle(-dsl.angle)
- left, top, width, height = determine_args_based_on_angle(angle,
- dsl.element_left, dsl.element_top,
- width, height)
+ left, top, width, height = determine_args_based_on_angle(angle, dsl.element_left,
+ dsl.element_top, width, height)
pattern = ::Swt::Pattern.new Shoes.display, left, top, width, height,
color1.real, color2.real
@patterns << pattern
pattern
@@ -82,10 +81,10 @@
my_width = width
my_height = height
end
my_angle = angle % (Math::PI * 0.5)
length = Math.sqrt(my_width**2 + my_height**2)
- b = (my_height == 0 && my_width == 0) ? 0 : Math.atan(my_height / my_width)
+ b = my_height.zero? && my_width.zero? ? 0 : Math.atan(my_height / my_width)
c = Math::PI * 0.5 - my_angle - b
r = length * Math.cos(c.abs)
x = r * Math.cos(b + c)
y = r * Math.sin(b + c)
[x, y]