From 15f0d61206dddee12159b68aeab5c860e3d5aff4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 7 Dec 2018 10:29:02 +0200 Subject: use Image(OUString) instead of Image(Bitmap(OUString)) which benefits LOOL since we can delay creating the image until we know the dpi setting of the display we are going to write to. Achieved by perl -pi -w -e "s/\bImage\s*\(\s*BitmapEx\s*\((\w+)\s*\)\s*\)/Image\(\1\)/g" $( git grep -lw "BitmapEx" ) followed by git grep -nP '\bImage\s*\(\s*BitmapEx\s*\(' followed by commenting out the BitmapEx(OUString) constructor and seeing what needed adjusting. Change-Id: I3224e11937d720fa484b0d659d25673a9e809267 Reviewed-on: https://gerrit.libreoffice.org/64760 Tested-by: Jenkins Reviewed-by: Michael Meeks --- sd/source/ui/animations/CustomAnimationList.cxx | 7 +++---- sd/source/ui/animations/SlideTransitionPane.cxx | 2 +- sd/source/ui/app/sdmod2.cxx | 4 ++-- sd/source/ui/dlg/navigatr.cxx | 2 +- sd/source/ui/dlg/sdtreelb.cxx | 28 ++++++++++++------------- sd/source/ui/tools/IconCache.cxx | 2 +- 6 files changed, 22 insertions(+), 23 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index a4aa0644abe7..9019a412482b 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -274,11 +274,11 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, sal_Int16 nNodeType = mpEffect->getNodeType(); if (nNodeType == EffectNodeType::ON_CLICK ) { - rRenderContext.DrawImage(aPos, Image(BitmapEx(BMP_CUSTOMANIMATION_ON_CLICK))); + rRenderContext.DrawImage(aPos, Image(StockImage::Yes, BMP_CUSTOMANIMATION_ON_CLICK)); } else if (nNodeType == EffectNodeType::AFTER_PREVIOUS) { - rRenderContext.DrawImage(aPos, Image(BitmapEx(BMP_CUSTOMANIMATION_AFTER_PREVIOUS))); + rRenderContext.DrawImage(aPos, Image(StockImage::Yes, BMP_CUSTOMANIMATION_AFTER_PREVIOUS)); } else if (nNodeType == EffectNodeType::WITH_PREVIOUS) { @@ -323,8 +323,7 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, if (!sImage.isEmpty()) { - BitmapEx aBitmap(sImage); - Image aImage(aBitmap); + Image aImage(StockImage::Yes, sImage); Point aImagePos(aPos); aImagePos.AdjustY((aSize.Height()/2 - aImage.GetSizePixel().Height()) >> 1 ); rRenderContext.DrawImage(aImagePos, aImage); diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index b7025bacfb30..826c307b25fd 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -472,7 +472,7 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) // dummy list box of slide transitions for startup. mpVS_TRANSITION_ICONS->InsertItem( - 0, Image( BitmapEx( "sd/cmd/transition-none.png" ) ), + 0, Image( StockImage::Yes, "sd/cmd/transition-none.png" ), SdResId( STR_SLIDETRANSITION_NONE ), VALUESET_APPEND, /* show legend */ true ); mpVS_TRANSITION_ICONS->RecalculateItemSizes(); diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 04aa3657adf7..2730b1e7adc9 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -811,12 +811,12 @@ std::unique_ptr SdModule::CreateStyleFamilies() pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para, SdResId(STR_GRAPHICS_STYLE_FAMILY), - Image(BitmapEx(BMP_STYLES_FAMILY_GRAPHICS)), + Image(StockImage::Yes, BMP_STYLES_FAMILY_GRAPHICS), RID_GRAPHICSTYLEFAMILY, SD_MOD()->GetResLocale())); pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Pseudo, SdResId(STR_PRESENTATIONS_STYLE_FAMILY), - Image(BitmapEx(BMP_STYLES_FAMILY_PRESENTATIONS)), + Image(StockImage::Yes, BMP_STYLES_FAMILY_PRESENTATIONS), RID_PRESENTATIONSTYLEFAMILY, SD_MOD()->GetResLocale())); return pStyleFamilies; diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 6e573c8f259f..7ef07aaa7ea9 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -768,7 +768,7 @@ void SdNavigatorWin::KeyInput( const KeyEvent& rKEvt ) void SdNavigatorWin::SetDragImage() { const sal_uInt16 nDragTypeId = maToolbox->GetItemId("dragmode"); - maToolbox->SetItemImage(nDragTypeId, Image(BitmapEx(GetDragTypeSdBmpId(meDragType)))); + maToolbox->SetItemImage(nDragTypeId, Image(StockImage::Yes, GetDragTypeSdBmpId(meDragType))); } /** diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index f3ff7edbec0c..70ecaebf96f0 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -198,8 +198,8 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle ) , mpBookmarkDoc ( nullptr ) , mpMedium ( nullptr ) , mpOwnMedium ( nullptr ) -, maImgOle ( BitmapEx(BMP_OLE) ) -, maImgGraphic ( BitmapEx(BMP_GRAPHIC) ) +, maImgOle ( StockImage::Yes, BMP_OLE ) +, maImgGraphic ( StockImage::Yes, BMP_GRAPHIC ) , mbLinkableSelected ( false ) , mbSaveTreeItemState ( false ) , mbShowAllShapes ( false ) @@ -213,7 +213,7 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle ) WB_HSCROLL | WB_HASBUTTONSATROOT ); SetQuickSearch(true); /* i31275 */; - SetNodeBitmaps(Image(BitmapEx(BMP_EXPAND)), Image(BitmapEx(BMP_COLLAPSE))); + SetNodeBitmaps(Image(StockImage::Yes, BMP_EXPAND), Image(StockImage::Yes, BMP_COLLAPSE)); SetDragDropMode( DragDropMode::CTRL_MOVE | DragDropMode::CTRL_COPY | @@ -488,8 +488,8 @@ void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium, mpMedium = pInMedium; maDocName = rDocName; - Image aImgDocOpen=Image(BitmapEx(BMP_DOC_OPEN)); - Image aImgDocClosed=Image(BitmapEx(BMP_DOC_CLOSED)); + Image aImgDocOpen(StockImage::Yes, BMP_DOC_OPEN); + Image aImgDocClosed(StockImage::Yes, BMP_DOC_CLOSED); // insert document name InsertEntry( maDocName, aImgDocOpen, aImgDocClosed, nullptr, true, TREELIST_APPEND, @@ -750,9 +750,9 @@ void SdPageObjsTLB::RequestingChildren( SvTreeListEntry* pFileEntry ) SdrObject* pObj = nullptr; SvTreeListEntry* pPageEntry = nullptr; - Image aImgPage = Image(BitmapEx(BMP_PAGE)); - Image aImgPageObjs = Image(BitmapEx(BMP_PAGEOBJS)); - Image aImgObjects = Image(BitmapEx(BMP_OBJECTS)); + Image aImgPage(StockImage::Yes, BMP_PAGE); + Image aImgPageObjs(StockImage::Yes, BMP_PAGEOBJS); + Image aImgObjects(StockImage::Yes, BMP_OBJECTS); // document name already inserted @@ -1422,12 +1422,12 @@ void SdPageObjsTLB::AddShapeToTransferable ( //===== IconProvider ========================================================== SdPageObjsTLB::IconProvider::IconProvider() - : maImgPage(BitmapEx(BMP_PAGE)), - maImgPageExcl(BitmapEx(BMP_PAGE_EXCLUDED)), - maImgPageObjsExcl(BitmapEx(BMP_PAGEOBJS_EXCLUDED)), - maImgPageObjs(BitmapEx(BMP_PAGEOBJS)), - maImgObjects(BitmapEx(BMP_OBJECTS)), - maImgGroup(BitmapEx(BMP_GROUP)) + : maImgPage(StockImage::Yes, BMP_PAGE), + maImgPageExcl(StockImage::Yes, BMP_PAGE_EXCLUDED), + maImgPageObjsExcl(StockImage::Yes, BMP_PAGEOBJS_EXCLUDED), + maImgPageObjs(StockImage::Yes, BMP_PAGEOBJS), + maImgObjects(StockImage::Yes, BMP_OBJECTS), + maImgGroup(StockImage::Yes, BMP_GROUP) { } diff --git a/sd/source/ui/tools/IconCache.cxx b/sd/source/ui/tools/IconCache.cxx index 25b3e0225f8d..3d38142dd225 100644 --- a/sd/source/ui/tools/IconCache.cxx +++ b/sd/source/ui/tools/IconCache.cxx @@ -54,7 +54,7 @@ Image IconCache::Implementation::GetIcon(const OUString& rResourceId) iImage = maContainer.find(rResourceId); if (iImage == maContainer.end()) { - aResult = Image(BitmapEx(rResourceId)); + aResult = Image(StockImage::Yes, rResourceId); maContainer[rResourceId] = aResult; } else -- cgit