This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
printfunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
17
pj = validateHandleToPrint(pj)...
400.022 s28.6%
186
pt = getprinttemplate(h);
400.011 s14.3%
144
if strcmp( pj.Driver, 'mfile' ...
400.011 s14.3%
93
if strcmp(pj.DriverClass, 'MW'...
400.011 s14.3%
77
if ~pj.RGBImage && ise...
400.011 s14.3%
All other lines  0.011 s14.3%
Totals  0.077 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
graphics/private/validateHandleToPrintfunction400.022 s28.6%
getprinttemplatefunction400 s0%
graphics/private/isfigurefunction800 s0%
ispcfunction400 s0%
Self time (built-ins, overhead, etc.)  0.055 s71.4%
Totals  0.077 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function195
Non-code lines (comments, blank lines)76
Code lines (lines that can run)119
Code lines that did run18
Code lines that did not run101
Coverage (did run/can run)15.13 %
Function listing
   time   calls  line
1 function pj = validate( pj )
2 %VALIDATE Method to check state of PrintJob object.
3 % Values of PrintJob object class variables are checked for consistency.
4 % Errors out if it finds bad combinations. Fills in missing data with
5 % defaults.
6 %
7 % Ex:
8 % pj = VALIDATE( pj );
9 %
10 % See also PRINT, PRINTOPT, INPUTCHECK.
11
12 % Copyright 1984-2010 The MathWorks, Inc.
13
40 14 pj.Validated = 1;
15
16 %If no window requested, and none to act as default, error out.
0.02 40 17 pj = validateHandleToPrint(pj);
18
40 19 if ~pj.UseOriginalHGPrinting
20 % for future use
21 if pj.RGBImage
22 if ~isempty(pj.Driver)
23 error('MATLAB:Print:IncompatibleRGBImageOptionNoDriver', ...
24 ['The ''-d' pj.Driver ''' option is not supported with ''-RGBImage''.'] );
25 end
26
27 if ~isempty(pj.FileName)
28 error('MATLAB:Print:IncompatibleRGBImageOptionFilename', ...
29 'The ''filename'' option is not supported with ''-RGBImage''.' );
30 end
31
32 if ~isempty(pj.PrinterName)
33 error('MATLAB:Print:IncompatibleRGBImageOptionPrinter', ...
34 'The ''-Pprinter'' option is not supported with ''-RGBImage''.' );
35 end
36 end
37
38 if pj.ClipboardOption
39 if ~isempty(pj.FileName)
40 error('MATLAB:Print:IncompatibleClipboardOptionFilename', ...
41 'The ''filename'' option is not supported with ''-clipboard''.' );
42 end
43
44 if ~isempty(pj.PrinterName)
45 error('MATLAB:Print:IncompatibleClipboardOptionPrinter', ...
46 'The ''-Pprinter'' option is not supported with ''-clipboard''.' );
47 end
48
49 if isempty(pj.Driver)
50 error('MATLAB:Print:IncompatibleClipboardOptionNoDriver', ...
51 'A valid driver, for example ''-dbitmap'', must be specified with the ''-clipboard'' option.');
52 end
53
54 if ~pj.DriverClipboard %driver doesn't support clipboard
55 error('MATLAB:Print:IncompatibleClipboardOptionDriver', ...
56 ['The ''-clipboard'' option can not be used with the ''' ...
57 pj.Driver ''' driver.']);
58 end
59
60 end
61 end
62
0.01 40 63 if ~ispc && isfigure( pj.Handles{1} )
64 % Check for Simulink-only formats
40 65 if strcmp(pj.DriverClass, 'QT' )
66 error('MATLAB:Print:SimulinkOnlyDevice', ...
67 'The %s device option is only supported for Simulink systems.', ...
68 upper(pj.Driver));
69 end
40 70 end
71
40 72 if pj.PostScriptPreview && ~strcmp(pj.DriverClass,'EP')
73 error('MATLAB:Print:ValidateTiffPreviewOnlyWithEPS', 'TIFF previews allowed only with EPS output.' )
74 end
75
76 %If no device given, use default from PRINTOPT
0.01 40 77 if ~pj.RGBImage && isempty( pj.Driver )
78 %Use method to validate default and set related class variables
79 wasError = 0;
80 try
81 pj = inputcheck( pj, pj.DefaultDevice );
82 pj.DriverColorSet = 0;
83 catch ex %#ok<NASGU>
84 wasError = 1;
85 end
86 if wasError || isempty( pj.Driver )
87 error('MATLAB:Print:ValidateUnknownDeviceType',...
88 ['PRINTOPT specifies an unknown device type '''...
89 pj.DefaultDevice '''.'])
90 end
91 end
92
0.01 40 93 if strcmp(pj.DriverClass, 'MW' )
94 if isunix
95 error('MATLAB:Print:ValidateUseWindowsDriver',...
96 ['Can only use Windows driver ''' pj.Driver ''' on a Windows machine.'])
97 end
98
99 % If user specifies a filename while device is -dwin
100 % or -dwinc, either because the user gave that device or, more
101 % likely, it's the default, and since the filename is useless
102 % with Windows driver anyway, we'll assume the user really wants
103 % a PostScript file. This is because 'print foo' is easier
104 % to type then 'print -dps foo' and probably more commonly
105 % meant if a filename is given. Unless of course the user asked
106 % for the Print Dialog with the -v flag, then s/he really meant it.
107 if (~isempty(pj.FileName) && ~pj.Verbose ) ...
108 && ( strcmp(pj.Driver, 'win') || strcmp(pj.Driver, 'winc') )
109 if pj.DriverColor
110 pj.Driver = 'psc';
111 else
112 pj.Driver = 'ps';
113 end
114 pj.DriverExt = 'ps';
115 pj.DriverClass = 'PS';
116 end
117 end
118
40 119 if pj.XTerminalMode && pj.UseOriginalHGPrinting
120 % Substitute ghostscript drivers for tiff and png in headless
121 % mode and otherwise error
122 invalidInEmulationMode = 0;
123 if strcmp(pj.DriverClass, 'IM' )
124 if strcmp(pj.Driver,'tiff')
125 pj.Driver = 'tiff24nc';
126 pj.DriverClass = 'GS';
127 elseif strcmp(pj.Driver,'png')
128 pj.Driver = 'png16m';
129 pj.DriverClass = 'GS';
130 else
131 invalidInEmulationMode = 1;
132 end
133 elseif strcmp(pj.DriverClass, 'MW')
134 if strcmp(pj.Driver, 'meta') || strcmp(pj.Driver, 'bitmap')
135 invalidInEmulationMode = 1;
136 end
137 end
138 if invalidInEmulationMode
139 error('MATLAB:Print:ValidateTerminalModeNotAllowed',...
140 'Cannot produce %s files in terminal emulation mode.',upper(pj.Driver) )
141 end
142 end
143
0.01 40 144 if strcmp( pj.Driver, 'mfile' )
145 if feature('HGUsingMATLABClasses')
146 error('MATLAB:print:DeprecatedMATLABCodeGenerationOption', ...
147 'The generation of MATLAB code is no longer available.');
148
149 end
150 if ~all( ishghandle( [pj.Handles{:} ] ))
151 error('MATLAB:Print:ValidateMFileNotAllowed',...
152 'The -dmfile device option cannot be used with Simulink systems.' )
153 end
154
155 if isempty( pj.FileName )
156 error('MATLAB:Print:ValidateMissingFileName',...
157 'Filename required for saving Figure to M-file.' )
158 end
159
160 locMakeSafeForDmfile( pj.Handles )
161 end
162
163 %GhostScript produced image formats needs -loose PS files
40 164 if ( strcmp(pj.DriverClass, 'GS') && pj.DriverExport )
165 pj.PostScriptTightBBox = 0;
166 end
167
168 %TIFF previews imply -loose, historicly because ZBuffer TIFF was always "loose".
40 169 if pj.PostScriptPreview == pj.TiffPreview
170 pj.PostScriptTightBBox = 0;
171
172 %We have to produce a 72dpi EPS file first, have GS convert it to
173 %TIFF, and then we combine a second high res EPS and the TIFF together.
174 %Already checked above that for TIFF preview we have only one page.
175 if pj.UseOriginalHGPrinting
176 pj.GhostDriver = 'tiffpack';
177 pj.GhostName = [tempname '.tif'];
178 end
179 pj.PostScriptPreview = pj.TiffPreview;
180 end
181
182 %Fill renderer and -noui from the printtemplate (if it exists) if
183 %the user didn't specify these options on the command line
40 184 h = pj.Handles{1}(1);
40 185 if isfigure(h)
0.01 40 186 pt = getprinttemplate(h);
40 187 if ~isempty(pt)
188 if ~pj.nouiOption
189 pj.PrintUI = pt.PrintUI;
190 end
191 if ~pj.rendererOption && ~strcmp( pt.Renderer, 'auto' )
192 pj.Renderer = pt.Renderer;
193 end
194 end
40 195 end

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