[Libreoffice-commits] core.git: Branch 'feature/fixes23' - vcl/opengl

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Jun 10 06:46:15 UTC 2016


 vcl/opengl/gdiimpl.cxx |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 317ced1e1786b27d275d7d8dda48b71bab5a5c6f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Jun 9 14:58:42 2016 +0900

    tdf#99795 drawAlphaBitmap should scale the bitmap if necessary
    
    drawAlphaBitmap didn't use a high quality scaler for scaling
    the texture but used the default scaling method in OpenGL (either
    GL_NEAREST or GL_LINEAR, whichever is defined when texture
    is created) which are low quality scalers - especially when
    downscaling textures.
    
    Change-Id: I6236b2ee92b9e5044b176a40a444027072b09b58
    (cherry picked from commit 19baa61e1d7b140b9e24717f7080617ab3d324d4)

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 39ae806..188db65 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -2144,12 +2144,25 @@ bool OpenGLSalGraphicsImpl::drawAlphaBitmap(
 
     const OpenGLSalBitmap& rBitmap = static_cast<const OpenGLSalBitmap&>(rSalBitmap);
     const OpenGLSalBitmap& rAlpha = static_cast<const OpenGLSalBitmap&>(rAlphaBitmap);
-    OpenGLTexture& rTexture( rBitmap.GetTexture() );
-    OpenGLTexture& rAlphaTex( rAlpha.GetTexture() );
+    OpenGLTexture& rTexture(rBitmap.GetTexture());
+    OpenGLTexture& rAlphaTexture(rAlpha.GetTexture());
 
     VCL_GL_INFO( "::drawAlphaBitmap" );
     PreDraw();
-    DrawTextureWithMask( rTexture, rAlphaTex, rPosAry );
+
+    if (rPosAry.mnSrcWidth  != rPosAry.mnDestWidth ||
+        rPosAry.mnSrcHeight != rPosAry.mnDestHeight)
+    {
+        basegfx::B2DPoint aNull(rPosAry.mnDestX,rPosAry.mnDestY);
+        basegfx::B2DPoint aX(rPosAry.mnDestX + rPosAry.mnDestWidth, rPosAry.mnDestY);
+        basegfx::B2DPoint aY(rPosAry.mnDestX, rPosAry.mnDestY + rPosAry.mnDestHeight);
+        DrawTransformedTexture(rTexture, rAlphaTexture, aNull, aX, aY);
+    }
+    else
+    {
+        DrawTextureWithMask( rTexture, rAlphaTexture, rPosAry );
+    }
+
     PostDraw();
     return true;
 }


More information about the Libreoffice-commits mailing list