summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-09-16 13:47:47 +0200
committerJan Holesovsky <kendy@collabora.com>2015-09-16 16:29:21 +0000
commit767b3eb47641ed135bee053519c9756f2931e74c (patch)
tree05c04d0212b5ffb27c5f79389f4a2c67f436d7f2
parenta63cf335ab5445e2f7934ace95418b456ed937f0 (diff)
tdf#93666: use x,y coords when reading texture part + don't bind
Fixes shrinking shapes with gradients when the VirtualDev is reused to create a alpha mask (and the texture is reused and reading back from just one part of the texture which uses glReadPixels code-path). Binding texture is not necessary when we use and bind it to the framebuffer. Change-Id: Ie3994f749e1a2c17d4d3df44710b7453d7a4f45f (cherry picked from commit 0165da09288b5f6573bda114af664a26557fad8a) Reviewed-on: https://gerrit.libreoffice.org/18621 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/18631 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--vcl/opengl/texture.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index afb2b47ad72d..24a7c3852707 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -369,30 +369,32 @@ void OpenGLTexture::Read( GLenum nFormat, GLenum nType, sal_uInt8* pData )
return;
}
- Bind();
- glPixelStorei( GL_PACK_ALIGNMENT, 1 );
-
VCL_GL_INFO( "vcl.opengl", "Reading texture " << Id() << " " << GetWidth() << "x" << GetHeight() );
if( GetWidth() == mpImpl->mnWidth && GetHeight() == mpImpl->mnHeight )
{
+ Bind();
+ glPixelStorei( GL_PACK_ALIGNMENT, 1 );
// XXX: Call not available with GLES 2.0
glGetTexImage( GL_TEXTURE_2D, 0, nFormat, nType, pData );
+ Unbind();
}
else
{
+ long nWidth = maRect.GetWidth();
+ long nHeight = maRect.GetHeight();
+ long nX = maRect.Left();
+ long nY = mpImpl->mnHeight - maRect.Top() - nHeight;
+
// Retrieve current context
ImplSVData* pSVData = ImplGetSVData();
rtl::Reference<OpenGLContext> pContext = pSVData->maGDIData.mpLastContext;
- OpenGLFramebuffer* pFramebuffer;
-
- pFramebuffer = pContext->AcquireFramebuffer( *this );
- glReadPixels( maRect.Left(), mpImpl->mnHeight - maRect.Top(), GetWidth(), GetHeight(), nFormat, nType, pData );
- OpenGLContext::ReleaseFramebuffer( pFramebuffer );
- CHECK_GL_ERROR();
+ OpenGLFramebuffer* pFramebuffer = pContext->AcquireFramebuffer(*this);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ glReadPixels(nX, nY, nWidth, nHeight, nFormat, nType, pData);
+ OpenGLContext::ReleaseFramebuffer(pFramebuffer);
}
- Unbind();
CHECK_GL_ERROR();
}