This is a static copy of a profile report

Home

graphics/private/restorehg (40 calls, 4.449 sec)
Generated 05-Aug-2011 13:03:07 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/graphics/private/restorehg.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
graphics/private/restorefunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
102
fireprintbehavior(h,'PostPrint...
403.519 s79.1%
56
savtoner('restore', h);
400.743 s16.7%
108
drawnow;
400.142 s3.2%
100
rmappdata(0,'BusyPrinting');
400.011 s0.2%
47
noselection('restore',h);
400.011 s0.2%
All other lines  0.022 s0.5%
Totals  4.449 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
graphics/private/fireprintbehaviorfunction403.519 s79.1%
savtonerfunction400.743 s16.7%
graphics/private/noselectionfunction400.011 s0.2%
legendcolorbarlayout>localChangePositionsubfunction130 s0%
findallfunction400 s0%
graphics/private/restoreuifunction400 s0%
noanimatefunction400 s0%
graphics/private/isfigurefunction400 s0%
graphics/private/useOriginalHGPrintingfunction400 s0%
Self time (built-ins, overhead, etc.)  0.175 s3.9%
Totals  4.449 s100% 
Code Analyzer results
Line numberMessage
41NOANIMATE will be removed in a future release. There is no simple replacement for this.
Coverage results
[ Show coverage for parent directory ]
Total lines in function120
Non-code lines (comments, blank lines)55
Code lines (lines that can run)65
Code lines that did run34
Code lines that did not run31
Coverage (did run/can run)52.31 %
Function listing
   time   calls  line
1 function pj = restorehg( pj, h )
2 %RESTOREHG Reset a Figure after printing.
3 % When printing a Figure, some of its properties have to be changed to
4 % create the desired output. RESTOREHG resets the properties back to
5 % their original values.
6 %
7 % Ex:
8 % pj = RESTOREHG( pj, h ); %modifies PrintJob pj and Figure h
9 %
10 % See also PRINT, PRINTOPT, PREPARE, PREPAREHG, RESTORE, RESTOREUI.
11
12 % Copyright 1984-2009 The MathWorks, Inc.
13 % $Revision: 1.4.4.10 $ $Date: 2009/04/21 03:24:44 $
14
0.01 40 15 error( nargchk(2,2,nargin,'struct') )
16
40 17 if (~useOriginalHGPrinting())
18 error('MATLAB:Print:ObsoleteFunction', 'The function %s should only be called when original HG printing is enabled.', upper(mfilename));
19 end
20
0.01 40 21 if ~isequal(size(h), [1 1]) || ~isfigure( h )
22 error('MATLAB:restorehg:InvalidHandle','Need a handle to a Figure object.' )
23 end
24
25 %Early exit, saved Figure as is.
40 26 if strcmp(pj.Driver, 'mfile')
27 pj.hgdata = [];
28 return
29 end
30
31
32 %Get quicker link to saved data
40 33 hgdata = pj.hgdata;
34
35 % If printing to JPEG or TIFF file, then we need to restore animated
36 % objects back to their previous erasemode.
37 % Same if producing TIFF for EPS preview of printed Figure.
40 38 if strcmp(pj.DriverClass, 'IM') || ((pj.PostScriptPreview == pj.TiffPreview) && ~pj.GhostImage)
40 39 [prevWarnMsg prevWarnID] = lastwarn;
40 40 noanimateWarn = warning('off', 'MATLAB:noanimate:DeprecatedFunction');
40 41 noanimate('restore',h);
40 42 warning(noanimateWarn);
40 43 lastwarn(prevWarnMsg, prevWarnID);
40 44 end
45
46 % Reselect any objects that were selected before we printed the Figure.
0.01 40 47 noselection('restore',h);
48
49 % set color of lines and text back to what they were
40 50 if hgdata.Undithered
51 nodither('restore', h);
52 end
53
54 % Invert back the toner saving color changes
40 55 if (hgdata.Inverted == 1)
0.74 40 56 savtoner('restore', h);
57 elseif (hgdata.Inverted == 2)
58 colornone('restore', h);
59 end
60
40 61 if ~isempty( pj.Renderer )
62 set( h, 'renderer', hgdata.Renderer )
63 if hgdata.RendererAutoMode
64 set( h, 'renderermode', 'auto' )
65 end
66 end
67
68 %Recover from the funky changes necessary to handle ResizeFcn's.
40 69 if ~isempty( hgdata.PixelObjects )
70 set( hgdata.PixelObjects, 'units', 'pixels' )
71 hgdata.PixelObjects = [];
72 end
40 73 if ~isempty( hgdata.FontPixelObjects )
74 set( hgdata.FontPixelObjects, 'fontunits', 'pixels' )
75 hgdata.FontPixelObjects = [];
76 end
77
78 %%% Clean up UIControls
40 79 if pj.PrintUI
40 80 pj = restoreui( pj, h );
40 81 end
82
40 83 if ~isempty( hgdata.ResizeFcn )
84 set( h, 'ResizeFcn', hgdata.ResizeFcn );
85 end
86
87 %Put Figure back to original size if we needed to
88 %resize Figure to PaperPosition.
40 89 if hgdata.ResizedWindow
90 set( h, 'units', hgdata.WindowUnits, 'position', hgdata.WindowPos );
91 end
92
93 %Figures can be formatted for output via a PrintTemplate object
40 94 if ~isempty( hgdata.PrintTemplate )
95 ptrestorehg( hgdata.PrintTemplate, h );
96 end
97
98 % Indicate that we are finished printing.
40 99 if isappdata(0,'BusyPrinting')
0.01 40 100 rmappdata(0,'BusyPrinting');
40 101 end
3.52 40 102 fireprintbehavior(h,'PostPrintCallback');
103
40 104 if ~hgdata.ResizedWindow && ((hgdata.Inverted || hgdata.Undithered) && ~strcmp(pj.Driver, 'bitmap') ) && ...
105 (isempty(pj.UIData) || isempty(pj.UIData.UICHandles) )
106 % Call drawnow here to make sure all objects are back to their original
107 % states.
0.14 40 108 drawnow;
40 109 end
110
111 % If windows cover up our figure during printing, then the figure will have rendered
112 % in the wrong (print vs. screen) state unless backingstore is on. XOR'ed objects
113 % never get put into the backingstore and so they will always render incorrectly.
114 % To fix the figure after one of these cases, we call refresh below.
40 115 if strcmp(get(h, 'BackingStore'), 'off') || ~isempty(findall(h, 'EraseMode', 'xor'))
116 refresh(h);
117 end
118
119 %Don't need it anymore, get rid of it so next Figure to be printed doesn't use it.
40 120 pj.hgdata = [];