This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
print>LocalPrintsubfunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
47
pj = preparehg( pj, h );
406.941 s91.1%
44
drawnow
400.590 s7.7%
20
if (~useOriginalHGPrinting())
400.022 s0.3%
39
setset( h, 'paperunits', 'poin...
400.011 s0.1%
35
pj.PaperUnits = getget( h, 'pa...
400.011 s0.1%
All other lines  0.044 s0.6%
Totals  7.618 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
graphics/private/preparehgfunction406.930 s91.0%
graphics/private/useOriginalHGPrintingfunction400.022 s0.3%
graphics/private/setsetfunction400.011 s0.1%
legendcolorbarlayout>localChangePositionsubfunction70 s0%
graphics/private/isfigurefunction400 s0%
graphics/private/getgetfunction400 s0%
Self time (built-ins, overhead, etc.)  0.656 s8.6%
Totals  7.618 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function76
Non-code lines (comments, blank lines)42
Code lines (lines that can run)34
Code lines that did run19
Code lines that did not run15
Coverage (did run/can run)55.88 %
Function listing
   time   calls  line
1 function pj = prepare( pj, h )
2 %PREPARE Method to modify a Figure or Simulink model for printing.
3 % It is not always desirable to have output on paper equal that on screen.
4 % The dark backgrounds used on screen would saturate paper with toner. Lines
5 % and text colored in light shades would be very hard to see if dithered on
6 % standard gray scale printers. Arguments to PRINT and the state of some
7 % Figure properties dictate what changes are required while rendering the
8 % Figure or model for output.
9 %
10 % Ex:
11 % pj = PREPARE( pj, h ); %modifies PrintJob pj and Figure/model h
12 %
13 % See also PRINT, PRINTOPT, RESTORE, PREPAREHG, PREPAREUI.
14
15 % Copyright 1984-2010 The MathWorks, Inc.
16 % $Revision: 1.5.4.8 $ $Date: 2010/07/02 16:14:10 $
17
0.01 40 18 error(nargchk(2,2,nargin, 'struct') )
19
0.02 40 20 if (~useOriginalHGPrinting())
21 error('MATLAB:Print:ObsoleteFunction', 'The function %s should only be called when original HG printing is enabled.', upper(mfilename));
22 end
23
40 24 if ~isequal(size(h), [1 1]) || ~ishandle( h )
25 error('MATLAB:Print:PrepareNeedsHandle', 'Need a handle to a Figure or model.' )
26 end
27
28 %Need to see everything when printing
40 29 hiddenH = get( 0, 'showhiddenhandles' );
0.01 40 30 set( 0, 'showhiddenhandles', 'on' )
31
40 32 try
0.01 40 33 err = 0;
34
0.01 40 35 pj.PaperUnits = getget( h, 'paperunits' );
40 36 if ~strcmp(pj.Driver, 'mfile')
37 %don't set paperunits to points if we're not creating a
38 %file that goes to a printer
0.01 40 39 setset( h, 'paperunits', 'points' )
40 40 end
41
40 42 if isfigure( h )
43 % Create Handle Graphics objects on screen if not already there.
0.59 40 44 drawnow
45
46 %Make extensive property changes.
6.94 40 47 pj = preparehg( pj, h );
40 48 end
49
50 %Adobe Illustrator format doesn't allow us to set landscape, draw as portrait
40 51 if strcmp(pj.Driver, 'ill') && ~strcmp('portrait', getget(h,'paperorientation') )
52 warning('MATLAB:Print:IllustratorMustBePortrait', 'Illustrator only supports Portrait orientation, switching to that mode.')
53 pj.Orientation = getget(h,'paperorientation');
54 setset( h, 'paperorientation', 'portrait')
55 end
56
57
58 %If saving a picture, not a printer format, crop the image by moving its
59 %lower-left corner to the lower-left of the page. We will use an option
60 %with GS to crop it at the width and height of the PaperPosition.
61 %This includes the PS generated when we want to use GS to make a TIFF preview.
40 62 if ( strcmp(pj.DriverClass, 'GS') && pj.DriverExport ) ...
63 || (pj.DriverExport && pj.PostScriptPreview == pj.TiffPreview)
64 pj.GhostImage = 1;
65 end
66
67 catch ex
68 err = 1;
69 end
70
71 %Pay no attention to the objects behind the curtain
40 72 set( 0, 'showhiddenhandles', hiddenH )
73
40 74 if err
75 rethrow( ex )
76 end

Other subfunctions in this file are not included in this listing.