summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-05-14 09:34:52 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-05-14 10:34:25 +0200
commitb160db926b574b7e9d6696d49dbbce8dd289aade (patch)
treed444472219dd4fb60c4ea2afae3df2bafb1830a4
parent66561e30bf96167dfaf9c5215a46c75a14209e9c (diff)
tdf#96947 vcl opengl win: fix background of menu items w/ check/radio marks
Extract the actually used bounding box from the rendering code and reuse that for OpenGL texture purposes, so the available and the used size can't mismatch. The background itself is almost invisible, but the borders were lost due to this size difference. Change-Id: I31b3e5aa0c0106461b90bfaab3a84d45b33afd71 Reviewed-on: https://gerrit.libreoffice.org/54298 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx51
1 files changed, 38 insertions, 13 deletions
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index e7f9ab232c42..e295264a9890 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -498,6 +498,31 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal )
}
}
+/**
+ * Gives the actual rectangle used for rendering by ControlType::MenuPopup's
+ * ControlPart::MenuItemCheckMark or ControlPart::MenuItemRadioMark.
+ */
+static tools::Rectangle GetMenuPopupMarkRegion(const ImplControlValue& rValue)
+{
+ tools::Rectangle aRet;
+
+ const MenupopupValue& rMVal(static_cast<const MenupopupValue&>(rValue));
+ aRet.SetTop(rMVal.maItemRect.Top());
+ aRet.SetBottom(rMVal.maItemRect.Bottom() + 1); // see below in drawNativeControl
+ if (AllSettings::GetLayoutRTL())
+ {
+ aRet.SetRight(rMVal.maItemRect.Right() + 1);
+ aRet.SetLeft(aRet.Right() - (rMVal.getNumericVal() - rMVal.maItemRect.Left()));
+ }
+ else
+ {
+ aRet.SetRight(rMVal.getNumericVal());
+ aRet.SetLeft(rMVal.maItemRect.Left());
+ }
+
+ return aRet;
+}
+
bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
ControlType nType,
ControlPart nPart,
@@ -1088,19 +1113,11 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
RECT aBGRect = rc;
if( aValue.getType() == ControlType::MenuPopup )
{
- const MenupopupValue& rMVal( static_cast<const MenupopupValue&>(aValue) );
- aBGRect.top = rMVal.maItemRect.Top();
- aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl
- if( AllSettings::GetLayoutRTL() )
- {
- aBGRect.right = rMVal.maItemRect.Right()+1;
- aBGRect.left = aBGRect.right - (rMVal.getNumericVal()-rMVal.maItemRect.Left());
- }
- else
- {
- aBGRect.right = rMVal.getNumericVal();
- aBGRect.left = rMVal.maItemRect.Left();
- }
+ tools::Rectangle aRectangle = GetMenuPopupMarkRegion(aValue);
+ aBGRect.top = aRectangle.Top();
+ aBGRect.left = aRectangle.Left();
+ aBGRect.bottom = aRectangle.Bottom();
+ aBGRect.right = aRectangle.Right();
rc = aBGRect;
}
iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : MCB_DISABLED;
@@ -1164,6 +1181,14 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
}
}
+ if (pImpl && nType == ControlType::MenuPopup && (nPart == ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark))
+ {
+ cacheRect = GetMenuPopupMarkRegion(aValue);
+ buttonRect = cacheRect;
+ keySize = cacheRect.GetSize();
+ }
+
+
ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize);
if (pImpl != nullptr && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top()))
{