cache rendering of UILabel

This commit is contained in:
Eduardo Bart
2012-01-17 03:36:25 -02:00
parent e701cce5fd
commit 7bcf7f536e
15 changed files with 124 additions and 87 deletions

View File

@@ -42,6 +42,9 @@ FrameBuffer::~FrameBuffer()
void FrameBuffer::resize(const Size& size)
{
if(m_texture && m_texture->getSize() == size)
return;
internalBind();
m_texture = TexturePtr(new Texture(size.width(), size.height(), 4));
m_texture->setSmooth(true);

View File

@@ -131,8 +131,8 @@ void Painter::setCompositionMode(Painter::CompositionMode compositionMode)
case CompositionMode_Multiply:
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
break;
case CompositionMode_Addition:
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
case CompositionMode_Add:
glBlendFunc(GL_ONE, GL_ONE);
break;
}
}

View File

@@ -34,7 +34,7 @@ public:
enum CompositionMode {
CompositionMode_Normal,
CompositionMode_Multiply,
CompositionMode_Addition
CompositionMode_Add
};
void init();
@@ -57,6 +57,7 @@ public:
void setCustomProgram(PainterShaderProgramPtr program);
void releaseCustomProgram() { m_customProgram = nullptr; }
void setCompositionMode(CompositionMode compositionMode);
void resetCompositionMode() { setCompositionMode(CompositionMode_Normal); }
void setProjectionMatrix(const Matrix3& projectionMatrix) { m_projectionMatrix = projectionMatrix; }
Matrix3 getProjectionMatrix() { return m_projectionMatrix; }

View File

@@ -163,7 +163,7 @@ bool ParticleEmitter::load(const OTMLNodePtr& node)
else if(childNode->value() == "multiply")
m_pCompositionMode = Painter::CompositionMode_Multiply;
else if(childNode->value() == "addition")
m_pCompositionMode = Painter::CompositionMode_Addition;
m_pCompositionMode = Painter::CompositionMode_Add;
}
}