Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2008-08-29 15:37:21 (GMT)
committer Andrés Ambrois <andresambrois@gmail.com>2008-08-29 15:37:21 (GMT)
commit87bbfdfbaf4f08979ae72923ff9c747d9c2a09fe (patch)
tree9e8536aa2933c9470a58a217eb32ad9196b6ff2f
parenta3cc3acb713e16a644c5bd60d8491f99c4b2a7c1 (diff)
Fix quality loss when scaling stones back and forth
-rw-r--r--boardwidget.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/boardwidget.py b/boardwidget.py
index 845520e..82cad61 100644
--- a/boardwidget.py
+++ b/boardwidget.py
@@ -159,10 +159,8 @@ class GoBoardWidget(gtk.Widget):
#Scale everything
self.unit = (min(self.allocation.height, self.allocation.width)+10)/(self.size + 1)
- if self.unit == 0:
- return
- self.BlackPixbuf = self.BlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
- self.WhitePixbuf = self.WhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledBlackPixbuf = self.BlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledWhitePixbuf = self.WhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
#Draw the board
self.window.draw_drawable(self.gc, self.BoardPixmap, 0, 0, 0, 0, self.allocation.width, self.allocation.height)
#Draw the lines
@@ -218,9 +216,9 @@ class GoBoardWidget(gtk.Widget):
ctx = self.window.cairo_create()
ct = gtk.gdk.CairoContext(ctx)
if color == 'B':
- ct.set_source_pixbuf(self.BlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ ct.set_source_pixbuf(self.ScaledBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
else:
- ct.set_source_pixbuf(self.WhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ ct.set_source_pixbuf(self.ScaledWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
ctx.paint()
def draw_stones(self, status):