[Sugar-devel] [PATCH Speak] Use radians instead of degrees

Manuel Kaufmann humitos at gmail.com
Mon Oct 29 12:28:23 EDT 2012


Cairo.Context.arc needs the angle in radians instead of degrees. Give
it as 360 (radians) was taking up to 8 seconds to draw the eyes.

Signed-off-by: Manuel Kaufmann <humitos at gmail.com>
---
 eye.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/eye.py b/eye.py
index 954e68a..e1bf5b8 100644
--- a/eye.py
+++ b/eye.py
@@ -125,18 +125,20 @@ class Eye(gtk.DrawingArea):
         self.context.fill()
 
         # eye ball
-        self.context.arc(bounds.width / 2, bounds.height / 2, eyeSize / 2 - outlineWidth / 2, 0, 360)
+        self.context.arc(bounds.width / 2, bounds.height / 2,
+                         eyeSize / 2 - outlineWidth / 2, 0, 2 * math.pi)
         self.context.set_source_rgb(1, 1, 1)
         self.context.fill()
 
         # outline
         self.context.set_line_width(outlineWidth)
-        self.context.arc(bounds.width / 2, bounds.height / 2, eyeSize / 2 - outlineWidth / 2, 0, 360)
+        self.context.arc(bounds.width / 2, bounds.height / 2,
+                         eyeSize / 2 - outlineWidth / 2, 0, 2 * math.pi)
         self.context.set_source_rgb(0, 0, 0)
         self.context.stroke()
 
         # pupil
-        self.context.arc(pupilX, pupilY, pupilSize, 0, 360)
+        self.context.arc(pupilX, pupilY, pupilSize, 0, 2 * math.pi)
         self.context.set_source_rgb(0, 0, 0)
         self.context.fill()
 
-- 
1.7.11.7



More information about the Sugar-devel mailing list