[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 2 commits - vcl/inc vcl/opengl
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Fri Aug 7 02:34:49 PDT 2015
vcl/inc/opengl/salbmp.hxx | 2 +
vcl/opengl/scale.cxx | 52 ++++++++++++++++++++++++++++++++++++++++-----
vcl/opengl/x11/gdiimpl.cxx | 7 ++++++
3 files changed, 56 insertions(+), 5 deletions(-)
New commits:
commit 22421a4083529e852fc6d290c2cc8c7611e9150b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jul 31 16:31:29 2015 +0900
opengl: when scaling, create a new texture with equal settings
Change-Id: Id0258fe0db89aa06b91233ae2052f018d606cc74
(cherry picked from commit 6d9ddfb9c7a946e9b9cc58ae2cebcf3a21a5bf22)
Reviewed-on: https://gerrit.libreoffice.org/17558
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index 3df78c8..15ff571 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -106,6 +106,8 @@ private:
bool ImplScaleConvolution( const double& rScaleX, const double& rScaleY, const Kernel& aKernel );
bool ImplScaleArea( double rScaleX, double rScaleY );
+ bool getFormatAndType(GLenum& nFormat, GLenum& nType);
+
public:
bool ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag );
diff --git a/vcl/opengl/scale.cxx b/vcl/opengl/scale.cxx
index a479a11..fcb4273 100644
--- a/vcl/opengl/scale.cxx
+++ b/vcl/opengl/scale.cxx
@@ -43,6 +43,31 @@ public:
void GetSize( Size& rSize ) const SAL_OVERRIDE;
};
+bool OpenGLSalBitmap::getFormatAndType(GLenum& nFormat, GLenum& nType)
+{
+ switch(mnBits)
+ {
+ case 8:
+ nFormat = GL_LUMINANCE;
+ nType = GL_UNSIGNED_BYTE;
+ break;
+ case 16:
+ nFormat = GL_RGB;
+ nType = GL_UNSIGNED_SHORT_5_6_5;
+ break;
+ case 24:
+ nFormat = GL_RGB;
+ nType = GL_UNSIGNED_BYTE;
+ break;
+ case 32:
+ default:
+ nFormat = GL_RGBA;
+ nType = GL_UNSIGNED_BYTE;
+ break;
+ }
+ return true;
+}
+
bool OpenGLSalBitmap::ImplScaleFilter(
const double& rScaleX,
const double& rScaleY,
@@ -59,7 +84,11 @@ bool OpenGLSalBitmap::ImplScaleFilter(
if( !pProgram )
return false;
- OpenGLTexture aNewTex = OpenGLTexture( nNewWidth, nNewHeight );
+ GLenum nFormat;
+ GLenum nType;
+ getFormatAndType(nFormat, nType);
+
+ OpenGLTexture aNewTex = OpenGLTexture(nNewWidth, nNewHeight, nFormat, nType, nullptr);
pFramebuffer = mpContext->AcquireFramebuffer( aNewTex );
pProgram->SetTexture( "sampler", maTexture );
@@ -138,10 +167,15 @@ bool OpenGLSalBitmap::ImplScaleConvolution(
if( pProgram == 0 )
return false;
+ GLenum nFormat;
+ GLenum nType;
+ getFormatAndType(nFormat, nType);
+
// horizontal scaling in scratch texture
if( mnWidth != nNewWidth )
{
- OpenGLTexture aScratchTex = OpenGLTexture( nNewWidth, mnHeight );
+ OpenGLTexture aScratchTex = OpenGLTexture(nNewWidth, mnHeight, nFormat, nType, nullptr);
+
pFramebuffer = mpContext->AcquireFramebuffer( aScratchTex );
for( sal_uInt32 i = 0; i < 16; i++ )
@@ -163,7 +197,8 @@ bool OpenGLSalBitmap::ImplScaleConvolution(
// vertical scaling in final texture
if( mnHeight != nNewHeight )
{
- OpenGLTexture aScratchTex = OpenGLTexture( nNewWidth, nNewHeight );
+ OpenGLTexture aScratchTex = OpenGLTexture(nNewWidth, nNewHeight, nFormat, nType, nullptr);
+
pFramebuffer = mpContext->AcquireFramebuffer( aScratchTex );
for( sal_uInt32 i = 0; i < 16; i++ )
@@ -223,7 +258,12 @@ bool OpenGLSalBitmap::ImplScaleArea( double rScaleX, double rScaleY )
if( pProgram == 0 )
return false;
- OpenGLTexture aScratchTex = OpenGLTexture( nNewWidth, nNewHeight );
+ GLenum nFormat;
+ GLenum nType;
+ getFormatAndType(nFormat, nType);
+
+ OpenGLTexture aScratchTex = OpenGLTexture(nNewWidth, nNewHeight, nFormat, nType, nullptr);
+
OpenGLFramebuffer* pFramebuffer = mpContext->AcquireFramebuffer( aScratchTex );
// NOTE: This setup is also done in OpenGLSalGraphicsImpl::DrawTransformedTexture().
@@ -325,7 +365,9 @@ void ScaleOp::GetSize( Size& rSize ) const
bool OpenGLSalBitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag )
{
- SAL_INFO( "vcl.opengl", "::Scale " << static_cast<int>(nScaleFlag) );
+ SAL_INFO("vcl.opengl", "::Scale " << int(nScaleFlag)
+ << " from " << mnWidth << "x" << mnHeight
+ << " to " << (mnWidth * rScaleX) << "x" << (mnHeight * rScaleY) );
if( nScaleFlag == BmpScaleFlag::Fast ||
nScaleFlag == BmpScaleFlag::BiLinear ||
commit c02d01ba71f5290beac991d5ddafe1309b428ebf
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jul 24 16:08:01 2015 +0900
opengl: don't cache checkboxes for now
Change-Id: I67d0dcb48d1843587abbc1dc0f7da1f8057b281e
(cherry picked from commit 1c28c59f927361ef85c8aea8b575d274c532a34d)
Reviewed-on: https://gerrit.libreoffice.org/17557
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 2114419..bf5e6f6 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -238,8 +238,15 @@ bool X11OpenGLSalGraphicsImpl::RenderAndCacheNativeControl(X11Pixmap* pPixmap, X
{
std::unique_ptr<TextureCombo> pCombo(new TextureCombo);
bool bResult = RenderPixmap(pPixmap, pMask, nX, nY, *pCombo);
+ if (!bResult)
+ return false;
+
+ if (aControlCacheKey.mnType == CTRL_CHECKBOX)
+ return true;
+
ControlCachePair pair(aControlCacheKey, std::move(pCombo));
gTextureCache.insert(std::move(pair));
+
return bResult;
}
More information about the Libreoffice-commits
mailing list