# HG changeset patch # User Pantxo Diribarne # Date 1443257048 -7200 # Node ID 7395fdd45d5f70d5afdb15370ada162cf2cb20ce # Parent 63d14a5700396edc3da1b6437196a4a86e56666a 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. diff -r 63d14a570039 -r 7395fdd45d5f libgui/graphics/gl-select.cc --- 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;