Bug 916116 - Avoid some code duplication in Gralloc textures. r=sotaro

This commit is contained in:
Nicolas Silva
2013-09-17 15:29:19 +02:00
parent 23eb76c256
commit 68aab4cd57
4 changed files with 25 additions and 12 deletions

View File

@@ -117,8 +117,7 @@ void GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit)
MOZ_ASSERT(gl());
gl()->MakeCurrent();
mQuirks->SetCompositor(mCompositor);
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(aTextureUnit);
@@ -179,8 +178,7 @@ GrallocTextureSourceOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
DeallocateDeviceData();
gl()->MakeCurrent();
mQuirks->SetCompositor(mCompositor);
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
@@ -310,8 +308,7 @@ GrallocTextureSourceOGL::GetAsSurface() {
MOZ_ASSERT(gl());
gl()->MakeCurrent();
mQuirks->SetCompositor(mCompositor);
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
GLuint tex = GetGLTexture();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(GetTextureTarget(), tex);
if (!mEGLImage) {
@@ -326,6 +323,13 @@ GrallocTextureSourceOGL::GetAsSurface() {
return surf.forget();
}
GLuint
GrallocTextureSourceOGL::GetGLTexture()
{
mQuirks->SetCompositor(mCompositor);
return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
}
void
GrallocTextureHostOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
{