Fix the About dialog rendering when librsvg is not available / functional.

Change-Id: Ib460f3cbf44114ef74065168b218daca51f2f0e9
This commit is contained in:
Jan Holesovsky
2012-07-13 15:36:28 +02:00
parent 05a0aaa25e
commit debfb21c92
3 changed files with 16 additions and 13 deletions

View File

@@ -74,7 +74,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
aDescriptionText ( this, ResId( ABOUT_DESCRIPTION_TEXT, *rId.GetResMgr() ) ), aDescriptionText ( this, ResId( ABOUT_DESCRIPTION_TEXT, *rId.GetResMgr() ) ),
aCopyrightText ( this, ResId( ABOUT_COPYRIGHT_TEXT, *rId.GetResMgr() ) ), aCopyrightText ( this, ResId( ABOUT_COPYRIGHT_TEXT, *rId.GetResMgr() ) ),
aCopyrightTextShadow ( 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() ) ), aCreditsButton ( this, ResId( ABOUT_BTN_CREDITS, *rId.GetResMgr() ) ),
aWebsiteButton ( this, ResId( ABOUT_BTN_WEBSITE, *rId.GetResMgr() ) ), aWebsiteButton ( this, ResId( ABOUT_BTN_WEBSITE, *rId.GetResMgr() ) ),
aCancelButton ( this, ResId( ABOUT_BTN_CANCEL, *rId.GetResMgr() ) ), aCancelButton ( this, ResId( ABOUT_BTN_CANCEL, *rId.GetResMgr() ) ),
@@ -191,15 +191,20 @@ void AboutDialog::LayoutControls()
Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0); Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0);
// Render and Position Logo // Render and Position Logo
vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo"); Size aLogoSize( aIdealTextWidth, aIdealTextWidth / 20 );
float aLogoWidthHeightRatio = (float)aRasterizerLogo.GetDefaultSizePixel().Width() /
(float)aRasterizerLogo.GetDefaultSizePixel().Height();
Size aLogoSize( aIdealTextWidth, aIdealTextWidth / aLogoWidthHeightRatio );
Point aLogoPos( aDialogBorder, aDialogBorder ); Point aLogoPos( aDialogBorder, aDialogBorder );
aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
aLogoImage.SetImage( Image( aLogoBitmap ) ); vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo");
aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize ); 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 );
aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
aLogoImage.SetImage( Image( aLogoBitmap ) );
aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize );
}
// Position version text // Position version text
sal_Int32 aLogoVersionSpacing = aLogoSize.Height() * 0.15; sal_Int32 aLogoVersionSpacing = aLogoSize.Height() * 0.15;

View File

@@ -114,7 +114,4 @@ ModalDialog RID_DEFAULTABOUT
DefButton = TRUE ; DefButton = TRUE ;
Text [ en-US ] = "~Close"; Text [ en-US ] = "~Close";
}; };
FixedImage ABOUT_IMAGE_LOGO
{
};
}; };

View File

@@ -122,8 +122,9 @@ vcl::RenderGraphicRasterizer Application::LoadBrandSVG (const char* pName)
aRasterizer = loadSvg ("$BRAND_BASE_DIR/program/edition", aName); aRasterizer = loadSvg ("$BRAND_BASE_DIR/program/edition", aName);
if (!aRasterizer.GetRenderGraphic().IsEmpty()) if (!aRasterizer.GetRenderGraphic().IsEmpty())
return aRasterizer; return aRasterizer;
aRasterizer = loadSvg ("$BRAND_BASE_DIR/program", aName); aRasterizer = loadSvg ("$BRAND_BASE_DIR/program", aName);
return aRasterizer; return aRasterizer;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */