summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-03-22 13:39:17 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-03-25 13:45:55 +0100
commit08f5707251b9c72a53397ef9a5d2260a77e34bf6 (patch)
tree4859afd58795c6dd27b84e6839b6a9ca50742ea6 /vcl
parentf6cc8a7469bf62333ea4cbcee447c2ce2e54f879 (diff)
opengl's drawBitmap() should also scale properly if needed (tdf#123372)
If the bitmap to be drawn will need to be scale for drawing, OpenGL handles this by scaling, but the scaling is of poor quality. Other backends scale in such a case with a good quality, and e.g. opengl's drawAlphaBitmap() also does the same check, so copy that check to drawBitmap() as well. Change-Id: If6a457c69c6676d03fa4046b9910683f51479d21 Reviewed-on: https://gerrit.libreoffice.org/69556 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit c4217f888a2964ca1371bd22297895b4737d2c38) Reviewed-on: https://gerrit.libreoffice.org/69670 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/gdiimpl.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 110071042519..e35c8d224363 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1699,7 +1699,19 @@ void OpenGLSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, const SalBitm
VCL_GL_INFO( "::drawBitmap" );
PreDraw();
- DrawTexture( rTexture, 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);
+ OpenGLTexture mask; // no mask set
+ DrawTransformedTexture(rTexture, mask, aNull, aX, aY);
+ }
+ else
+ {
+ DrawTexture( rTexture, rPosAry );
+ }
PostDraw();
}