[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Forward: Re: Bug#45912: inline image revert width and height
From:       thierry lorthiois <lorthioist () wanadoo ! fr>
Date:       2002-08-14 13:30:10
[Download RAW message or body]

> Le Wednesday 14 August 2002 01:26, thierry lorthiois a =E9crit :
> > bonjour laurent,
> >
> > j'ai eu un peu de temps pour regarder comment conserver le ratio d'une
> > image lorsqu'elle d=E9passe la page.
> >
> > ci-joint un patch (sur cvs 2002/08/13)
>
> Je pense qu'il est bon comme patch envoie le sur koffice@kde.org pour que
> david puisse le voir.
> Merci

Hi,
here a patch to correct the bug #45912
based on cvs 2002/08/13

regards
thierry

["patch-kword" (text/x-diff)]

diff -u -w kword/kwview.cc kword.new/kwview.cc
--- kword/kwview.cc	2002-08-10 18:29:09.000000000 +0000
+++ kword.new/kwview.cc	2002-08-13 22:33:40.000000000 +0000
@@ -2926,9 +2926,36 @@
 
         }
 
+        if ( _keepRatio && ((width > widthLimit) || (height > heightLimit)) )
+        {
+            // size too big => adjust the size and keep ratio
+            float ratioX = (float)width / widthLimit;
+            float ratioY = (float)height / heightLimit;
+            float ratioPicture = (float)width / height;
+
+            if ( ratioPicture == 0 )  // unlikely
+            {
+                width = widthLimit;
+                height = heightLimit;
+            }
+            else
+                if ( ratioX > ratioY )  // restrict width and calculate height
+                {
+                    width = widthLimit;
+                    height = widthLimit/ratioPicture;
+                }
+                else   // restrict height and calculate width
+                {
+                    width = heightLimit*ratioPicture;
+                    height = heightLimit;
+                }
+        }
+        else
+        {
         // Apply reasonable limits
         width = kMin( width, widthLimit );
         height = kMin( height, heightLimit );
+        }
 
         fsInline = frameset;
         KWFrame *frame = new KWFrame ( fsInline, 0, 0, width, height );

____________________________________
koffice mailing list
koffice@mail.kde.org
To unsubscribe please visit:
http://mail.kde.org/mailman/listinfo/koffice

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic