summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorWerner Koerner <wk661lo@gmail.com>2012-12-13 21:38:02 +0100
committerMichael Stahl <mstahl@redhat.com>2012-12-17 21:39:47 +0000
commit3d969a60852d505cfa02a6b3410d4461718138ba (patch)
tree2ab9cdc7916a98d74090d1933c045eed3e0c1d2e /svtools
parent6560cae1b5f81cb753a7216cb22d4e7f9d175cd1 (diff)
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@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/graphic/grfmgr2.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index b99214417eb6..4aeccf991b66 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 ) )
{