changeset 18670:8b566ad1f88a gui-release

maint: Periodic merge of stable to gui-release.
author Rik <rik@octave.org>
date Thu, 24 Apr 2014 08:40:40 -0700
parents 777281eeb3d4 (current diff) 01aa90ece9a4 (diff)
children 78fac67300e8 c199304dfb2a
files libgui/qterminal/libqterminal/unix/TerminalView.cpp
diffstat 4 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Wed Apr 23 08:42:19 2014 +0200
+++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Thu Apr 24 08:40:40 2014 -0700
@@ -212,6 +212,9 @@
       // Disabling kerning saves some computation when rendering text.
       // font.setKerning(false);
 
+      font.setStyleStrategy (  QFont::StyleStrategy(font.styleStrategy()
+                             | QFont::ForceIntegerMetrics)  );
+
       QWidget::setFont(font);
       fontChange(font);
     }
--- a/libinterp/corefcn/dot.cc	Wed Apr 23 08:42:19 2014 +0200
+++ b/libinterp/corefcn/dot.cc	Thu Apr 24 08:40:40 2014 -0700
@@ -142,7 +142,7 @@
           argx = argx.reshape (dimx);
           dimy = dimy.redim (1);
           argy = argy.reshape (dimy);
-          match = ! error_state;
+          match = ! error_state && (dimx == dimy);
         }
 
       if (match)
@@ -262,6 +262,16 @@
 %! assert (dot (x, y, 2), [17; 53]);
 %! assert (dot (x, y, 3), [5 12; 21 32]);
 
+%% Test input validation
+%!error dot ()
+%!error dot (1)
+%!error dot (1,2,3,4)
+%!error <X and Y must be numeric> dot ({1,2}, [3,4])
+%!error <X and Y must be numeric> dot ([1,2], {3,4})
+%!error <sizes of X and Y must match> dot ([1 2], [1 2 3])
+%!error <sizes of X and Y must match> dot ([1 2]', [1 2 3]')
+%!error <sizes of X and Y must match> dot (ones (2,2), ones (2,3))
+%!error <DIM must be a valid dimension> dot ([1 2], [1 2], 0)
 */
 
 DEFUN (blkmm, args, ,
--- a/libinterp/corefcn/gl2ps-renderer.cc	Wed Apr 23 08:42:19 2014 +0200
+++ b/libinterp/corefcn/gl2ps-renderer.cc	Thu Apr 24 08:40:40 2014 -0700
@@ -190,13 +190,14 @@
 
 template <typename T>
 static void
-draw_pixels (GLsizei w, GLsizei h, GLenum format, const T *data)
+draw_pixels (GLsizei w, GLsizei h, GLenum format, const T *data, float maxval)
 {
   OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*w*h);
 
-  for (int i = 0; i < 3*w*h; i++)
-    a[i] = data[i];
-
+  // Convert to GL_FLOAT as it is the only type gl2ps accepts.
+  for (unsigned int i = 0; i < 3*w*h; i++)
+    a[i] = data[i] / maxval;
+  
   gl2psDrawPixels (w, h, 0, 0, format, GL_FLOAT, a);
 }
 
@@ -204,10 +205,12 @@
 glps_renderer::draw_pixels (GLsizei w, GLsizei h, GLenum format,
                             GLenum type, const GLvoid *data)
 {
-  if (type == GL_UNSIGNED_SHORT)
-    ::draw_pixels (w, h, format, static_cast<const GLushort *> (data));
-  else if (type == GL_UNSIGNED_BYTE)
-    ::draw_pixels (w, h, format, static_cast<const GLubyte *> (data));
+  // gl2psDrawPixels only supports the GL_FLOAT type.
+  // Other formats, such as uint8, must be converted first.
+  if (type == GL_UNSIGNED_BYTE)
+    ::draw_pixels (w, h, format, static_cast<const GLubyte *> (data), 255.0f);
+  else if (type == GL_UNSIGNED_SHORT)
+    ::draw_pixels (w, h, format, static_cast<const GLushort *> (data), 65535.0f);
   else
     gl2psDrawPixels (w, h, 0, 0, format, type, data);
 }
--- a/scripts/plot/appearance/axis.m	Wed Apr 23 08:42:19 2014 +0200
+++ b/scripts/plot/appearance/axis.m	Thu Apr 24 08:40:40 2014 -0700
@@ -341,7 +341,7 @@
     
     ## Extend image data one pixel
     idx = strcmp (types, "image");
-    if (! isempty (idx) && (ax == "x" || ax == "y"))
+    if (any (idx) && (ax == "x" || ax == "y"))
       imdata = data(idx);
       px = arrayfun (@__image_pixel_size__, kids(idx), "uniformoutput", false);
       ipx = ifelse (ax == "x", 1, 2);