Fix GL error when do texture from pixmap

This problem happens on Freescale imx51 ARM platform

CCMAIL: patches@linaro.org
This commit is contained in:
Jammy Zhou 2011-03-10 17:50:42 +08:00
parent b42ae48280
commit 9a8d5c88ae
2 changed files with 12 additions and 0 deletions

View file

@ -329,6 +329,8 @@ QRegion SceneOpenGL::Texture::optimizeBindDamage(const QRegion& reg, int limit)
bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size,
int depth)
{
if (pix == None)
return false;
return load(pix, size, depth,
QRegion(0, 0, size.width(), size.height()));
}

View file

@ -232,6 +232,10 @@ bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size,
Q_UNUSED(size)
Q_UNUSED(depth)
Q_UNUSED(region)
if (pix == None)
return false;
if (mTexture == None) {
createTexture();
bind();
@ -245,6 +249,12 @@ bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size,
};
EGLImageKHR image = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)pix, attribs);
if (EGL_NO_IMAGE_KHR == image) {
kDebug(1212) << "failed to create egl image";
unbind();
return false;
}
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)image);
eglDestroyImageKHR(dpy, image);
unbind();