[Libreoffice-commits] core.git: sfx2/source svx/source sw/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Sat Oct 29 18:14:55 UTC 2016
sfx2/source/sidebar/TabBar.cxx | 13 -------------
svx/source/stbctrls/modctrl.cxx | 11 -----------
svx/source/stbctrls/pszctrl.cxx | 11 -----------
svx/source/stbctrls/selctrl.cxx | 8 --------
svx/source/stbctrls/xmlsecctrl.cxx | 17 -----------------
svx/source/stbctrls/zoomsliderctrl.cxx | 19 -------------------
sw/source/uibase/utlui/content.cxx | 12 ------------
sw/source/uibase/utlui/viewlayoutctrl.cxx | 24 ------------------------
vcl/source/control/fixed.cxx | 11 ++---------
vcl/source/window/menu.cxx | 11 -----------
vcl/source/window/toolbox2.cxx | 14 --------------
11 files changed, 2 insertions(+), 149 deletions(-)
New commits:
commit 484390a09624f68a8dec01eb5bf06e84cdcb80f6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Oct 27 18:04:46 2016 +0200
HiDPI: remove unneeded image scaling when HiDPI is enabled
We don't need to scale images for HiDPI mode anymore - this is now
done automatically when the image is loaded.
Change-Id: Ie285cf4d672f4c098a468d3f7560ee2700365b92
Reviewed-on: https://gerrit.libreoffice.org/30340
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 87777de..62826f7 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -145,12 +145,6 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
void TabBar::UpdateButtonIcons()
{
Image aImage = Theme::GetImage(Theme::Image_TabBarMenu);
- if ( mpMenuButton->GetDPIScaleFactor() > 1 )
- {
- BitmapEx b = aImage.GetBitmapEx();
- b.Scale(mpMenuButton->GetDPIScaleFactor(), mpMenuButton->GetDPIScaleFactor(), BmpScaleFlag::Fast);
- aImage = Image(b);
- }
mpMenuButton->SetModeImage(aImage);
for(ItemContainer::const_iterator
@@ -163,13 +157,6 @@ void TabBar::UpdateButtonIcons()
if (xDeckDescriptor)
{
aImage = GetItemImage(*xDeckDescriptor);
- if ( mpMenuButton->GetDPIScaleFactor() > 1 )
- {
- BitmapEx b = aImage.GetBitmapEx();
- b.Scale(mpMenuButton->GetDPIScaleFactor(), mpMenuButton->GetDPIScaleFactor(), BmpScaleFlag::Fast);
- aImage = Image(b);
- }
-
iItem->mpButton->SetModeImage(aImage);
}
}
diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx
index a76263b..8b476f5 100644
--- a/svx/source/stbctrls/modctrl.cxx
+++ b/svx/source/stbctrls/modctrl.cxx
@@ -66,17 +66,6 @@ SvxModifyControl::SvxModifyControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, Status
SfxStatusBarControl( _nSlotId, _nId, rStb ),
mxImpl(new ImplData)
{
-//#ifndef MACOSX
- if ( rStb.GetDPIScaleFactor() > 1 )
- {
- for (int i = 0; i < ImplData::MODIFICATION_STATE_SIZE; i++)
- {
- BitmapEx b = mxImpl->maImages[i].GetBitmapEx();
- b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BmpScaleFlag::Fast);
- mxImpl->maImages[i] = Image(b);
- }
- }
-//#endif
mxImpl->maIdle.SetIdleHdl( LINK(this, SvxModifyControl, OnTimer) );
}
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index d623a86..90e1594 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -177,17 +177,6 @@ SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId,
pImpl->aPosImage = Image( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) );
pImpl->aSizeImage = Image( ResId( RID_SVXBMP_SIZE, DIALOG_MGR() ) );
- if ( rStb.GetDPIScaleFactor() > 1)
- {
- BitmapEx b = pImpl->aPosImage.GetBitmapEx();
- b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BmpScaleFlag::Fast);
- pImpl->aPosImage = Image(b);
-
- b = pImpl->aSizeImage.GetBitmapEx();
- b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BmpScaleFlag::Fast);
- pImpl->aSizeImage = Image(b);
- }
-
addStatusListener( STR_POSITION); // SID_ATTR_POSITION
addStatusListener( STR_TABLECELL); // SID_TABLE_CELL
addStatusListener( STR_FUNC); // SID_PSZ_FUNCTION
diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx
index 13579ed..8cf5f5c 100644
--- a/svx/source/stbctrls/selctrl.cxx
+++ b/svx/source/stbctrls/selctrl.cxx
@@ -77,14 +77,6 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId,
mnState( 0 ),
maImage( SVX_RES( RID_SVXBMP_SELECTION ) )
{
-//#ifndef MACOSX
- if ( GetStatusBar().GetDPIScaleFactor() > 1 )
- {
- BitmapEx b = maImage.GetBitmapEx();
- b.Scale(GetStatusBar().GetDPIScaleFactor(), GetStatusBar().GetDPIScaleFactor(), BmpScaleFlag::Fast);
- maImage = Image(b);
- }
-//#endif
GetStatusBar().SetItemText( GetId(), "" );
}
diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx
index 3368815..2fb9bd3 100644
--- a/svx/source/stbctrls/xmlsecctrl.cxx
+++ b/svx/source/stbctrls/xmlsecctrl.cxx
@@ -57,23 +57,6 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16
mpImpl->maImage = Image( SVX_RES( RID_SVXBMP_SIGNET ) );
mpImpl->maImageBroken = Image( SVX_RES( RID_SVXBMP_SIGNET_BROKEN ) );
mpImpl->maImageNotValidated = Image( SVX_RES( RID_SVXBMP_SIGNET_NOTVALIDATED ) );
-
- if (_rStb.GetDPIScaleFactor() > 1)
- {
- Image arr[3] = {mpImpl->maImage, mpImpl->maImageBroken, mpImpl->maImageNotValidated};
-
- for (Image & i : arr)
- {
- BitmapEx b = i.GetBitmapEx();
- b.Scale(_rStb.GetDPIScaleFactor(), _rStb.GetDPIScaleFactor(), BmpScaleFlag::Fast);
- i = Image(b);
- }
-
- mpImpl->maImage = arr[0];
- mpImpl->maImageBroken = arr[1];
- mpImpl->maImageNotValidated = arr[2];
- }
-
}
XmlSecStatusBarControl::~XmlSecStatusBarControl()
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 3f2fc41..8811a26 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -159,25 +159,6 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nI
mxImpl->maSliderButton = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON ) );
mxImpl->maIncreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERINCREASE ) );
mxImpl->maDecreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERDECREASE ) );
-
-//#ifndef MACOSX
- sal_Int32 nScaleFactor = rStatusBar.GetDPIScaleFactor();
- if (nScaleFactor != 1)
- {
- Image arr[3] = {mxImpl->maSliderButton, mxImpl->maIncreaseButton, mxImpl->maDecreaseButton};
-
- for (int i = 0; i < 3; i++)
- {
- BitmapEx aBitmap = arr[i].GetBitmapEx();
- //Use Lanczos scaling for the slider button because it does a better job with circles
- aBitmap.Scale(nScaleFactor, nScaleFactor, i == 0 ? BmpScaleFlag::Lanczos : BmpScaleFlag::Fast);
- arr[i] = Image(aBitmap);
- }
- mxImpl->maSliderButton = arr[0];
- mxImpl->maIncreaseButton = arr[1];
- mxImpl->maDecreaseButton = arr[2];
- }
-//#endif
}
SvxZoomSliderControl::~SvxZoomSliderControl()
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 28d2711..0693c90 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1521,18 +1521,6 @@ void SwContentTree::Display( bool bActive )
if(!m_bIsImageListInitialized)
{
m_aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP));
-
- if ( GetDPIScaleFactor() > 1 )
- {
- for (short i = 0; i < m_aEntryImages.GetImageCount(); i++)
- {
- OUString rImageName = m_aEntryImages.GetImageName(i);
- BitmapEx b = m_aEntryImages.GetImage(rImageName).GetBitmapEx();
- //Use Lanczos because it looks better with circles / diagonals
- b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Lanczos);
- m_aEntryImages.ReplaceImage(rImageName, Image(b));
- }
- }
m_bIsImageListInitialized = true;
}
// First read the selected entry to select it later again if necessary
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index 0531e04..6f0b5be 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -51,30 +51,6 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
mpImpl->maImageAutomatic_Active = Image( SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) );
mpImpl->maImageBookMode = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE) );
mpImpl->maImageBookMode_Active = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) );
-
- sal_Int32 nScaleFactor = rStatusBar.GetDPIScaleFactor();
- if (nScaleFactor != 1)
- {
- Image arr[6] = {mpImpl->maImageSingleColumn, mpImpl->maImageSingleColumn_Active,
- mpImpl->maImageAutomatic, mpImpl->maImageAutomatic_Active,
- mpImpl->maImageBookMode, mpImpl->maImageBookMode_Active};
-
- for (Image & i : arr)
- {
- BitmapEx aBitmap = i.GetBitmapEx();
- aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast);
- i = Image(aBitmap);
- }
-
- mpImpl->maImageSingleColumn = arr[0];
- mpImpl->maImageSingleColumn_Active = arr[1];
-
- mpImpl->maImageAutomatic = arr[2];
- mpImpl->maImageAutomatic_Active = arr[3];
-
- mpImpl->maImageBookMode = arr[4];
- mpImpl->maImageBookMode_Active = arr[5];
- }
}
SwViewLayoutControl::~SwViewLayoutControl()
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index eef58c2..dae1d42 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -974,14 +974,7 @@ bool FixedImage::SetModeImage( const Image& rImage )
Image FixedImage::loadThemeImage(const OString &rFileName)
{
- OUString sIconTheme =
- Application::GetSettings().GetStyleSettings().DetermineIconTheme();
- const OUString sFileName(OStringToOUString(rFileName, RTL_TEXTENCODING_UTF8));
- BitmapEx aBitmap;
- bool bSuccess = ImplImageTree::get().loadImage(
- sFileName, sIconTheme, aBitmap, true);
- SAL_WARN_IF(!bSuccess, "vcl.layout", "Unable to load " << sFileName
- << " from theme " << sIconTheme);
+ BitmapEx aBitmap(OStringToOUString(rFileName, RTL_TEXTENCODING_UTF8));
return Image(aBitmap);
}
@@ -989,7 +982,7 @@ bool FixedImage::set_property(const OString &rKey, const OString &rValue)
{
if (rKey == "pixbuf")
{
- SetImage(FixedImage::loadThemeImage(rValue));
+ SetImage(loadThemeImage(rValue));
}
else
return Control::set_property(rKey, rValue);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 743d724..cd1b3fd 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1502,10 +1502,6 @@ Size Menu::ImplCalcSize( vcl::Window* pWin )
{
Size aImgSz = pData->aImage.GetSizePixel();
- sal_Int32 nScaleFactor = pWindow->GetDPIScaleFactor();
- aImgSz.Height() *= nScaleFactor;
- aImgSz.Width() *= nScaleFactor;
-
aImgSz.Height() += 4; // add a border for native marks
aImgSz.Width() += 4; // add a border for native marks
if ( aImgSz.Width() > aMaxImgSz.Width() )
@@ -1957,13 +1953,6 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext,
Image aImage = pData->aImage;
- sal_Int32 nScaleFactor = rRenderContext.GetDPIScaleFactor();
- if (nScaleFactor != 1)
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
- aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast);
- aImage = Image(aBitmap);
- }
aTmpPos = aOuterCheckRect.TopLeft();
aTmpPos.X() += (aOuterCheckRect.GetWidth() - aImage.GetSizePixel().Width()) / 2;
aTmpPos.Y() += (aOuterCheckRect.GetHeight() - aImage.GetSizePixel().Height()) / 2;
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 677f9c1..5336f22 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -951,20 +951,6 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
Size aOldSize = pItem->maImage.GetSizePixel();
pItem->maImageOriginal = aImage;
-
- if (GetDPIScaleFactor() > 1)
- {
- BitmapEx aBitmap(aImage.GetBitmapEx());
-
- // Some code calls this twice, so add a sanity check
- // FIXME find out what that code is & fix accordingly
- if (aBitmap.GetSizePixel().Width() < 32)
- {
- aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
- aImage = Image(aBitmap);
- }
- }
-
pItem->maImage = aImage;
// only once all is calculated, do extra work
More information about the Libreoffice-commits
mailing list