changeset 18712:d57a83f2d73e

Preserve image class in cdata (bug #41240). * graphics.cc (convert_cdata): Add support for bool matrix input. * imshow.m: Remove hack converting single, integer, bool formats to double.
author Rik <rik@octave.org>
date Thu, 01 May 2014 11:16:03 -0700
parents a18e223224c5
children 0585787aa8ae
files libinterp/corefcn/graphics.cc scripts/image/imshow.m
diffstat 2 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Sun Mar 16 13:19:25 2014 +0100
+++ b/libinterp/corefcn/graphics.cc	Thu May 01 11:16:03 2014 -0700
@@ -866,6 +866,8 @@
     CONVERT_CDATA_1 (NDArray, , true);
   else if (cdata.is_single_type ())
     CONVERT_CDATA_1 (FloatNDArray, float_, true);
+  else if (cdata.is_bool_type ())
+    CONVERT_CDATA_1 (boolNDArray, bool_, false);
   else
     error ("unsupported type for cdata (= %s)", cdata.type_name ().c_str ());
 
--- a/scripts/image/imshow.m	Sun Mar 16 13:19:25 2014 +0100
+++ b/scripts/image/imshow.m	Thu May 01 11:16:03 2014 -0700
@@ -173,11 +173,6 @@
     im(nans) = display_range(1);
   endif
 
-  ## This is for compatibility.
-  if (! (indexed || (true_color && isinteger (im))) || islogical (im))
-    im = double (im);
-  endif
-
   ## Clamp the image to the range boundaries
   if (! (true_color || indexed || islogical (im)))
     low = display_range(1);