Update of /cvsroot/freevo/freevo/src/skins/main
In directory sc8-pr-cvs1:/tmp/cvs-serv22107
Modified Files:
area.py
Log Message:
use pickle to cache the large background images
Index: area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/skins/main/area.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** area.py 14 Dec 2003 17:39:52 -0000 1.22
--- area.py 1 Jan 2004 12:25:48 -0000 1.23
***************
*** 28,31 ****
--- 28,34 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.23 2004/01/01 12:25:48 dischi
+ # use pickle to cache the large background images
+ #
# Revision 1.22 2003/12/14 17:39:52 dischi
# Change TRUE and FALSE to True and False; vfs fixes
***************
*** 94,97 ****
--- 97,101 ----
import os
import pygame
+ import stat
import osd
***************
*** 625,633 ****
cname = '%s-%s-%s' % (imagefile, bg.width, bg.height)
image = self.imagecache[cname]
if not image:
image = osd.loadbitmap(imagefile)
if image:
image =
pygame.transform.scale(image,(bg.width,bg.height))
! self.imagecache[cname] = image
if image:
self.drawimage(image, bg)
--- 629,652 ----
cname = '%s-%s-%s' % (imagefile, bg.width, bg.height)
image = self.imagecache[cname]
+ if not image and config.OVERLAY_DIR:
+ cache = vfs.getoverlay('%s.raw-%sx%s' % (imagefile, bg.width,
+ bg.height))
+ if os.path.isfile(cache) and \
+ os.stat(cache)[stat.ST_MTIME] > \
+ os.stat(imagefile)[stat.ST_MTIME]:
+ f = open(cache, 'r')
+ image =
pygame.image.fromstring(str().join(f.readlines()),
+ (bg.width,bg.height),
'RGBA')
+ f.close()
+ self.imagecache[cname] = image
if not image:
image = osd.loadbitmap(imagefile)
if image:
image =
pygame.transform.scale(image,(bg.width,bg.height))
! if image and config.OVERLAY_DIR:
! f = open(cache, 'w')
! f.write(pygame.image.tostring(image, 'RGBA'))
! f.close()
! self.imagecache[cname] = image
if image:
self.drawimage(image, bg)
***************
*** 718,731 ****
cimage = self.imagecache[cname]
if not cimage:
! try:
! image = osd.loadbitmap(image)
! if w > 0 and h > 0:
! image = pygame.transform.scale(image, (w, h))
! self.imagecache[cname] = image
! except:
! return None
! else:
! image = cimage
! return image
--- 737,745 ----
cimage = self.imagecache[cname]
if not cimage:
! cimage = osd.loadbitmap(image)
! if cimage and w > 0 and h > 0:
! cimage = pygame.transform.scale(cimage, (w, h))
! self.imagecache[cname] = cimage
! return cimage
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog