As creation of a font is time consuming, create one application font instance

p4#: 21338
This commit is contained in:
Magne Sjaastad
2013-04-19 08:02:36 +02:00
parent fc84fce67f
commit b5b9a736e2
8 changed files with 42 additions and 27 deletions

View File

@@ -24,6 +24,7 @@
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cvfScalarMapperDiscreteLog.h"
#include "RiaApplication.h"
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
@@ -92,9 +93,8 @@ RimLegendConfig::RimLegendConfig()
m_currentScalarMapper = m_linDiscreteScalarMapper;
cvf::FixedAtlasFont* font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
m_legend = new cvf::OverlayScalarMapperLegend(font);
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_legend = new cvf::OverlayScalarMapperLegend(standardFont);
m_position = cvf::Vec2ui(20, 50);
updateFieldVisibility();
@@ -394,8 +394,8 @@ void RimLegendConfig::recreateLegend()
// has been removed, (and thus the opengl resources has been deleted) The text in
// the legend disappeared because of this, so workaround: recreate the legend when needed:
cvf::FixedAtlasFont* font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
m_legend = new cvf::OverlayScalarMapperLegend(font);
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_legend = new cvf::OverlayScalarMapperLegend(standardFont);
updateLegend();
}