[Libreoffice-commits] .: cui/source

Tomaž Vajngerl tvajngerl at kemper.freedesktop.org
Sun Jun 17 06:49:10 PDT 2012


 cui/source/dialogs/cuigrfflt.cxx |   27 +++++++++++++++++----------
 cui/source/inc/cuigrfflt.hxx     |    2 +-
 2 files changed, 18 insertions(+), 11 deletions(-)

New commits:
commit dc068d34271d070267e61f4761aebf8ccaabf299
Author: Tomaž Vajngerl <quikee at gmail.com>
Date:   Sun Jun 17 15:41:46 2012 +0200

    Filter dialog preview image size was wrongly calculated in some cases.
    
    Change-Id: I22fdf17e6f2112624963da6293efddfa75507dd7

diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index f074e17..0b846cb 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 98303e0..f9cb624 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 );
 


More information about the Libreoffice-commits mailing list