Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Martin <gary@garycmartin.com>2012-10-03 18:56:36 (GMT)
committer Gary Martin <gary@garycmartin.com>2012-10-03 18:56:36 (GMT)
commit55284f5d9691c558f8524f61e0bf38fe57bde6cb (patch)
tree5d00d0614a44f33d282cd4bba7f3b57f9b280712
parentb06c4a6c14b9fdd8e0ad5224b9b79a50396d1cdf (diff)
Fix int based pixel alignment rounding errors in Digital Clock view.
-rwxr-xr-xclock.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/clock.py b/clock.py
index 3187ca2..19c9f44 100755
--- a/clock.py
+++ b/clock.py
@@ -627,30 +627,30 @@ class ClockFace(gtk.DrawingArea):
# Fill background
cr = self.window.cairo_create()
cr.set_source_rgba(*style.Color(self._COLOR_WHITE).get_rgba())
- cr.rectangle(int(self._center_x - 1.1 * self._radius),
- int(self._center_y - 0.8 * self._radius),
- int(2.2 * self._radius),
- int(0.55 * self._radius))
+ cr.rectangle(round(self._center_x - 1.1 * self._radius),
+ round(self._center_y - 0.8 * self._radius),
+ round(2.2 * self._radius),
+ round(0.55 * self._radius))
cr.fill()
- h = int(0.15 * self._radius)
- x = int(self._center_x - self._radius)
+ h = round(0.15 * self._radius)
+ x = round(self._center_x - self._radius)
# Hours scale
cr.set_source_rgba(*style.Color(self._COLOR_HOURS).get_rgba())
- y = int(self._center_y - 0.75 * self._radius)
+ y = round(self._center_y - 0.75 * self._radius)
cr.rectangle(x, y, hours_length, h)
cr.fill()
# Minutes scale
cr.set_source_rgba(*style.Color(self._COLOR_MINUTES).get_rgba())
- y = int(self._center_y - 0.60 * self._radius)
+ y = round(self._center_y - 0.60 * self._radius)
cr.rectangle(x, y, minutes_length, h)
cr.fill()
# Seconds scale
cr.set_source_rgba(*style.Color(self._COLOR_SECONDS).get_rgba())
- y = int(self._center_y - 0.45 * self._radius)
+ y = round(self._center_y - 0.45 * self._radius)
cr.rectangle(x, y, seconds_length, h)
cr.fill()