[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(mgp-users 00100) fix for bug in scaling images



At some point near december a bug was introduced in the scaling of mgp
images, resulting often in incorrect computation of image sizes.
The following patch from Davide Devoti should fix things. I consider
this rather critical

	thanks
	luigi

--- draw.c.orig Thu Dec 17 05:32:33 1998
+++ draw.c      Tue Feb  9 15:20:10 1999
@@ -2543,7 +2670,8 @@
 #endif

        if (backflag) {
-               if (xzoomrate != 100 || yzoomrate != 100) {
+               if ((xzoomrate != 100 || yzoomrate != 100) && !(xzoomrate==0 &&
+                               yzoomrate==0)) {
                        image = myimage;
                        myimage = zoom(image, xzoomrate, yzoomrate, verbose);
                        if (!image) {
--- postscript.c.orig   Thu Dec 17 06:09:22 1998
+++ postscript.c        Sun Feb  7 10:16:35 1999
@@ -208,6 +208,6 @@
        if (mgp_flag & FL_VERBOSE) {
                fprintf(stderr, "resulting zoom=(%f,%f)\n", x, y);
        }
-       *xp = (int)x * 100;
-       *yp = (int)y * 100;
+       *xp = (int)(x * 100);
+       *yp = (int)(y * 100);
 }

-----------------------------------+-------------------------------------
  Luigi RIZZO                      .
  EMAIL: luigi@iet.unipi.it        . Dip. di Ing. dell'Informazione
  HTTP://www.iet.unipi.it/~luigi/  . Universita` di Pisa
  TEL/FAX: +39-050-568.533/522     . via Diotisalvi 2, 56126 PISA (Italy)
-----------------------------------+-------------------------------------