summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-12-01 20:42:47 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-12-02 23:20:55 +0100
commit5346168fa919ad98224c4d2079e738a4d0b8d164 (patch)
treeba0e867e54eed3f47ed67cb660fad99d72ceaf84
parent37892b97d00de29a86c735aaaff47c12e66e78ad (diff)
undo "allow vcl gen menus to have non-square images"
This reverts commit 06f36cc7ca8fc056dd8cf4d8cdbe682f9a003cef ended up not using this so don't need the extra complexity Change-Id: I64a2d6f620cc864a75523be6612c5cf2086f7a00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126210 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/window/menu.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 7df1de185cde..68e01be87c65 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1422,8 +1422,6 @@ void Menu::ImplRemoveDel( ImplMenuDelData& rDel )
}
}
-constexpr int ImageBorder = 4;
-
Size Menu::ImplCalcSize( vcl::Window* pWin )
{
// | Check/Radio/Image| Text| Accel/Popup|
@@ -1490,8 +1488,8 @@ Size Menu::ImplCalcSize( vcl::Window* pWin )
{
Size aImgSz = pData->aImage.GetSizePixel();
- aImgSz.AdjustHeight(ImageBorder); // add a border for native marks
- aImgSz.AdjustWidth(ImageBorder); // add a border for native marks
+ aImgSz.AdjustHeight(4 ); // add a border for native marks
+ aImgSz.AdjustWidth(4 ); // add a border for native marks
if ( aImgSz.Width() > aMaxImgSz.Width() )
aMaxImgSz.setWidth( aImgSz.Width() );
if ( aImgSz.Height() > aMaxImgSz.Height() )
@@ -1923,16 +1921,12 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize,
// Image:
if (!bLayout && !IsMenuBar() && ((pData->eType == MenuItemType::IMAGE) || (pData->eType == MenuItemType::STRINGIMAGE)))
{
- Image aImage = pData->aImage;
-
- auto nImgWidth = aImage.GetSizePixel().Width() + ImageBorder;
- if (nImgWidth > aOuterCheckRect.GetWidth())
- aOuterCheckRect.setWidth(nImgWidth);
-
// Don't render an image for a check thing
if (pData->bChecked)
ImplPaintCheckBackground(rRenderContext, *pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted);
+ Image aImage = pData->aImage;
+
aTmpPos = aOuterCheckRect.TopLeft();
aTmpPos.AdjustX((aOuterCheckRect.GetWidth() - aImage.GetSizePixel().Width()) / 2 );
aTmpPos.AdjustY((aOuterCheckRect.GetHeight() - aImage.GetSizePixel().Height()) / 2 );