changeset 7543:b84c5cbc0812

print.m: handle gif and jpg devices
author John W. Eaton <jwe@octave.org>
date Fri, 29 Feb 2008 04:09:03 -0500
parents b1ff001022af
children f9983d2761df
files scripts/ChangeLog scripts/plot/print.m src/xpow.cc
diffstat 3 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Feb 28 03:07:10 2008 -0500
+++ b/scripts/ChangeLog	Fri Feb 29 04:09:03 2008 -0500
@@ -1,3 +1,7 @@
+2008-02-29  John W. Eaton  <jwe@octave.org>
+
+	* plot/print.m: Handle gif and jpg devices.
+
 2008-02-28  John W. Eaton  <jwe@octave.org>
 
 	* plot/__go_draw_axes__.m (get_old_gnuplot_color): New subfunction.
--- a/scripts/plot/print.m	Thu Feb 28 03:07:10 2008 -0500
+++ b/scripts/plot/print.m	Fri Feb 29 04:09:03 2008 -0500
@@ -82,6 +82,11 @@
 ##     Metafont
 ##   @item png
 ##     Portable network graphics
+##   @item jpg
+##   @itemx jpeg
+##     JPEG image
+##   @item gif
+##     GIF image
 ##   @item pbm
 ##     PBMplus
 ##   @item svg
@@ -218,10 +223,11 @@
   endif
 
   ## check if we have to use convert
-  dev_list = {"aifm", "corel", "fig", "png", "pbm", "dxf", "mf", "svg", ...
-	      "hpgl", "ps", "ps2", "psc", "psc2", "eps", "eps2", ...
-	      "epsc", "epsc2", "emf", "pstex", "pslatex", ...
-	      "epslatex", "epslatexstandalone", "pdf"};
+  dev_list = {"aifm", "corel", "fig", "png", "jpg", "jpeg", ...
+	      "gif", "pbm", "dxf", "mf", "svg", "hpgl", ...
+	      "ps", "ps2", "psc", "psc2", "eps", "eps2", ...
+	      "epsc", "epsc2", "emf", "pdf", "pslatex", ...
+	      "epslatex", "epslatexstandalone", "pstex"};
   convertname = "";
   [idx, errmsg] = cellidx (dev_list, dev);
   if (! idx)
@@ -337,7 +343,12 @@
 
     new_terminal = cstrcat ("emf ", options);
 
-  elseif (strcmp (dev, "png") || strcmp (dev, "pbm"))
+  elseif (strcmp (dev, "png") || strcmp (dev, "gif")
+	  || strcmp (dev, "jpg") || strcmp (dev, "jpeg")
+	  || strcmp (dev, "pbm"))
+    if (strcmp (dev, "jpg"))
+      dev = "jpeg";
+    endif
     ## Portable network graphics, PBMplus
 
     ## FIXME -- New PNG interface takes color as "xRRGGBB"
--- a/src/xpow.cc	Thu Feb 28 03:07:10 2008 -0500
+++ b/src/xpow.cc	Fri Feb 29 04:09:03 2008 -0500
@@ -73,6 +73,8 @@
 octave_value
 xpow (double a, double b)
 {
+  double retval;
+
   if (a < 0.0 && static_cast<int> (b) != b)
     {
       Complex atmp (a);
@@ -80,7 +82,9 @@
       return std::pow (atmp, b);
     }
   else
-    return std::pow (a, b);
+    retval = std::pow (a, b);
+
+  return retval;
 }
 
 // -*- 2 -*-