diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-07 10:29:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-08 19:15:09 +0100 |
commit | 15f0d61206dddee12159b68aeab5c860e3d5aff4 (patch) | |
tree | 9eee7e6918281ba7e5ffd3e06d74a2fa4fe28de3 /vcl/source | |
parent | ceb32911f07b63fda074facba377eeb4d5946cdf (diff) |
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 <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 14 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 4 | ||||
-rw-r--r-- | vcl/source/treelist/svimpbox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/scrwnd.cxx | 12 |
7 files changed, 21 insertions, 27 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 6adc7d802775..df40054c98b8 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -561,13 +561,13 @@ namespace { assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image"); if (rImage == "dialog-warning") - return Image(BitmapEx(IMG_WARN)); + return Image(StockImage::Yes, IMG_WARN); else if (rImage == "dialog-error") - return Image(BitmapEx(IMG_ERROR)); + return Image(StockImage::Yes, IMG_ERROR); else if (rImage == "dialog-information") - return Image(BitmapEx(IMG_INFO)); + return Image(StockImage::Yes, IMG_INFO); } - return Image(BitmapEx(rImage)); + return Image(StockImage::Yes, rImage); } Image createImage(VirtualDevice& rDevice) @@ -1236,7 +1236,7 @@ public: virtual void set_from_icon_name(const OUString& rIconName) override { - m_xButton->SetModeImage(::Image(BitmapEx(rIconName))); + m_xButton->SetModeImage(::Image(StockImage::Yes, rIconName)); } virtual void set_label_line_wrap(bool wrap) override @@ -1407,7 +1407,7 @@ public: virtual void set_from_icon_name(const OUString& rIconName) override { - m_xRadioButton->SetModeRadioImage(::Image(BitmapEx(rIconName))); + m_xRadioButton->SetModeRadioImage(::Image(StockImage::Yes, rIconName)); } virtual void set_inconsistent(bool /*inconsistent*/) override @@ -1620,7 +1620,7 @@ public: virtual void set_from_icon_name(const OUString& rIconName) override { - m_xImage->SetImage(::Image(BitmapEx(rIconName))); + m_xImage->SetImage(::Image(StockImage::Yes, rIconName)); } }; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 5e294019c36c..86f709ddb879 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3785,9 +3785,9 @@ void DisclosureButton::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) ImplSVCtrlData& rCtrlData(ImplGetSVData()->maCtrlData); if (!rCtrlData.mpDisclosurePlus) - rCtrlData.mpDisclosurePlus.reset(new Image(BitmapEx(SV_DISCLOSURE_PLUS))); + rCtrlData.mpDisclosurePlus.reset(new Image(StockImage::Yes, SV_DISCLOSURE_PLUS)); if (!rCtrlData.mpDisclosureMinus) - rCtrlData.mpDisclosureMinus.reset(new Image(BitmapEx(SV_DISCLOSURE_MINUS))); + rCtrlData.mpDisclosureMinus.reset(new Image(StockImage::Yes, SV_DISCLOSURE_MINUS)); Image* pImg = IsChecked() ? rCtrlData.mpDisclosureMinus.get() : rCtrlData.mpDisclosurePlus.get(); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 82401c5c06a4..ea9cfcee05f1 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2174,12 +2174,10 @@ NotebookbarTabControlBase::NotebookbarTabControlBase(vcl::Window* pParent) , bLastContextWasSupported(true) , eLastContext(vcl::EnumContext::Context::Any) { - BitmapEx aBitmap(SV_RESID_BITMAP_NOTEBOOKBAR); - m_pOpenMenu = VclPtr<PushButton>::Create( this , WB_CENTER | WB_VCENTER ); m_pOpenMenu->SetSizePixel(Size(HAMBURGER_DIM, HAMBURGER_DIM)); m_pOpenMenu->SetClickHdl(LINK(this, NotebookbarTabControlBase, OpenMenu)); - m_pOpenMenu->SetModeImage(Image(aBitmap)); + m_pOpenMenu->SetModeImage(Image(StockImage::Yes, SV_RESID_BITMAP_NOTEBOOKBAR)); m_pOpenMenu->Show(); } diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 1c6a222a2b3f..78be5057c96e 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -3322,8 +3322,8 @@ void SvImpLBox::implInitDefaultNodeImages() // assume that all or nothing is initialized return; - s_pDefCollapsed = new Image(BitmapEx(RID_BMP_TREENODE_COLLAPSED)); - s_pDefExpanded = new Image(BitmapEx(RID_BMP_TREENODE_EXPANDED)); + s_pDefCollapsed = new Image(StockImage::Yes, RID_BMP_TREENODE_COLLAPSED); + s_pDefExpanded = new Image(StockImage::Yes, RID_BMP_TREENODE_EXPANDED); } diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 290c6ab65ffa..f45cb3e64681 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -60,8 +60,7 @@ void DecoToolBox::calcMinSize() ScopedVclPtrInstance<ToolBox> aTbx( GetParent() ); if( GetItemCount() == 0 ) { - BitmapEx aBitmap(SV_RESID_BITMAP_CLOSEDOC); - aTbx->InsertItem(IID_DOCUMENTCLOSE, Image(aBitmap)); + aTbx->InsertItem(IID_DOCUMENTCLOSE, Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC)); } else { @@ -127,8 +126,7 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : SetMBWHideAccel(true); SetMBWMenuKey(false); - BitmapEx aBitmap(SV_RESID_BITMAP_CLOSEDOC); - aCloseBtn->maImage = Image(aBitmap); + aCloseBtn->maImage = Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC); aCloseBtn->SetOutStyle(TOOLBOX_STYLE_FLAT); aCloseBtn->SetBackground(); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 05db90085456..9dd5fa29fc3d 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -535,8 +535,6 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo , maNoPreviewStr( VclResId( SV_PRINT_NOPREVIEW ) ) , mnCurPage( 0 ) , mnCachedPages( 0 ) -, maCollateBmp(SV_PRINT_COLLATE_BMP) -, maNoCollateBmp(SV_PRINT_NOCOLLATE_BMP) , mbCollateAlwaysOff(false) , mbShowLayoutFrame( true ) , mbSingleJobs( false ) @@ -1079,7 +1077,7 @@ void PrintDialog::checkControlDependencies() else mpCollateBox->Enable( false ); - Image aImg(mpCollateBox->IsChecked() ? maCollateBmp : maNoCollateBmp); + Image aImg(StockImage::Yes, mpCollateBox->IsChecked() ? OUString(SV_PRINT_COLLATE_BMP) : OUString(SV_PRINT_NOCOLLATE_BMP)); Size aImgSize( aImg.GetSizePixel() ); diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx index 079f87ee580f..b5aec1cfb009 100644 --- a/vcl/source/window/scrwnd.cxx +++ b/vcl/source/window/scrwnd.cxx @@ -116,12 +116,12 @@ void ImplWheelWindow::ImplSetRegion( const Bitmap& rRegionBmp ) void ImplWheelWindow::ImplCreateImageList() { - maImgList.emplace_back(BitmapEx(SV_RESID_BITMAP_SCROLLVH)); - maImgList.emplace_back(BitmapEx(SV_RESID_BITMAP_SCROLLV)); - maImgList.emplace_back(BitmapEx(SV_RESID_BITMAP_SCROLLH)); - maImgList.emplace_back(BitmapEx(SV_RESID_BITMAP_WHEELVH)); - maImgList.emplace_back(BitmapEx(SV_RESID_BITMAP_WHEELV)); - maImgList.emplace_back(BitmapEx(SV_RESID_BITMAP_WHEELH)); + maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_SCROLLVH)); + maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_SCROLLV)); + maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_SCROLLH)); + maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WHEELVH)); + maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WHEELV)); + maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WHEELH)); } void ImplWheelWindow::ImplSetWheelMode( WheelMode nWheelMode ) |