diff options
author | Eike Rathke <erack@redhat.com> | 2013-02-18 18:39:18 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-02-18 20:07:05 +0100 |
commit | 96189af51da6e64ca321cee0d9c2f247c2cefe24 (patch) | |
tree | 5378a0ba9e77de6ffc216d71cf8ffb28a4d34d1c /vcl/source | |
parent | ab6ebe247005d78cbd816269ab76a8d4d6ea11cd (diff) |
slightly improved parameter passing
Change-Id: I75b6bc42285cb3c671dcd4b437db54d5003a2898
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/brand.cxx | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx index 99517d1bbefb..fda0940291d9 100644 --- a/vcl/source/app/brand.cxx +++ b/vcl/source/app/brand.cxx @@ -27,11 +27,10 @@ #include <vcl/svgdata.hxx> namespace { - static bool loadPng(const char *pPath, const rtl::OUString &rName, BitmapEx &rBitmap) + static bool loadPng( rtl::OUString aUri, BitmapEx &rBitmap) { - rtl::OUString uri = rtl::OUString::createFromAscii( pPath ) + rName; - rtl::Bootstrap::expandMacros( uri ); - INetURLObject aObj( uri ); + rtl::Bootstrap::expandMacros( aUri ); + INetURLObject aObj( aUri ); SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { vcl::PNGReader aReader( aStrm ); @@ -41,6 +40,12 @@ namespace { else return false; } + static bool tryLoadPng( const OUString& rName, BitmapEx& rBitmap ) + { + return + loadPng( "$BRAND_BASE_DIR/program/edition" + rName, rBitmap) || + loadPng( "$BRAND_BASE_DIR/program" + rName, rBitmap); + } static bool loadSvg(rtl::OUString aUri, BitmapEx &rBitmap) { rtl::Bootstrap::expandMacros( aUri ); @@ -49,13 +54,12 @@ namespace { rBitmap = aSvgData.getReplacement(); return !rBitmap.IsEmpty(); } -} - -static bool lcl_loadPng( const OUString& rName, BitmapEx& rBitmap ) -{ - return - loadPng( "$BRAND_BASE_DIR/program/edition", rName, rBitmap) || - loadPng( "$BRAND_BASE_DIR/program", rName, rBitmap); + static bool tryLoadSvg( const OUString& rName, BitmapEx& rBitmap ) + { + return + loadSvg( "$BRAND_BASE_DIR/program/edition" + rName, rBitmap) || + loadSvg( "$BRAND_BASE_DIR/program" + rName, rBitmap); + } } bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap) @@ -72,23 +76,16 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap) ::std::vector< OUString > aFallbacks( aLanguageTag.getFallbackStrings()); for (size_t i=0; i < aFallbacks.size(); ++i) { - if (lcl_loadPng( aBaseName + "-" + aFallbacks[i] + aPng, rBitmap)) + if (tryLoadPng( aBaseName + "-" + aFallbacks[i] + aPng, rBitmap)) return true; } - if (lcl_loadPng( aBaseName + aPng, rBitmap)) + if (tryLoadPng( aBaseName + aPng, rBitmap)) return true; return false; } -static bool lcl_loadSvg( const OUString& rName, BitmapEx& rBitmap ) -{ - return - loadSvg( "$BRAND_BASE_DIR/program/edition" + rName, rBitmap) || - loadSvg( "$BRAND_BASE_DIR/program" + rName, rBitmap); -} - bool Application::LoadBrandSVG (const char *pName, BitmapEx &rBitmap) { rtl::OUString aBaseName( "/" + rtl::OUString::createFromAscii( pName ) ); @@ -101,11 +98,11 @@ bool Application::LoadBrandSVG (const char *pName, BitmapEx &rBitmap) ::std::vector< OUString > aFallbacks( aLanguageTag.getFallbackStrings()); for (size_t i=0; i < aFallbacks.size(); ++i) { - if (lcl_loadSvg( aBaseName + "-" + aFallbacks[i] + aSvg, rBitmap)) + if (tryLoadSvg( aBaseName + "-" + aFallbacks[i] + aSvg, rBitmap)) return true; } - if (lcl_loadSvg( aBaseName + aSvg, rBitmap)) + if (tryLoadSvg( aBaseName + aSvg, rBitmap)) return true; return false; |