summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2016-02-11 15:57:27 +0100
committerMichael Meeks <michael.meeks@collabora.com>2016-02-11 17:09:40 +0000
commit6fb42845b82cc3b065dd788278c08cdacda1e5cc (patch)
tree47785719f4aa1cb29021b5b94f296e6992f91da4 /vcl
parent2f57811486e9e57a1634fbdeca0349b896fabab0 (diff)
tdf#97715 fix inv. scale calculation in DrawTransformedTexture
When image was rotated towards 90 degree the ixscale and iyscale went towards infinity. That caused problems in fragment shader areaScaleFastFragmentShader. The problem was with calculation of destination width and height which didn't take rotation into account correctly. This commit takes this calculation from WinSalGraphicsImpl::drawTransformedBitmap. Change-Id: I30f14a1ecda21ef167e58eda8e2fcef00bdfa2b7 Reviewed-on: https://gerrit.libreoffice.org/22289 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.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 7bb2ae21cdf2..8038d76bf581 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1069,8 +1069,13 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture(
// If downscaling at a higher scale ratio, use the area scaling algorithm rather
// than plain OpenGL's scaling, for better results.
// See OpenGLSalBitmap::ImplScaleArea().
- double ixscale = rTexture.GetWidth() / fabs( rX.getX() - rNull.getX());
- double iyscale = rTexture.GetHeight() / fabs( rY.getY() - rNull.getY());
+
+ const long nDestWidth = basegfx::fround(basegfx::B2DVector(rX - rNull).getLength());
+ const long nDestHeight = basegfx::fround(basegfx::B2DVector(rY - rNull).getLength());
+
+ const double ixscale = rTexture.GetWidth() / nDestWidth;
+ const double iyscale = rTexture.GetHeight() / nDestHeight;
+
bool areaScaling = false;
bool fastAreaScaling = false;
OUString textureFragmentShader;