vcl/source/bitmap/bitmappaint.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f1385af519ba9e5a6d78f89dcff83f1fd98feb60
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Sat Feb 5 19:01:08 2022 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Feb 21 07:19:42 2022 +0100

    Fix Bitmap::Rotate
    
    Bug introduced in:
        commit 74c46b12340f1afb1752f5df0bab91caca3ef63f
        speed up bitmap rotation
    
    it was showing some artifacts in LOK when using previews in rotation
    -> sin and cos values were used incorrectly
    
    Change-Id: Id85c54d0aa4488f19e7b5db2e242fdb446626699
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129528
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130233
    Tested-by: Jenkins

diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index 954820c761cc..22a2bfdbd92f 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -378,7 +378,7 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& 
rFillColor)
 
                     for (sal_Int32 nIdx = 0, nX = 0; nX < nNewWidth; nX++)
                     {
-                        const float fTmp = (fXMin + nX) * 64;
+                        const double fTmp = (fXMin + nX) * 64;
 
                         pCosSinX[nIdx++] = std::round(fCosAngle * fTmp);
                         pCosSinX[nIdx++] = std::round(fSinAngle * fTmp);
@@ -386,7 +386,7 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& 
rFillColor)
 
                     for (sal_Int32 nIdx = 0, nY = 0; nY < nNewHeight; nY++)
                     {
-                        const float fTmp = (fYMin + nY) * 64;
+                        const double fTmp = (fYMin + nY) * 64;
 
                         pCosSinY[nIdx++] = std::round(fCosAngle * fTmp);
                         pCosSinY[nIdx++] = std::round(fSinAngle * fTmp);
@@ -394,8 +394,8 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& 
rFillColor)
 
                     for (sal_Int32 nCosSinYIdx = 0, nY = 0; nY < nNewHeight; 
nY++)
                     {
-                        sal_Int32 nSinY = pCosSinY[nCosSinYIdx++];
                         sal_Int32 nCosY = pCosSinY[nCosSinYIdx++];
+                        sal_Int32 nSinY = pCosSinY[nCosSinYIdx++];
                         Scanline pScanline = pWriteAcc->GetScanline(nY);
 
                         for (sal_Int32 nCosSinXIdx = 0, nX = 0; nX < 
nNewWidth; nX++)

Reply via email to