[Libreoffice-commits] .: svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 13:40:06 PST 2012


 svtools/source/graphic/grfmgr2.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 3d969a60852d505cfa02a6b3410d4461718138ba
Author: Werner Koerner <wk661lo at gmail.com>
Date:   Thu Dec 13 21:38:02 2012 +0100

    fdo#58196 Viewing: Reenable mirroring for scaled-down images
    
    commit I6feb744712956a92d6140d079dc3a85ee8511930 (Stepwise
    rebuild bitmap rendering from scratch to avoid rendering bugs)
    missed horizontal and vertical flipping for images scaled down
    by more than about 60%.
    
    Change-Id: I68241792d2b43edde33f478c998d447debd8fd13
    Reviewed-on: https://gerrit.libreoffice.org/1332
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index b992144..4aeccf9 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -436,7 +436,7 @@ sal_Bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAt
                     }
                 }
             }
-            else
+            else // scaleByAveraging
             {
                 double aSumRed, aSumGreen, aSumBlue, aCount;
                 BitmapColor aColor;
@@ -452,6 +452,11 @@ sal_Bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAt
                         double aUnrotatedX = ( pCosX[ x ] - nSinY ) / 256.0;
                         double aUnrotatedY = ( pSinX[ x ] + nCosY ) / 256.0;
 
+                        if ( bHMirr )
+                            aUnrotatedX = aUnrotatedWidth - aUnrotatedX - 1;
+                        if ( bVMirr )
+                            aUnrotatedY = aUnrotatedHeight - aUnrotatedY - 1;
+
                         if( ( aUnrotatedX >= 0 ) && ( aUnrotatedX < aUnrotatedWidth ) &&
                             ( aUnrotatedY >= 0 ) && ( aUnrotatedY < aUnrotatedHeight ) )
                         {
@@ -563,7 +568,7 @@ sal_Bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAt
                                 }
                             }
                         }
-                        else
+                        else // scaleByAveraging
                         {
                             const BitmapColor   aTrans( pWriteAccess->GetBestMatchingColor( Color( COL_WHITE ) ) );
                             BitmapColor         aResultColor( 0 );
@@ -580,6 +585,11 @@ sal_Bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAt
                                     double aUnrotatedX = ( pCosX[ x ] - nSinY ) / 256.0;
                                     double aUnrotatedY = ( pSinX[ x ] + nCosY ) / 256.0;
 
+                                    if ( bHMirr )
+                                        aUnrotatedX = aUnrotatedWidth - aUnrotatedX - 1;
+                                    if ( bVMirr )
+                                        aUnrotatedY = aUnrotatedHeight - aUnrotatedY - 1;
+
                                     if( ( aUnrotatedX >= 0 ) && ( aUnrotatedX < aUnrotatedWidth ) &&
                                         ( aUnrotatedY >= 0 ) && ( aUnrotatedY < aUnrotatedHeight ) )
                                     {


More information about the Libreoffice-commits mailing list