Mercurial > octave-nkf
changeset 20554:7395fdd45d5f stable
Fix selection of one pixel high(wide) images (bug #46049)
* gl-select.cc (opengl_selector::draw_image): make pixel size default to 1 when the corresponding image dimension is 1.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sat, 26 Sep 2015 10:44:08 +0200 |
parents | 63d14a570039 |
children | 7d7c91ddc736 |
files | libgui/graphics/gl-select.cc |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/gl-select.cc Sat Sep 26 11:42:19 2015 +0200 +++ b/libgui/graphics/gl-select.cc Sat Sep 26 10:44:08 2015 +0200 @@ -207,11 +207,11 @@ { Matrix xd = props.get_xdata ().matrix_value (); octave_idx_type nc = props.get_cdata ().columns (); - double x_pix_size = (xd(1) - xd(0)) / (nc - 1); + double x_pix_size = (nc == 1 ? 1 : (xd(1) - xd(0)) / (nc - 1)); Matrix yd = props.get_ydata ().matrix_value (); octave_idx_type nr = props.get_cdata ().rows (); - double y_pix_size = (yd(1) - yd(0)) / (nr - 1); + double y_pix_size = (nr == 1 ? 1 : (yd(1) - yd(0)) / (nr - 1)); ColumnVector p1(3, 0.0), p2(3, 0.0), p3(3, 0.0), p4(3, 0.0); p1(0) = xd(0) - x_pix_size/2;