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

@@ -1123,8 +1123,7 @@ GrallocDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImag
mIsRBSwapped);
mTextureTarget = TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
mQuirks->SetCompositor(mCompositor);
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
GLuint tex = GetGLTexture();
// delete old EGLImage
DeleteTextures();
@@ -1162,8 +1161,7 @@ void GrallocDeprecatedTextureHostOGL::BindTexture(GLenum aTextureUnit)
MOZ_ASSERT(gl());
gl()->MakeCurrent();
mQuirks->SetCompositor(mCompositor);
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
GLuint tex = GetGLTexture();
gl()->fActiveTexture(aTextureUnit);
gl()->fBindTexture(mTextureTarget, tex);
@@ -1242,6 +1240,14 @@ GrallocDeprecatedTextureHostOGL::GetRenderState()
return LayerRenderState();
}
GLuint
GrallocDeprecatedTextureHostOGL::GetGLTexture()
{
mQuirks->SetCompositor(mCompositor);
return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
}
#endif // MOZ_WIDGET_GONK
already_AddRefed<gfxImageSurface>
@@ -1299,8 +1305,7 @@ already_AddRefed<gfxImageSurface>
GrallocDeprecatedTextureHostOGL::GetAsSurface() {
gl()->MakeCurrent();
mQuirks->SetCompositor(mCompositor);
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
GLuint tex = GetGLTexture();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(mTextureTarget, tex);
if (!mEGLImage) {