This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
...rintPath>LocalInvertColorsIfNeededsubfunction6
...gt;LocalRestoreInvertedColorsIfNeededsubfunction6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
70
adjustbackground('save', h);
63.941 s74.8%
85
adjustbackground('restore', h)...
61.330 s25.2%
91
end
120 s0%
90
end
60 s0%
83
case 1
60 s0%
All other lines  0 s0%
Totals  5.271 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
graphics/private/adjustbackgroundfunction125.271 s100.0%
Self time (built-ins, overhead, etc.)  0 s0%
Totals  5.271 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function91
Non-code lines (comments, blank lines)45
Code lines (lines that can run)46
Code lines that did run27
Code lines that did not run19
Coverage (did run/can run)58.70 %
Function listing
time 
calls 
 line
   1 
function varargout = modifyColorsForPrint(invertRevertFlag, varargin)
   2 
% MODIFYCOLORSFORPRINT Modify a figure's colors for printing based on
   3 
% preference settings for figure copy options.  This undocumented helper
   4 
% function is for internal use.
   5 

   6 
% This function is called during the print path.  See usage in
   7 
% alternatePrintPath.m
   8 
    
   9 
% MODIFYCOLORSFORPRINT('invert', h, honorColorPrefs,
  10 
% outputRendererIsPainters, outputBitmap, figbkcolorpref) can be used to
  11 
% invert the colors based on the arguments.  The return will be:
  12 
% [modified, invertedFlag, originalColor].  The invertedFlag and
  13 
% originalColor can be used when calling this function to 'revert'.
  14 

  15 
% MODIFYCOLORSFORPRINT('revert', h, invertedFlag, origColor) reverts the
  16 
% colors to their original values, before 'invert' was called.
  17 
    
  18 
%   Copyright 2013 The MathWorks, Inc.
  19 

     12 
  20 
    if strcmp(invertRevertFlag, 'invert') && length(varargin) == 5 
      6 
  21 
        h = varargin{1}; 
      6 
  22 
        honorColorPrefs = varargin{2}; 
      6 
  23 
        outputRendererIsPainters = varargin{3}; 
      6 
  24 
        outputBitmap = varargin{4}; 
      6 
  25 
        figbkcolorpref = varargin{5}; 
  26 
        
      6 
  27 
        modified = false; 
      6 
  28 
        inverted = 0; 
      6 
  29 
        origColor = []; 
  30 
        
      6 
  31 
        if honorColorPrefs 
  32 
            % if called from Edit->Copy Figure, check what figure
  33 
            % background setting is in place from Edit->Copy Options.  The
  34 
            % result of the copy is also dependent on the renderer and the
  35 
            % format selected.
  36 
            
  37 
            % figbkcolor will be one of the following:
  38 
            %    0 == 'none' (transparent)
  39 
            %    1 == white
  40 
            %    2 == use figure background
  41 
            
  42 
            switch figbkcolorpref
  43 
                case 0  % none/transparent background
  44 
                    if outputRendererIsPainters && ~outputBitmap
  45 
                        % Can produce transparent background
  46 
                        inverted = 2;
  47 
                        origColor = LocalColorNone(h);
  48 
                    else
  49 
                        % The user has selected transparent background, but
  50 
                        % we can't produce it either because of the
  51 
                        % renderer or the output format.  Either way,
  52 
                        % instead of creating output with black background,
  53 
                        % set it to white
  54 
                        inverted = 1;
  55 
                        adjustbackground('save', h);
  56 
                    end
  57 
                    modified = true;
  58 
                    
  59 
                case 1  % white background
  60 
                    inverted = 1;
  61 
                    adjustbackground('save', h);
  62 
                    modified = true;
  63 
                    
  64 
                case 2  % figure background
  65 
                    % Nothing to do in this case
  66 
            end
      6 
  67 
        else 
      6 
  68 
            if strcmp('on', get(h,'InvertHardcopy')) 
      6 
  69 
                inverted = 1; 
  3.94 
      6 
  70 
                adjustbackground('save', h); 
      6 
  71 
                modified = true; 
      6 
  72 
            end 
      6 
  73 
        end 
  74 
        
      6 
  75 
        varargout = {modified, inverted, origColor}; 
      6 
  76 
    elseif strcmp(invertRevertFlag, 'revert') 
      6 
  77 
        h = varargin{1}; 
      6 
  78 
        inverted = varargin{2}; 
      6 
  79 
        origColor = varargin{3}; 
  80 
        
  81 
        % Invert back the toner saving/colornone color changes
      6 
  82 
        switch inverted 
      6 
  83 
            case 1 
  84 
                % inverthardcopy == true
  1.33 
      6 
  85 
                adjustbackground('restore', h); 
  86 
            case 2
  87 
                % print w/transparent background == true (edit->CopyOptions)
  88 
                LocalColorNone(h, origColor);
  89 
        end
      6 
  90 
    end 
     12 
  91 
end 

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