summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-09-16 13:47:47 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-09-16 14:16:36 +0200
commit0165da09288b5f6573bda114af664a26557fad8a (patch)
tree66078063434851f3a1f4dcdc20719746d9ec69d1
parent4823b6d4e989943c31e20027564ab4eca43f6f8d (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
-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 9b3c60592ea5..c0373cc46a5a 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -361,30 +361,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();
}