some optimizations and compilation changes

* speedup render of widget images on low end devices using mipmaps
* changes in CMakeLists.txt to allow usage of distcc and crosscompiling
This commit is contained in:
Eduardo Bart
2012-02-20 11:10:54 -02:00
parent ba24e7ce39
commit 27b83fa722
4 changed files with 17 additions and 11 deletions

View File

@@ -98,8 +98,8 @@ void Texture::generateMipmaps()
{
bind();
if(!m_useMipmaps) {
m_useMipmaps = true;
if(!m_hasMipmaps) {
m_hasMipmaps = true;
setupFilters();
}
@@ -141,8 +141,8 @@ void Texture::generateBilinearMipmaps(std::vector<uint8> inPixels)
{
bind();
if(!m_useMipmaps) {
m_useMipmaps = true;
if(!m_hasMipmaps) {
m_hasMipmaps = true;
setupFilters();
}
@@ -204,10 +204,10 @@ void Texture::setupFilters()
GLint minFilter;
GLint magFilter;
if(m_smooth) {
minFilter = m_useMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
minFilter = m_hasMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
magFilter = GL_LINEAR;
} else {
minFilter = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
minFilter = m_hasMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
magFilter = GL_NEAREST;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);

View File

@@ -48,7 +48,8 @@ public:
int getHeight() { return m_size.height(); }
const Size& getSize() { return m_size; }
bool isEmpty() const { return m_textureId == 0; }
bool isEmpty() { return m_textureId == 0; }
bool hasMipmaps() { return m_hasMipmaps; }
protected:
void setupFilters();
@@ -56,7 +57,7 @@ protected:
GLuint m_textureId;
Size m_size;
Boolean<false> m_useMipmaps;
Boolean<false> m_hasMipmaps;
Boolean<false> m_smooth;
};