Support setting y_inverted for Texture.

At least needed for the pixmaps loaded by EGL.
Should be save on GLX as well, if not it needs fixing
This commit is contained in:
Martin Gräßlin 2010-12-04 12:23:47 +01:00 committed by Martin Gräßlin
parent aef6208fdc
commit ea12f95b27
2 changed files with 16 additions and 8 deletions

View file

@ -1016,7 +1016,7 @@ void SceneOpenGL::Window::restoreRenderStates( TextureType type, double opacity,
// SceneOpenGL::EffectFrame // SceneOpenGL::EffectFrame
//**************************************** //****************************************
GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL; SceneOpenGL::Texture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL;
QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL; QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL;
SceneOpenGL::EffectFrame::EffectFrame( EffectFrameImpl* frame ) SceneOpenGL::EffectFrame::EffectFrame( EffectFrameImpl* frame )
@ -1299,6 +1299,7 @@ void SceneOpenGL::EffectFrame::render( QRegion region, double opacity, double fr
{ {
QPixmap pixmap = m_effectFrame->selectionFrame().framePixmap(); QPixmap pixmap = m_effectFrame->selectionFrame().framePixmap();
m_selectionTexture = new Texture( pixmap.handle(), pixmap.size(), pixmap.depth() ); m_selectionTexture = new Texture( pixmap.handle(), pixmap.size(), pixmap.depth() );
m_selectionTexture->setYInverted(true);
} }
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
m_selectionTexture->bind(); m_selectionTexture->bind();
@ -1348,6 +1349,7 @@ void SceneOpenGL::EffectFrame::render( QRegion region, double opacity, double fr
m_iconTexture = new Texture( m_effectFrame->icon().handle(), m_iconTexture = new Texture( m_effectFrame->icon().handle(),
m_effectFrame->icon().size(), m_effectFrame->icon().size(),
m_effectFrame->icon().depth() ); m_effectFrame->icon().depth() );
m_iconTexture->setYInverted(true);
} }
m_iconTexture->bind(); m_iconTexture->bind();
m_iconTexture->render( region, QRect( topLeft, m_effectFrame->iconSize() ), sceneShader ); m_iconTexture->render( region, QRect( topLeft, m_effectFrame->iconSize() ), sceneShader );
@ -1408,6 +1410,7 @@ void SceneOpenGL::EffectFrame::updateTexture()
{ {
QPixmap pixmap = m_effectFrame->frame().framePixmap(); QPixmap pixmap = m_effectFrame->frame().framePixmap();
m_texture = new Texture( pixmap.handle(), pixmap.size(), pixmap.depth() ); m_texture = new Texture( pixmap.handle(), pixmap.size(), pixmap.depth() );
m_texture->setYInverted(true);
} }
} }
@ -1443,6 +1446,7 @@ void SceneOpenGL::EffectFrame::updateTextTexture()
p.drawText( rect, m_effectFrame->alignment(), text ); p.drawText( rect, m_effectFrame->alignment(), text );
p.end(); p.end();
m_textTexture = new Texture( m_textPixmap->handle(), m_textPixmap->size(), m_textPixmap->depth() ); m_textTexture = new Texture( m_textPixmap->handle(), m_textPixmap->size(), m_textPixmap->depth() );
m_textTexture->setYInverted(true);
} }
void SceneOpenGL::EffectFrame::updateUnstyledTexture() void SceneOpenGL::EffectFrame::updateUnstyledTexture()
@ -1461,6 +1465,7 @@ void SceneOpenGL::EffectFrame::updateUnstyledTexture()
p.end(); p.end();
#undef CS #undef CS
m_unstyledTexture = new Texture( m_unstyledPixmap->handle(), m_unstyledPixmap->size(), m_unstyledPixmap->depth() ); m_unstyledTexture = new Texture( m_unstyledPixmap->handle(), m_unstyledPixmap->size(), m_unstyledPixmap->depth() );
m_unstyledTexture->setYInverted(true);
} }
void SceneOpenGL::EffectFrame::cleanup() void SceneOpenGL::EffectFrame::cleanup()

View file

@ -125,6 +125,9 @@ class SceneOpenGL::Texture
virtual void release(); // undo the tfp_mode binding virtual void release(); // undo the tfp_mode binding
virtual void bind(); virtual void bind();
virtual void unbind(); virtual void unbind();
void setYInverted(bool inverted) {
y_inverted = inverted;
}
protected: protected:
void findTarget(); void findTarget();
@ -203,16 +206,16 @@ class SceneOpenGL::EffectFrame
void updateTexture(); void updateTexture();
void updateTextTexture(); void updateTextTexture();
GLTexture* m_texture; Texture* m_texture;
GLTexture* m_textTexture; Texture* m_textTexture;
GLTexture* m_oldTextTexture; Texture* m_oldTextTexture;
QPixmap* m_textPixmap; // need to keep the pixmap around to workaround some driver problems QPixmap* m_textPixmap; // need to keep the pixmap around to workaround some driver problems
GLTexture* m_iconTexture; Texture* m_iconTexture;
GLTexture* m_oldIconTexture; Texture* m_oldIconTexture;
GLTexture* m_selectionTexture; Texture* m_selectionTexture;
GLVertexBuffer* m_unstyledVBO; GLVertexBuffer* m_unstyledVBO;
static GLTexture* m_unstyledTexture; static Texture* m_unstyledTexture;
static QPixmap* m_unstyledPixmap; // need to keep the pixmap around to workaround some driver problems static QPixmap* m_unstyledPixmap; // need to keep the pixmap around to workaround some driver problems
static void updateUnstyledTexture(); // Update OpenGL unstyled frame texture static void updateUnstyledTexture(); // Update OpenGL unstyled frame texture
}; };