summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToma┼ż Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-06-09 14:58:42 +0900
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-14 14:51:30 +0000
commit4d2fd2b07726af1c2652c3ece7b1f468b5f5d35b (patch)
tree7a5db7beab4d8c8cfeb78ea9278c0136e0afa119
parent4d8924806102681f8d807fd82cdd3db786ddfac0 (diff)
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) Reviewed-on: https://gerrit.libreoffice.org/26100 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> (cherry picked from commit 86fef4ea205f3001305a6122bfa127b196e2d345) Reviewed-on: https://gerrit.libreoffice.org/26267 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--vcl/opengl/gdiimpl.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 39ae80640a14..188db65bfeb0 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;
}