MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Draw

Method Draw

Source/Profiler.cpp:122–154  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

120
121//static
122void Profiler::Draw()
123{
124 if (!sEnableProfiler)
125 return;
126
127 ofPushMatrix();
128 ofTranslate(30, 70);
129 ofPushStyle();
130 ofFill();
131 ofSetColor(0, 0, 0, 140);
132 //ofRect(-5,-15,600,sCosts.size()*15+10);
133 long entireFrameUs = GetSafeFrameLengthNanoseconds();
134 for (int i = 0; i < PROFILER_MAX_TRACK; ++i)
135 {
136 if (sCosts[i].mName[0] == 0)
137 break;
138 const Cost& cost = sCosts[i];
139 long maxCost = cost.MaxCost();
140
141 ofSetColor(255, 255, 255);
142 gFont.DrawString(std::string(sCosts[i].mName) + ": " + ofToString(maxCost / 1000), 13, 0, 0);
143
144 if (maxCost > entireFrameUs)
145 ofSetColor(255, 0, 0);
146 else
147 ofSetColor(0, 255, 0);
148 ofRect(250, -10, (float)maxCost / entireFrameUs * (ofGetWidth() - 300) * .1f, 10);
149
150 ofTranslate(0, 15);
151 }
152 ofPopStyle();
153 ofPopMatrix();
154}
155
156//static
157long Profiler::GetSafeFrameLengthNanoseconds()

Callers

nothing calls this directly

Calls 12

ofPushMatrixFunction · 0.85
ofTranslateFunction · 0.85
ofPushStyleFunction · 0.85
ofFillFunction · 0.85
ofSetColorFunction · 0.85
ofToStringFunction · 0.85
ofRectFunction · 0.85
ofGetWidthFunction · 0.85
ofPopStyleFunction · 0.85
ofPopMatrixFunction · 0.85
MaxCostMethod · 0.80
DrawStringMethod · 0.80

Tested by

no test coverage detected