Mercurial > hg > octave-nkf
diff src/graphics.cc @ 9423:f284e2a26ff9
graphics.cc (convert_cdata): return NaN for NaN values in cdata
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jul 2009 18:31:29 -0400 |
parents | d8d410b08228 |
children | ac2617d4e30c |
line wrap: on
line diff
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -437,16 +437,25 @@ else x = xround (x - 1); - if (xisnan (x) || x < 0) - x = 0; - else if (x >= nc) - x = (nc - 1); - - octave_idx_type idx = static_cast<octave_idx_type> (x); - - av[i] = cmapv[idx]; - av[i+lda] = cmapv[idx+nc]; - av[i+2*lda] = cmapv[idx+2*nc]; + if (xisnan (x)) + { + av[i] = x; + av[i+lda] = x; + av[i+2*lda] = x; + } + else + { + if (x < 0) + x = 0; + else if (x >= nc) + x = (nc - 1); + + octave_idx_type idx = static_cast<octave_idx_type> (x); + + av[i] = cmapv[idx]; + av[i+lda] = cmapv[idx+nc]; + av[i+2*lda] = cmapv[idx+2*nc]; + } } return octave_value (a);