Ticket #3901: 0001-Use-radians-instead-of-degrees.patch

File 0001-Use-radians-instead-of-degrees.patch, 1.6 KB (added by humitos, 12 years ago)
  • eye.py

    From 85c0f8c52765fb3fad098d02bc8987891080079e Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Mon, 29 Oct 2012 13:04:37 -0300
    Subject: [PATCH Speak] Use radians instead of degrees
    
    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@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 b class Eye(gtk.DrawingArea): 
    125125        self.context.fill()
    126126
    127127        # eye ball
    128         self.context.arc(bounds.width / 2, bounds.height / 2, eyeSize / 2 - outlineWidth / 2, 0, 360)
     128        self.context.arc(bounds.width / 2, bounds.height / 2,
     129                         eyeSize / 2 - outlineWidth / 2, 0, 2 * math.pi)
    129130        self.context.set_source_rgb(1, 1, 1)
    130131        self.context.fill()
    131132
    132133        # outline
    133134        self.context.set_line_width(outlineWidth)
    134         self.context.arc(bounds.width / 2, bounds.height / 2, eyeSize / 2 - outlineWidth / 2, 0, 360)
     135        self.context.arc(bounds.width / 2, bounds.height / 2,
     136                         eyeSize / 2 - outlineWidth / 2, 0, 2 * math.pi)
    135137        self.context.set_source_rgb(0, 0, 0)
    136138        self.context.stroke()
    137139
    138140        # pupil
    139         self.context.arc(pupilX, pupilY, pupilSize, 0, 360)
     141        self.context.arc(pupilX, pupilY, pupilSize, 0, 2 * math.pi)
    140142        self.context.set_source_rgb(0, 0, 0)
    141143        self.context.fill()
    142144