Author: duncan
Date: Sun Oct  7 13:11:58 2007
New Revision: 9936

Log:
Trying to correct the display aspect when images are rotated


Modified:
   branches/rel-1/freevo/src/image/viewer.py
   branches/rel-1/freevo/src/osd.py
   branches/rel-1/freevo/src/skins/main/skin_utils.py

Modified: branches/rel-1/freevo/src/image/viewer.py
==============================================================================
--- branches/rel-1/freevo/src/image/viewer.py   (original)
+++ branches/rel-1/freevo/src/image/viewer.py   Sun Oct  7 13:11:58 2007
@@ -47,7 +47,7 @@
 _singleton = None
 
 def get_singleton():
-    #print 'get_singleton()'
+    _debug_('get_singleton()', 2)
     global _singleton
 
     # One-time init
@@ -60,7 +60,7 @@
 class ImageViewer(GUIObject):
 
     def __init__(self):
-        #print '__init__(self)'
+        _debug_('ImageViewer.__init__()', 2)
         GUIObject.__init__(self)
         self.osd_mode = 0    # Draw file info on the image
         self.zoom = 0   # Image zoom
@@ -86,7 +86,7 @@
         """
         free the current cache to save memory
         """
-        _debug_('free_cache(self)', 2)
+        _debug_('free_cache()', 2)
         self.bitmapcache = util.objectcache.ObjectCache(3, desc='viewer')
         if self.parent and self.free_cache in self.parent.show_callbacks:
             self.parent.show_callbacks.remove(self.free_cache)
@@ -96,7 +96,7 @@
         '''
         view an image
         '''
-        _debug_('view(self, item, zoom=%s, rotation=%s)' % (zoom, rotation), 2)
+        _debug_('view(item, zoom=%s, rotation=%s)' % (zoom, rotation), 2)
         if zoom:
             self.app_mode    = 'image_zoom'
         else:
@@ -112,7 +112,7 @@
 
         self.filename = filename
         if config.IMAGEVIEWER_REVERSED_IMAGES:
-            self.rotation = 360 - rotation
+            self.rotation = (360 - rotation) % 360
         else:
             self.rotation = rotation
 
@@ -306,24 +306,24 @@
 
 
     def redraw(self):
-        #print 'redraw(self)'
+        _debug_('redraw()', 2)
         self.view(self.fileitem, zoom=self.zoom, rotation=self.rotation)
 
 
     def cache(self, fileitem):
-        #print 'cache(self, fileitem.filename=%s)' % (fileitem.filename)
+        _debug_('cache(fileitem.filename=%s)' % (fileitem.filename), 2)
         # cache the next image (most likely we need this)
         self.osd.loadbitmap(fileitem.filename, cache=self.bitmapcache)
 
 
     def signalhandler(self):
-        #print 'signalhandler(self)'
+        _debug_('signalhandler()', 2)
         self.signal_registered = False
         self.eventhandler(PLAY_END)
 
 
     def eventhandler(self, event, menuw=None):
-        #print 'eventhandler(self, event=%s, menuw=%s)' % (event, menuw)
+        _debug_('eventhandler(event=%s, menuw=%s)' % (event, menuw), 2)
         if event == PAUSE or event == PLAY:
             if self.slideshow:
                 rc.post_event(Event(OSD_MESSAGE, arg=_('pause')))
@@ -356,7 +356,7 @@
         # rotate image
         elif event == IMAGE_ROTATE:
             if event.arg == 'left':
-                self.rotation = (self.rotation + 270) % 360
+                self.rotation = (self.rotation - 90) % 360
             else:
                 self.rotation = (self.rotation + 90) % 360
             self.fileitem['rotation'] = self.rotation
@@ -419,7 +419,7 @@
 
 
     def drawosd(self, layer=None):
-        #print 'drawosd(self, layer=%s)' % (layer)
+        _debug_('drawosd(layer=%s)' % (layer), 2)
 
         if not self.osd_mode:
             return

Modified: branches/rel-1/freevo/src/osd.py
==============================================================================
--- branches/rel-1/freevo/src/osd.py    (original)
+++ branches/rel-1/freevo/src/osd.py    Sun Oct  7 13:11:58 2007
@@ -720,6 +720,8 @@
         if not image:
             return
 
+        if not rotation % 180:
+            pass
         x = int(float(x) / config.IMAGEVIEWER_ASPECT)
         self.mutex.acquire()
         try:
@@ -749,12 +751,12 @@
         if scaling:
             w, h = image.get_size()
             h = int(h*scaling)
-            w = int(float(w) * scaling / config.IMAGEVIEWER_ASPECT)
-            if rotation:
-                image = pygame.transform.rotozoom(image, rotation, scaling)
-                image = pygame.transform.scale(image, (w, h))
+            if rotation % 180:
+                w = int(float(w) * scaling)
             else:
-                image = pygame.transform.scale(image, (w, h))
+                w = int(float(w) * scaling / config.IMAGEVIEWER_ASPECT)
+            image = pygame.transform.rotozoom(image, rotation, scaling)
+            image = pygame.transform.scale(image, (w, h))
 
         elif rotation:
             image = pygame.transform.rotate(image, rotation)

Modified: branches/rel-1/freevo/src/skins/main/skin_utils.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/skin_utils.py  (original)
+++ branches/rel-1/freevo/src/skins/main/skin_utils.py  Sun Oct  7 13:11:58 2007
@@ -116,7 +116,7 @@
         if image and item['rotation']:
             # pygame reverses the image rotation
             if config.IMAGEVIEWER_REVERSED_IMAGES:
-                rotation = 360 - item['rotation']
+                rotation = (360 - item['rotation']) % 360
             else:
                 rotation = item['rotation']
             image = pygame.transform.rotate(image, rotation)
@@ -173,8 +173,10 @@
         type = type[:5]
 
     i_w, i_h = image.get_size()
-    if anamorphic:
-        i_w  = i_w * 0.75
+    # this was the original anamorphic code
+    #if anamorphic:
+    #    i_w  = i_w * 0.75
+    i_w  = float(i_w) / config.IMAGEVIEWER_ASPECT
     aspect   = float(i_h)/i_w
 
     if type == 'audio' and aspect < 1.3 and aspect > 0.8:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to