diff scripts/plot/util/print.m @ 26728:f034b29320ad

Use OpenGl textures to render image objects (bug #55632). * gl-render.[h,cc] (opengl_renderer): Change the following data members to protected rather than private and allow easy access from gl2ps_renderer: xmin, xmax, ymin, ymax, zmin, zmax, m_devpixratio, xform. (opengl_renderer::draw_pixels): Remove virtual methods. (opengl_renderer::draw_image): Remove unnecessary manual clipping code. Make use of an opengl_texture to draw pixels rather than glDrawPixels. (opengl_texture::create): Add support for single and uint16 type pixel data. * gl2ps-print.cc (gl2ps_renderer::draw_image): New overload. Dump here all the manual clipping code, which is still necessary since gl2ps does not support textures only emulates glDrawPixels. * print.m: Set figure "__printing__" property first and reset last. Set figure "__modified__" to "off" after resetting all properties.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Fri, 08 Feb 2019 18:07:33 +0100
parents 6764d6a428ca
children 57702c4e37d9
line wrap: on
line diff
--- a/scripts/plot/util/print.m	Wed Feb 13 15:38:23 2019 +0000
+++ b/scripts/plot/util/print.m	Fri Feb 08 18:07:33 2019 +0100
@@ -466,6 +466,13 @@
 
     drawnow ();
 
+    ## Set the __printing__ property first
+    props(1).h = opts.figure;
+    props(1).name = "__printing__";
+    props(1).value = {"off"};
+    set (opts.figure, "__printing__", "on");
+    nfig += 1;
+
     ## print() requires children of axes to have units = "normalized", or "data"
     hobj = findall (opts.figure, "-not", "type", "figure", ...
                     "-not", "type", "axes", "-property", "units", ...
@@ -552,13 +559,10 @@
     ## graphics toolkit translates figure position to eps bbox (points)
     fpos = get (opts.figure, "position");
     props(end+1).h = opts.figure;
-    props(end).name = "__printing__";
-    props(end).value = {"off"};
-    props(end+1).h = opts.figure;
     props(end).name = "position";
     props(end).value = {fpos};
     fpos(3:4) = opts.canvas_size;
-    set (opts.figure, "__printing__", "on", "position", fpos);
+    set (opts.figure, "position", fpos);
     nfig += 1;
 
     ## Implement InvertHardCopy option
@@ -727,6 +731,9 @@
       endfor
     endif
 
+    ## Avoid a redraw since the figure should not have changed
+    set (gcf, "__modified__", "off");
+
     ## Unlink temporary files
     for n = 1:numel (opts.unlink)
       [status, output] = unlink (opts.unlink{n});
@@ -740,7 +747,6 @@
   if (isfigure (orig_figure))
     set (0, "currentfigure", orig_figure);
   endif
-
 endfunction
 
 function cmd = epstool (opts, filein, fileout)