From dc068d34271d070267e61f4761aebf8ccaabf299 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sun, 17 Jun 2012 15:41:46 +0200 Subject: Filter dialog preview image size was wrongly calculated in some cases. Change-Id: I22fdf17e6f2112624963da6293efddfa75507dd7 --- cui/source/dialogs/cuigrfflt.cxx | 27 +++++++++++++++++---------- cui/source/inc/cuigrfflt.hxx | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index f074e1779f66..0b846cbdea32 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -59,15 +59,22 @@ void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect ) { Control::Paint( rRect ); - const Size aGrfSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) ); - const Size aOutSize( GetOutputSizePixel() ); - const Point aGrfPos( ( aOutSize.Width() - aGrfSize.Width() ) >> 1, - ( aOutSize.Height() - aGrfSize.Height() ) >> 1 ); + const Size aOutputSize( GetOutputSizePixel() ); if( maGraphic.IsAnimated() ) - maGraphic.StartAnimation( this , aGrfPos, aGrfSize ); + { + const Size aGraphicSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) ); + const Point aGraphicPosition( ( aOutputSize.Width() - aGraphicSize.Width() ) >> 1, + ( aOutputSize.Height() - aGraphicSize.Height() ) >> 1 ); + maGraphic.StartAnimation( this, aGraphicPosition, aGraphicSize ); + } else - maGraphic.Draw( this, aGrfPos, aGrfSize ); + { + const Size aGraphicSize( maGraphic.GetSizePixel() ); + const Point aGraphicPosition( ( aOutputSize.Width() - aGraphicSize.Width() ) >> 1, + ( aOutputSize.Height() - aGraphicSize.Height() ) >> 1 ); + maGraphic.Draw( this, aGraphicPosition, aGraphicSize ); + } } // ----------------------------------------------------------------------------- @@ -110,13 +117,13 @@ GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, if( fGrfWH < fPreWH ) { - aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH ); - aGrfSize.Height()= aPreviewSize.Height(); + aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH ); + aGrfSize.Height() = aPreviewSize.Height(); } else { - aGrfSize.Width() = aPreviewSize.Width(); - aGrfSize.Height()= (long) ( aPreviewSize.Width() / fGrfWH); + aGrfSize.Width() = aPreviewSize.Width(); + aGrfSize.Height() = (long) ( aPreviewSize.Width() / fGrfWH ); } mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width(); diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx index 98303e058baf..f9cb62419647 100644 --- a/cui/source/inc/cuigrfflt.hxx +++ b/cui/source/inc/cuigrfflt.hxx @@ -53,7 +53,7 @@ private: { private: - GraphicObject maGraphic; + Graphic maGraphic; virtual void Paint( const Rectangle& rRect ); -- cgit