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@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
5bb5463efe
commit
484390a096
@@ -145,12 +145,6 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
|
|||||||
void TabBar::UpdateButtonIcons()
|
void TabBar::UpdateButtonIcons()
|
||||||
{
|
{
|
||||||
Image aImage = Theme::GetImage(Theme::Image_TabBarMenu);
|
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);
|
mpMenuButton->SetModeImage(aImage);
|
||||||
|
|
||||||
for(ItemContainer::const_iterator
|
for(ItemContainer::const_iterator
|
||||||
@@ -163,13 +157,6 @@ void TabBar::UpdateButtonIcons()
|
|||||||
if (xDeckDescriptor)
|
if (xDeckDescriptor)
|
||||||
{
|
{
|
||||||
aImage = GetItemImage(*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);
|
iItem->mpButton->SetModeImage(aImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,17 +66,6 @@ SvxModifyControl::SvxModifyControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, Status
|
|||||||
SfxStatusBarControl( _nSlotId, _nId, rStb ),
|
SfxStatusBarControl( _nSlotId, _nId, rStb ),
|
||||||
mxImpl(new ImplData)
|
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) );
|
mxImpl->maIdle.SetIdleHdl( LINK(this, SvxModifyControl, OnTimer) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -177,17 +177,6 @@ SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId,
|
|||||||
pImpl->aPosImage = Image( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) );
|
pImpl->aPosImage = Image( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) );
|
||||||
pImpl->aSizeImage = Image( ResId( RID_SVXBMP_SIZE, 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_POSITION); // SID_ATTR_POSITION
|
||||||
addStatusListener( STR_TABLECELL); // SID_TABLE_CELL
|
addStatusListener( STR_TABLECELL); // SID_TABLE_CELL
|
||||||
addStatusListener( STR_FUNC); // SID_PSZ_FUNCTION
|
addStatusListener( STR_FUNC); // SID_PSZ_FUNCTION
|
||||||
|
@@ -77,14 +77,6 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId,
|
|||||||
mnState( 0 ),
|
mnState( 0 ),
|
||||||
maImage( SVX_RES( RID_SVXBMP_SELECTION ) )
|
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(), "" );
|
GetStatusBar().SetItemText( GetId(), "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,23 +57,6 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16
|
|||||||
mpImpl->maImage = Image( SVX_RES( RID_SVXBMP_SIGNET ) );
|
mpImpl->maImage = Image( SVX_RES( RID_SVXBMP_SIGNET ) );
|
||||||
mpImpl->maImageBroken = Image( SVX_RES( RID_SVXBMP_SIGNET_BROKEN ) );
|
mpImpl->maImageBroken = Image( SVX_RES( RID_SVXBMP_SIGNET_BROKEN ) );
|
||||||
mpImpl->maImageNotValidated = Image( SVX_RES( RID_SVXBMP_SIGNET_NOTVALIDATED ) );
|
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()
|
XmlSecStatusBarControl::~XmlSecStatusBarControl()
|
||||||
|
@@ -159,25 +159,6 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nI
|
|||||||
mxImpl->maSliderButton = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON ) );
|
mxImpl->maSliderButton = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON ) );
|
||||||
mxImpl->maIncreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERINCREASE ) );
|
mxImpl->maIncreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERINCREASE ) );
|
||||||
mxImpl->maDecreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERDECREASE ) );
|
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()
|
SvxZoomSliderControl::~SvxZoomSliderControl()
|
||||||
|
@@ -1521,18 +1521,6 @@ void SwContentTree::Display( bool bActive )
|
|||||||
if(!m_bIsImageListInitialized)
|
if(!m_bIsImageListInitialized)
|
||||||
{
|
{
|
||||||
m_aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP));
|
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;
|
m_bIsImageListInitialized = true;
|
||||||
}
|
}
|
||||||
// First read the selected entry to select it later again if necessary
|
// First read the selected entry to select it later again if necessary
|
||||||
|
@@ -51,30 +51,6 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
|
|||||||
mpImpl->maImageAutomatic_Active = Image( SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) );
|
mpImpl->maImageAutomatic_Active = Image( SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) );
|
||||||
mpImpl->maImageBookMode = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE) );
|
mpImpl->maImageBookMode = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE) );
|
||||||
mpImpl->maImageBookMode_Active = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) );
|
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()
|
SwViewLayoutControl::~SwViewLayoutControl()
|
||||||
|
@@ -974,14 +974,7 @@ bool FixedImage::SetModeImage( const Image& rImage )
|
|||||||
|
|
||||||
Image FixedImage::loadThemeImage(const OString &rFileName)
|
Image FixedImage::loadThemeImage(const OString &rFileName)
|
||||||
{
|
{
|
||||||
OUString sIconTheme =
|
BitmapEx aBitmap(OStringToOUString(rFileName, RTL_TEXTENCODING_UTF8));
|
||||||
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);
|
|
||||||
return Image(aBitmap);
|
return Image(aBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -989,7 +982,7 @@ bool FixedImage::set_property(const OString &rKey, const OString &rValue)
|
|||||||
{
|
{
|
||||||
if (rKey == "pixbuf")
|
if (rKey == "pixbuf")
|
||||||
{
|
{
|
||||||
SetImage(FixedImage::loadThemeImage(rValue));
|
SetImage(loadThemeImage(rValue));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Control::set_property(rKey, rValue);
|
return Control::set_property(rKey, rValue);
|
||||||
|
@@ -1502,10 +1502,6 @@ Size Menu::ImplCalcSize( vcl::Window* pWin )
|
|||||||
{
|
{
|
||||||
Size aImgSz = pData->aImage.GetSizePixel();
|
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.Height() += 4; // add a border for native marks
|
||||||
aImgSz.Width() += 4; // add a border for native marks
|
aImgSz.Width() += 4; // add a border for native marks
|
||||||
if ( aImgSz.Width() > aMaxImgSz.Width() )
|
if ( aImgSz.Width() > aMaxImgSz.Width() )
|
||||||
@@ -1957,13 +1953,6 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext,
|
|||||||
|
|
||||||
Image aImage = pData->aImage;
|
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 = aOuterCheckRect.TopLeft();
|
||||||
aTmpPos.X() += (aOuterCheckRect.GetWidth() - aImage.GetSizePixel().Width()) / 2;
|
aTmpPos.X() += (aOuterCheckRect.GetWidth() - aImage.GetSizePixel().Width()) / 2;
|
||||||
aTmpPos.Y() += (aOuterCheckRect.GetHeight() - aImage.GetSizePixel().Height()) / 2;
|
aTmpPos.Y() += (aOuterCheckRect.GetHeight() - aImage.GetSizePixel().Height()) / 2;
|
||||||
|
@@ -951,20 +951,6 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
|
|||||||
Size aOldSize = pItem->maImage.GetSizePixel();
|
Size aOldSize = pItem->maImage.GetSizePixel();
|
||||||
|
|
||||||
pItem->maImageOriginal = aImage;
|
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;
|
pItem->maImage = aImage;
|
||||||
|
|
||||||
// only once all is calculated, do extra work
|
// only once all is calculated, do extra work
|
||||||
|
Reference in New Issue
Block a user