Function-scope statics aren't as efficient as file-scope ones

This commit is contained in:
Jack Andersen 2016-04-14 17:25:50 -10:00
parent 3886f4409c
commit 7803681352
5 changed files with 24 additions and 21 deletions

View File

@ -16,6 +16,8 @@ static logvisor::Module Log("specter::Space");
#define CORNER_DRAG_THRESHOLD 20
static const zeus::CColor TriColor = {0.75, 0.75, 0.75, 1.0};
Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
Toolbar::Position tbPos, unsigned tbUnits)
: View(res, parentView), m_controller(controller), m_tbPos(tbPos)
@ -26,9 +28,8 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
return true;
});
setBackground(res.themeData().spaceBackground());
static const zeus::CColor triColor = {0.75, 0.75, 0.75, 1.0};
if (controller.spaceSplitAllowed())
m_cornerView.m_view.reset(new CornerView(res, *this, triColor));
m_cornerView.m_view.reset(new CornerView(res, *this, TriColor));
if (tbPos != Toolbar::Position::None)
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
}

View File

@ -8,15 +8,16 @@ namespace specter
{
static logvisor::Module Log("specter::SplitView");
static const zeus::RGBA32 Tex[3] =
{
{0,0,0,64},
{0,0,0,255},
{255,255,255,64}
};
void SplitView::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
{
static const zeus::RGBA32 tex[3] =
{
{0,0,0,64},
{0,0,0,255},
{255,255,255,64}
};
m_shadingTex = ctx.newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, tex, 12);
m_shadingTex = ctx.newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, Tex, 12);
}
SplitView::SplitView(ViewResources& res, View& parentView, ISplitSpaceController* controller,

View File

@ -65,12 +65,12 @@ BOO_GLSL_BINDING_HEAD
" blendOut = colorOut.a * texture(fontTex, vtf.uv);\n"
"}\n";
static const char* BlockNames[] = {"SpecterViewBlock"};
void TextView::Resources::init(boo::GLDataFactory::Context& ctx, FontCache* fcache)
{
m_fcache = fcache;
static const char* BlockNames[] = {"SpecterViewBlock"};
m_regular =
ctx.newShaderPipeline(GLSLVS, GLSLFSReg, 1, "fontTex", 1, BlockNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,

View File

@ -9,16 +9,17 @@ namespace specter
{
static logvisor::Module Log("specter::Space");
static const zeus::RGBA32 Tex[] =
{
{{255,255,255,64}},
{{255,255,255,64}},
{{0,0,0,64}},
{{0,0,0,64}}
};
void Toolbar::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
{
static const zeus::RGBA32 tex[] =
{
{{255,255,255,64}},
{{255,255,255,64}},
{{0,0,0,64}},
{{0,0,0,64}}
};
m_shadingTex = ctx.newStaticTexture(4, 1, 1, boo::TextureFormat::RGBA8, tex, 16);
m_shadingTex = ctx.newStaticTexture(4, 1, 1, boo::TextureFormat::RGBA8, Tex, 16);
}
Toolbar::Toolbar(ViewResources& res, View& parentView, Position tbPos, unsigned units)

View File

@ -71,10 +71,10 @@ BOO_GLSL_BINDING_HEAD
" colorOut = texture(tex, vtf.uv) * vtf.color;\n"
"}\n";
static const char* BlockNames[] = {"SpecterViewBlock"};
void View::Resources::init(boo::GLDataFactory::Context& ctx, const IThemeData& theme)
{
static const char* BlockNames[] = {"SpecterViewBlock"};
m_solidShader = ctx.newShaderPipeline(GLSLSolidVS, GLSLSolidFS, 0, nullptr, 1, BlockNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false);