~cahr-gr/covergloobus/cahrgr

« back to all changes in this revision

Viewing changes to src/ui.py

  • Committer: Alexandr Grigorcea
  • Date: 2010-01-26 22:24:35 UTC
  • Revision ID: cahr.gr@gmail.com-20100126222435-x3ohtftsd33tdial
cover image is resized only once and not at every expose event

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
                                try:
164
164
                                        self.image_path = src
165
165
                                        self.imgobj = gtk.gdk.pixbuf_new_from_file(src)
 
166
                                        self.image_scaled = self.imgobj.scale_simple(self.width,self.height,1)
166
167
                                except:
167
168
                                        self.imgobj = None
168
169
 
181
182
                #print "Drawing Image :"+self.src + " - " + str(self.image_type)
182
183
                if self.imgobj != None:
183
184
                                ctx.save()
184
 
                                pw = float(self.imgobj.get_width())
185
 
                                ph = float(self.imgobj.get_height())
 
185
                                #pw = float(self.imgobj.get_width())
 
186
                                #ph = float(self.imgobj.get_height())
186
187
                                ctx.translate(self.x, self.y)
187
188
                                #if self.width and self.height:
188
189
                                #       ctx.scale(self.width/pw, self.height/ph)
189
190
                                #ctx.set_source_pixbuf(self.imgobj, 0, 0)
190
 
                                pixscaled = self.imgobj
191
 
                                if self.width and self.height:
192
 
                                        pixscaled = self.imgobj.scale_simple(self.width,self.height,1)
193
 
                                ctx.set_source_pixbuf(pixscaled, 0, 0)
 
191
                                #pixscaled = self.imgobj
 
192
                                #if self.width and self.height:
 
193
                                #       pixscaled = self.imgobj.scale_simple(self.width,self.height,1)
 
194
                                #ctx.set_source_pixbuf(pixscaled, 0, 0)
 
195
                                ctx.set_source_pixbuf(self.image_scaled, 0, 0)
194
196
                                ctx.paint()
195
197
                                ctx.restore()   
196
198