vcl/opengl/texture.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
New commits: commit 4833f5a9c88726a03666ee58c156746ba489b8a2 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Sep 16 13:47:47 2015 +0200 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.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index afb2b47..24a7c38 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(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits