This is a static copy of a profile report

Home

graphics/private/validate (6 calls, 0.000 sec)
Generated 14-Nov-2016 07:47:03 using cpu time.
function in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/graphics/private/validate.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
printfunction6
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
186
end
60 s0%
180
if ~pj.UseOriginalHGPrinting &...
60 s0%
170
if ~isempty(pt)
60 s0%
169
pt = getprinttemplate(h);
60 s0%
166
if isfigure(h)
60 s0%
All other lines  0 s0%
Totals  0 s0% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
isFigureShowEnabledfunction60 s0%
getprinttemplatefunction60 s0%
graphics/private/isfigurefunction120 s0%
ispcfunction60 s0%
graphics/private/validateHandleToPrintfunction60 s0%
Self time (built-ins, overhead, etc.)  0 s0%
Totals  0 s0% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function186
Non-code lines (comments, blank lines)61
Code lines (lines that can run)125
Code lines that did run22
Code lines that did not run103
Coverage (did run/can run)17.60 %
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-2014 The MathWorks, Inc.
  13 

      6 
  14 
pj.Validated = 1; 
  15 

  16 
%If no window requested, and none to act as default, error out.
      6 
  17 
pj = validateHandleToPrint(pj);  
  18 

      6 
  19 
if ~pj.UseOriginalHGPrinting 
  20 
   % for future use
      6 
  21 
   if pj.RGBImage  
  22 
       if ~isempty(pj.Driver)
  23 
           error(message('MATLAB:print:IncompatibleRGBImageOptionNoDriver', pj.Driver));
  24 
       end
  25 
       
  26 
       if ~isempty(pj.FileName)
  27 
           error(message('MATLAB:print:IncompatibleRGBImageOptionFilename'));
  28 
       end
  29 
       
  30 
       if ~isempty(pj.PrinterName)
  31 
           error(message('MATLAB:print:IncompatibleRGBImageOptionPrinter'));
  32 
       end
  33 
   end
  34 
   
      6 
  35 
   if pj.ClipboardOption  
  36 
       if ~isempty(pj.FileName)
  37 
           error(message('MATLAB:print:IncompatibleClipboardOptionFilename'));
  38 
       end
  39 
       
  40 
       if ~isempty(pj.PrinterName)
  41 
           error(message('MATLAB:print:IncompatibleClipboardOptionPrinter'));
  42 
       end
  43 
       
  44 
       if isempty(pj.Driver) 
  45 
           error(message('MATLAB:print:IncompatibleClipboardOptionNoDriver'));
  46 
       end
  47 
       
  48 
       if ~pj.DriverClipboard %driver doesn't support clipboard
  49 
           error(message('MATLAB:print:IncompatibleClipboardOptionDriver', pj.Driver));
  50 
       end
  51 
       
  52 
   end
      6 
  53 
end 
  54 

      6 
  55 
if ~ispc && isfigure(  pj.Handles{1} ) 
  56 
    % Check for Simulink-only formats
      6 
  57 
    if strcmp(pj.DriverClass, 'QT' ) 
  58 
        error(message('MATLAB:print:SimulinkOnlyDevice', upper( pj.Driver )));
  59 
    end
      6 
  60 
end 
  61 

      6 
  62 
if pj.PostScriptPreview && ~strcmp(pj.DriverClass,'EP') 
  63 
    error(message('MATLAB:print:ValidateTiffPreviewOnlyWithEPS'))
  64 
end
  65 

  66 
%If no device given, use default from PRINTOPT
      6 
  67 
if ~pj.RGBImage && isempty( pj.Driver ) 
  68 
    %Use method to validate default and set related class variables
  69 
    wasError = 0;
  70 
    try
  71 
        pj = inputcheck( pj, pj.DefaultDevice );
  72 
        pj.DriverColorSet = 0;
  73 
    catch ex  %#ok<NASGU>
  74 
        wasError = 1;
  75 
    end
  76 
    if wasError || isempty( pj.Driver )
  77 
      error(message('MATLAB:print:ValidateUnknownDeviceType', pj.DefaultDevice));
  78 
    end
  79 
end
  80 

      6 
  81 
if strcmp(pj.DriverClass, 'MW' )  
  82 
    if isunix
  83 
      error(message('MATLAB:print:ValidateUseWindowsDriver', pj.Driver));
  84 
    end
  85 
    
  86 
    % If user specifies a filename while device is -dwin
  87 
    % or -dwinc, either because the user gave that device or, more
  88 
    % likely, it's the default, and since the filename is useless
  89 
    % with Windows driver anyway, we'll assume the user really wants
  90 
    % a PostScript file. This is because 'print foo' is easier
  91 
    % to type then 'print -dps foo' and probably more commonly
  92 
    % meant if a filename is given. Unless of course the user asked
  93 
    % for the Print Dialog with the -v flag, then s/he really meant it.
  94 
    if (~isempty(pj.FileName) && ~pj.Verbose ) ...
  95 
            && ( strcmp(pj.Driver, 'win') || strcmp(pj.Driver, 'winc') )
  96 
        if pj.DriverColor
  97 
            pj.Driver = 'psc';
  98 
        else
  99 
            pj.Driver = 'ps';
 100 
        end
 101 
        pj.DriverExt = 'ps';
 102 
        pj.DriverClass = 'PS';
 103 
    end
 104 
end
 105 

      6 
 106 
if pj.XTerminalMode && pj.UseOriginalHGPrinting 
 107 
    % Substitute ghostscript drivers for tiff and png in headless
 108 
    % mode and otherwise error
 109 
    invalidInEmulationMode = 0;
 110 
    if strcmp(pj.DriverClass, 'IM' )
 111 
      if strcmp(pj.Driver,'tiff')
 112 
        pj.Driver = 'tiff24nc';
 113 
        pj.DriverClass = 'GS';
 114 
      elseif strcmp(pj.Driver,'png')
 115 
        pj.Driver = 'png16m';
 116 
        pj.DriverClass = 'GS';
 117 
      else
 118 
        invalidInEmulationMode = 1;
 119 
      end
 120 
    elseif strcmp(pj.DriverClass, 'MW')
 121 
        if strcmp(pj.Driver, 'meta') || strcmp(pj.Driver, 'bitmap')
 122 
            invalidInEmulationMode = 1;
 123 
        end
 124 
    end
 125 
    if invalidInEmulationMode
 126 
        error(message('MATLAB:print:ValidateTerminalModeNotAllowed', upper( pj.Driver )))
 127 
    end
 128 
end
 129 

      6 
 130 
if strcmp( pj.Driver, 'mfile' )  
 131 
    if ~pj.UseOriginalHGPrinting
 132 
        error(message('MATLAB:print:DeprecatedMATLABCodeGenerationOption'));
 133 

 134 
    end
 135 
    if ~all( ishghandle( [pj.Handles{:} ] ))
 136 
        error(message('MATLAB:print:ValidateMFileNotAllowed'))
 137 
    end
 138 

 139 
    if isempty( pj.FileName )
 140 
        error(message('MATLAB:print:ValidateMissingFileName'))
 141 
    end
 142 
    
 143 
    locMakeSafeForDmfile( pj.Handles )
 144 
end
 145 

 146 
%GhostScript produced image formats needs -loose PS files
      6 
 147 
if ( strcmp(pj.DriverClass, 'GS') && pj.DriverExport ) 
 148 
    pj.PostScriptTightBBox = 0;
 149 
end
 150 

 151 
%TIFF previews imply -loose, historically because ZBuffer TIFF was always "loose".
      6 
 152 
if pj.PostScriptPreview == pj.TiffPreview 
 153 
    pj.PostScriptTightBBox = 0;
 154 
    
 155 
    %We have to produce a 72dpi EPS file first, have GS convert it to
 156 
    %TIFF, and then we combine a second high res EPS and the TIFF together.
 157 
    %Already checked above that for TIFF preview we have only one page.
 158 
    if pj.UseOriginalHGPrinting
 159 
        pj.GhostDriver = 'tiffpack';
 160 
        pj.GhostName = [tempname '.tif'];
 161 
    end
 162 
    pj.PostScriptPreview = pj.TiffPreview;
 163 
end
 164 

      6 
 165 
h = pj.Handles{1}(1); 
      6 
 166 
if isfigure(h) 
 167 
  %Fill renderer and -noui from the printtemplate (if it exists) if
 168 
  %the user didn't specify these options on the command line
      6 
 169 
  pt = getprinttemplate(h); 
      6 
 170 
  if ~isempty(pt) 
 171 
	if ~pj.nouiOption
 172 
	  pj.PrintUI = pt.PrintUI;
 173 
	end
 174 
	if ~pj.rendererOption && ~strcmp( pt.Renderer, 'auto' )
 175 
	  pj.Renderer = pt.Renderer;
 176 
      pj.rendererOption = 1; % overriding figure renderer
 177 
	end
 178 
  end
 179 
  
      6 
 180 
  if ~pj.UseOriginalHGPrinting && ~matlab.ui.internal.isFigureShowEnabled 
 181 
      %If user did not specify -noui and there are visible uicontrols, error now
 182 
      if ~pj.nouiOption && ~isempty(validateFindControls(h))
 183 
          error(message('MATLAB:prepareui:UnsupportedPlatform'));
 184 
      end
 185 
  end
      6 
 186 
end 

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