Kaydet (Commit) d1cf6ba0 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Andras Timar

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 0165da09)
Reviewed-on: https://gerrit.libreoffice.org/18621Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst d8f8370c
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment