cui/source/dialogs/about.cxx |   21 +++++++++++++--------
 cui/source/dialogs/about.src |    3 ---
 vcl/source/app/brand.cxx     |    3 ++-
 3 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 1d5c3861ba788042eecef7610f58956cdf56cb83
Author: Jan Holesovsky <ke...@suse.cz>
Date:   Fri Jul 13 15:36:28 2012 +0200

    Fix the About dialog rendering when librsvg is not available / functional.
    
    Change-Id: Ib460f3cbf44114ef74065168b218daca51f2f0e9
    (cherry picked from commit debfb21c927e39ab18aafb1895f343840967e16a)
    
    Signed-off-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 21e4592..eff0e6b 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -73,7 +73,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
     aDescriptionText     ( this,     ResId( ABOUT_DESCRIPTION_TEXT, 
*rId.GetResMgr() ) ),
     aCopyrightText       ( this,     ResId( ABOUT_COPYRIGHT_TEXT, 
*rId.GetResMgr() ) ),
     aCopyrightTextShadow ( this,     ResId( ABOUT_COPYRIGHT_TEXT, 
*rId.GetResMgr() ) ),
-    aLogoImage           ( this,     ResId( ABOUT_IMAGE_LOGO, *rId.GetResMgr() 
) ),
+    aLogoImage           ( this ),
     aCreditsButton       ( this,     ResId( ABOUT_BTN_CREDITS, 
*rId.GetResMgr() ) ),
     aWebsiteButton       ( this,     ResId( ABOUT_BTN_WEBSITE, 
*rId.GetResMgr() ) ),
     aCancelButton        ( this,     ResId( ABOUT_BTN_CANCEL, *rId.GetResMgr() 
) ),
@@ -213,15 +213,20 @@ void AboutDialog::LayoutControls()
     Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0);
 
     // Render and Position Logo
+    Size aLogoSize( aIdealTextWidth, aIdealTextWidth / 20 );
+    Point aLogoPos( aDialogBorder, aDialogBorder );
+
     vcl::RenderGraphicRasterizer aRasterizerLogo = 
Application::LoadBrandSVG("flat_logo");
-    float aLogoWidthHeightRatio = 
(float)aRasterizerLogo.GetDefaultSizePixel().Width() /
-                               
(float)aRasterizerLogo.GetDefaultSizePixel().Height();
+    if ( !aRasterizerLogo.GetRenderGraphic().IsEmpty() &&
+         aRasterizerLogo.GetDefaultSizePixel().Width() > 0 && 
aRasterizerLogo.GetDefaultSizePixel().Height() > 0 )
+    {
+        const float aLogoWidthHeightRatio = 
(float)aRasterizerLogo.GetDefaultSizePixel().Width() / 
(float)aRasterizerLogo.GetDefaultSizePixel().Height();
+        aLogoSize = Size( aIdealTextWidth, aIdealTextWidth / 
aLogoWidthHeightRatio );
 
-    Size aLogoSize( aIdealTextWidth, aIdealTextWidth / aLogoWidthHeightRatio );
-    Point aLogoPos( aDialogBorder, aDialogBorder );
-    aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
-    aLogoImage.SetImage( Image( aLogoBitmap ) );
-    aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize );
+        aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
+        aLogoImage.SetImage( Image( aLogoBitmap ) );
+        aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize );
+    }
 
     // Position version text
     sal_Int32 aLogoVersionSpacing = aLogoSize.Height() * 0.15;
diff --git a/cui/source/dialogs/about.src b/cui/source/dialogs/about.src
index ab853c6..3793864 100644
--- a/cui/source/dialogs/about.src
+++ b/cui/source/dialogs/about.src
@@ -114,7 +114,4 @@ ModalDialog RID_DEFAULTABOUT
         DefButton = TRUE ;
         Text [ en-US ] = "~Close";
     };
-    FixedImage ABOUT_IMAGE_LOGO
-    {
-    };
 };
diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx
index f1c27ac..5113cf0 100644
--- a/vcl/source/app/brand.cxx
+++ b/vcl/source/app/brand.cxx
@@ -122,8 +122,9 @@ vcl::RenderGraphicRasterizer Application::LoadBrandSVG 
(const char* pName)
     aRasterizer = loadSvg ("$BRAND_BASE_DIR/program/edition", aName);
     if (!aRasterizer.GetRenderGraphic().IsEmpty())
         return aRasterizer;
+
     aRasterizer = loadSvg ("$BRAND_BASE_DIR/program", aName);
-        return aRasterizer;
+    return aRasterizer;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to