mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 05:38:39 -05:00
GLFont::getFont() is not free, do not call it unnecessarily
This commit is contained in:
parent
f52bad6196
commit
308baf163b
@ -222,6 +222,8 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
hPos = 1.0 - (18.0 / viewHeight);
|
hPos = 1.0 - (18.0 / viewHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFont& refDrawingFont = GLFont::getFont(fontEnumSize);
|
||||||
|
|
||||||
for (double m = -1.0 + mhzStart, mMax = 1.0 + ((mhzStart>0)?mhzStart:-mhzStart); m <= mMax; m += mhzStep) {
|
for (double m = -1.0 + mhzStart, mMax = 1.0 + ((mhzStart>0)?mhzStart:-mhzStart); m <= mMax; m += mhzStep) {
|
||||||
if (m < -1.0) {
|
if (m < -1.0) {
|
||||||
currentMhz += mhzVisualStep;
|
currentMhz += mhzVisualStep;
|
||||||
@ -253,7 +255,7 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
|
|
||||||
glColor4f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b,1.0);
|
glColor4f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b,1.0);
|
||||||
|
|
||||||
GLFont::getFont(fontEnumSize).drawString(label.str(), m, hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
refDrawingFont.drawString(label.str(), m, hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||||
|
|
||||||
label.str(std::string());
|
label.str(std::string());
|
||||||
|
|
||||||
|
@ -253,30 +253,32 @@ void PrimaryGLContext::DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long
|
|||||||
|
|
||||||
double shadowOfsX = 4.0 / viewWidth, shadowOfsY = 2.0 / viewHeight;
|
double shadowOfsX = 4.0 / viewWidth, shadowOfsY = 2.0 / viewHeight;
|
||||||
|
|
||||||
|
GLFont& refDrawingFont = GLFont::getFont(GLFont::GLFONT_SIZE16);
|
||||||
|
|
||||||
if (lastType == "USB") {
|
if (lastType == "USB") {
|
||||||
glColor4f(0,0,0, 1.0);
|
glColor4f(0,0,0, 1.0);
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos+shadowOfsX, hPos+shadowOfsY, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos+shadowOfsX, hPos+shadowOfsY, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos-shadowOfsX, hPos-shadowOfsY, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos-shadowOfsX, hPos-shadowOfsY, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
glColor4f(color.r, color.g, color.b, 1.0);
|
glColor4f(color.r, color.g, color.b, 1.0);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
} else if (lastType == "LSB") {
|
} else if (lastType == "LSB") {
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
glColor4f(0,0,0, 1.0);
|
glColor4f(0,0,0, 1.0);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos+shadowOfsX, hPos+shadowOfsY, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos+shadowOfsX, hPos+shadowOfsY, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos-shadowOfsX, hPos-shadowOfsY, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos-shadowOfsX, hPos-shadowOfsY, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
glColor4f(color.r, color.g, color.b, 1.0);
|
glColor4f(color.r, color.g, color.b, 1.0);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
} else {
|
} else {
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
glColor4f(0,0,0, 1.0);
|
glColor4f(0,0,0, 1.0);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos+shadowOfsX, hPos+shadowOfsY, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos+shadowOfsX, hPos+shadowOfsY, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos-shadowOfsX, hPos-shadowOfsY, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos-shadowOfsX, hPos-shadowOfsY, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
glColor4f(color.r, color.g, color.b, 1.0);
|
glColor4f(color.r, color.g, color.b, 1.0);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
@ -405,13 +407,15 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
|
|||||||
|
|
||||||
void PrimaryGLContext::drawSingleDemodLabel(const std::wstring& demodStr, float uxPos, float hPos, float xOfs, float yOfs, GLFont::Align demodAlign) {
|
void PrimaryGLContext::drawSingleDemodLabel(const std::wstring& demodStr, float uxPos, float hPos, float xOfs, float yOfs, GLFont::Align demodAlign) {
|
||||||
|
|
||||||
|
GLFont& refDrawingFont = GLFont::getFont(GLFont::GLFONT_SIZE16);
|
||||||
|
|
||||||
glColor3f(0, 0, 0);
|
glColor3f(0, 0, 0);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs,
|
refDrawingFont.drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs,
|
||||||
-1.0 + hPos - yOfs, demodAlign,
|
-1.0 + hPos - yOfs, demodAlign,
|
||||||
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||||
|
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5),
|
refDrawingFont.drawString(demodStr, 2.0 * (uxPos - 0.5),
|
||||||
-1.0 + hPos, demodAlign,
|
-1.0 + hPos, demodAlign,
|
||||||
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,11 @@ void ScopeContext::DrawTunerTitles(bool ppmMode) {
|
|||||||
|
|
||||||
glColor3f(0.65f, 0.65f, 0.65f);
|
glColor3f(0.65f, 0.65f, 0.65f);
|
||||||
|
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString(ppmMode?"Device PPM":"Frequency", -0.66f, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
GLFont& refDrawingFont = GLFont::getFont(GLFont::GLFONT_SIZE12);
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString("Bandwidth", 0.0, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString("Center Frequency", 0.66f, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
refDrawingFont.drawString(ppmMode?"Device PPM":"Frequency", -0.66f, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||||
|
refDrawingFont.drawString("Bandwidth", 0.0, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||||
|
refDrawingFont.drawString("Center Frequency", 0.66f, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScopeContext::DrawDeviceName(std::string deviceName) {
|
void ScopeContext::DrawDeviceName(std::string deviceName) {
|
||||||
|
@ -93,9 +93,12 @@ void TuningContext::DrawTuner(long long freq, int count, float displayPos, float
|
|||||||
glColor3f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b);
|
glColor3f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b);
|
||||||
int numChars = freqChars.length();
|
int numChars = freqChars.length();
|
||||||
int ofs = count - numChars;
|
int ofs = count - numChars;
|
||||||
|
|
||||||
|
GLFont& refDrawingFont = GLFont::getFont(fontSize);
|
||||||
|
|
||||||
for (int i = ofs; i < count; i++) {
|
for (int i = ofs; i < count; i++) {
|
||||||
float xpos = displayPos + (displayWidth / (float) count) * (float) i + ((displayWidth / 2.0) / (float) count);
|
float xpos = displayPos + (displayWidth / (float) count) * (float) i + ((displayWidth / 2.0) / (float) count);
|
||||||
GLFont::getFont(fontSize).drawString(freqStr.str().substr(i - ofs, 1), xpos, 0, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
refDrawingFont.drawString(freqStr.str().substr(i - ofs, 1), xpos, 0, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor4f(0.65f, 0.65f, 0.65f, 0.25f);
|
glColor4f(0.65f, 0.65f, 0.65f, 0.25f);
|
||||||
|
Loading…
Reference in New Issue
Block a user