changeset 17435:499fc170bca3

Merged with main repo, after changing the color variable.
author Andrej Lojdl <andrej.lojdl@gmail.com>
date Thu, 12 Sep 2013 21:57:54 +0200
parents 71b6f8a81e80 (current diff) e89e86e1a551 (diff)
children d415dc6ac1e2
files
diffstat 4 files changed, 37 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/byte-swap.h
+++ b/liboctave/util/byte-swap.h
@@ -23,13 +23,10 @@
 #if !defined (octave_byte_swap_h)
 #define octave_byte_swap_h 1
 
-// FIXME -- not sure these volatile qualifiers are really
-// needed or appropriate here.
-
 static inline void
-swap_bytes (volatile void *ptr, unsigned int i, unsigned int j)
+swap_bytes (void *ptr, unsigned int i, unsigned int j)
 {
-  volatile char *t = static_cast<volatile char *> (ptr);
+  char *t = static_cast<char *> (ptr);
 
   char tmp = t[i];
   t[i] = t[j];
@@ -38,7 +35,7 @@
 
 template <int n>
 void
-swap_bytes (volatile void *ptr)
+swap_bytes (void *ptr)
 {
   for (int i = 0; i < n/2; i++)
     swap_bytes (ptr, i, n-1-i);
@@ -46,20 +43,20 @@
 
 template <>
 inline void
-swap_bytes <1> (volatile void *)
+swap_bytes<1> (void *)
 {
 }
 
 template <>
 inline void
-swap_bytes <2> (volatile void *ptr)
+swap_bytes<2> (void *ptr)
 {
   swap_bytes (ptr, 0, 1);
 }
 
 template <>
 inline void
-swap_bytes <4> (volatile void *ptr)
+swap_bytes<4> (void *ptr)
 {
   swap_bytes (ptr, 0, 3);
   swap_bytes (ptr, 1, 2);
@@ -67,7 +64,7 @@
 
 template <>
 inline void
-swap_bytes <8> (volatile void *ptr)
+swap_bytes<8> (void *ptr)
 {
   swap_bytes (ptr, 0, 7);
   swap_bytes (ptr, 1, 6);
@@ -77,9 +74,9 @@
 
 template <int n>
 void
-swap_bytes (volatile void *ptr, int len)
+swap_bytes (void *ptr, int len)
 {
-  volatile char *t = static_cast<volatile char *> (ptr);
+  char *t = static_cast<char *> (ptr);
 
   for (int i = 0; i < len; i++)
     {
@@ -90,7 +87,7 @@
 
 template <>
 inline void
-swap_bytes<1> (volatile void *, int)
+swap_bytes<1> (void *, int)
 {
 }
 
--- a/liboctave/util/data-conv.cc
+++ b/liboctave/util/data-conv.cc
@@ -37,10 +37,6 @@
 #include "lo-ieee.h"
 #include "oct-locbuf.h"
 
-template void swap_bytes<2> (volatile void *, int);
-template void swap_bytes<4> (volatile void *, int);
-template void swap_bytes<8> (volatile void *, int);
-
 #if defined HAVE_LONG_LONG_INT
 #define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \
   do \
--- a/scripts/plot/colorbar.m
+++ b/scripts/plot/colorbar.m
@@ -299,13 +299,32 @@
     cmin = cext(1) + cdiff;
     cmax = cext(2) - cdiff;
 
+    hiax = get (hi, "parent");
     if (vert)
       set (hi, "ydata", [cmin, cmax]);
-      set (get (hi, "parent"), "ylim", cext);
+      set (hiax, "ylim", cext);
     else
       set (hi, "xdata", [cmin, cmax]);
-      set (get (hi, "parent"), "xlim", cext);
+      set (hiax, "xlim", cext);
     endif
+
+    ## FIXME: Setting xlim or ylim from within a listener callback
+    ##        causes the axis to change size rather than change limits.
+    ##        Workaround it by jiggling the position property which forces
+    ##        a redraw of the axis object.
+    ##
+    ## Debug Example:
+    ## Uncomment the line below.
+    ##   keyboard;
+    ## Now run the the following code.
+    ##   clf; colorbar (); contour (peaks ())
+    ## Once the keyboard command has been hit in the debugger try
+    ##   set (hiax, "ylim", [0 0.5]) 
+    pos = get (hiax, "position");
+    pos(1) += eps;
+    set (hiax, "position", pos);
+    pos(1) -= eps;
+    set (hiax, "position", pos);
   endif
 endfunction
 
@@ -329,7 +348,6 @@
 endfunction
 
 function update_colorbar_axis (h, d, cax, orig_props)
-
   if (isaxes (cax)
       && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
     loc = get (cax, "location");
--- a/scripts/plot/private/__contour__.m
+++ b/scripts/plot/private/__contour__.m
@@ -235,6 +235,10 @@
   filled = get (hg, "fill");
   ca = gca ();
 
+  ## Turn off automatic updating of clim while adding patches
+  climmode = get (ca, "climmode");
+  set (ca, "climmode", "manual"); 
+
   if (strcmpi (lc, "auto"))
     lc = "flat";
   endif
@@ -393,6 +397,8 @@
     endwhile
   endif
 
+  set (ca, "climmode", climmode);
+
 endfunction
 
 function update_zlevel (h, d)