<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -18,21 +18,12 @@ class fake_raw_size_hints(object):
 
 
 class TestYadda(unittest.TestCase):
-    #def test_blah(self):
-    #    raw = fake_raw_size_hints(
-    #        base_width = 0,
-    #        base_height = 0,
-    #        min_aspect = 4/3.0,
-    #        max_aspect = 4/3.0,
-    #    )
-    #    sh = size_hints(hints=raw)
-    #    self.assertEqual(4096*75, 640*480)
-    #    self.assertEqual(sh.fix_aspect(4096, 75), (640, 480))
-
     def test_change_to_aspect(self):
         sh = size_hints(hints=None)
-        self.assertEqual(sh.change_to_aspect(1.0, 40, 90), (60, 60))
-        self.assertEqual(sh.change_to_aspect(1.0, 90, 40), (60, 60))
+        self.assertEqual(sh.change_to_aspect(1.0, 40, 90), (40, 40))
+        self.assertEqual(sh.change_to_aspect(1.0, 90, 40), (40, 40))
+        self.assertEqual(sh.change_to_aspect(4/3.0, 100, 100), (100, 75))
+
 
 if __name__ == '__main__':
     unittest.main()</diff>
      <filename>tests/size_hints.py</filename>
    </modified>
    <modified>
      <diff>@@ -121,26 +121,10 @@ class size_hints(object):
     def change_to_aspect(self, aspect, width, height):
         &quot;&quot;&quot;
         aspect is a float, e.g. 1.3... for 4:3 (4/3), 1.7... for 16:9 (16/9)
-
-        take a non-aspect-ratio-conforming width and height, and return a new
-        width and height that conforms (as close as possible) to the respective
-        aspect ratio while maintaining (as close as possible) the same amount
-        of area
-
-        width = height x aspect, so:
-        area = height x height x aspect
-
-        new_height x new_height x aspect = orig_width x orig_height
-        new_height**2 x aspect = orig_width x orig_height
-        new_height**2 = (orig_width x orig_height) / aspect
-        new_height = sqrt((orig_width x orig_height) / aspect)
-
-        so: 4096 x 75
-        becomes: 480 x (4/3.0) x 480
-        which is: 640 x 480
-        4096 x 75 = 640 x 480 = 307200
         &quot;&quot;&quot;
-        new_height = int(round(math.sqrt((width * height) / aspect)))
-        new_width = int(round(new_height * aspect))
-        return new_width, new_height
+        if aspect &gt; 1:
+            return width, int(round(width / aspect))
+        if aspect &lt; 1:
+            return int(round(height / aspect)), height
+        return (min(width, height),)*2
 </diff>
      <filename>whimsy/x11/size_hints.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a33650f58a211498dbea5f78c4497c7c50fb3792</id>
    </parent>
  </parents>
  <author>
    <name>Nick Welch</name>
    <email>mack@incise.org</email>
  </author>
  <url>http://github.com/mackstann/whimsy/commit/54b1c9d1a57a792386d0b933ab9fc31da554e471</url>
  <id>54b1c9d1a57a792386d0b933ab9fc31da554e471</id>
  <committed-date>2008-11-24T16:20:29-08:00</committed-date>
  <authored-date>2008-11-24T16:20:29-08:00</authored-date>
  <message>fix aspect stuff to stay within the requested box</message>
  <tree>dc51cf1abdde6e316311475e6d1e60d9b2bee04b</tree>
  <committer>
    <name>Nick Welch</name>
    <email>mack@incise.org</email>
  </committer>
</commit>
