vcl/win/gdi/salnativewidgets-luna.cxx | 51 +++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 13 deletions(-)
New commits: commit b160db926b574b7e9d6696d49dbbce8dd289aade Author: Miklos Vajna <[email protected]> Date: Mon May 14 09:34:52 2018 +0200 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 <[email protected]> Tested-by: Jenkins <[email protected]> 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())) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
