vcl/source/control/tabctrl.cxx | 2 - vcl/win/gdi/salnativewidgets-luna.cxx | 36 +++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 10 deletions(-)
New commits: commit 2966d57bdfdd40a55e31408f7da75b415e809d8e Author: Michael Meeks <michael.me...@collabora.com> Date: Wed Feb 17 21:42:37 2016 +0000 tdf#95618 - opengl - mend control regions and caching for tab headers. Some tab headers in some themes unhelpfully enlarge the control region in some states - so query the region size in advance. Sadly the control region querying is something of a train-wreck too - so only use that for CTRL_TAB_ITEMs for now. Also fix Rectangle constructor ordering. Change-Id: I5e66ec541193f5b66a656dd45d5fba67a771e132 diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 40a107d..917b637 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -847,8 +847,8 @@ void TabControl::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* p if (!bLayout && (bNativeOK = rRenderContext.IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL))) { TabitemValue tiValue(Rectangle(pItem->maRect.Left() + TAB_TABOFFSET_X, - pItem->maRect.Right() - TAB_TABOFFSET_X, pItem->maRect.Top() + TAB_TABOFFSET_Y, + pItem->maRect.Right() - TAB_TABOFFSET_X, pItem->maRect.Bottom() - TAB_TABOFFSET_Y)); if (pItem->maRect.Left() < 5) tiValue.mnAlignment |= TabitemFlags::LeftAligned; diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx index 1fa4d58..f789f17 100644 --- a/vcl/win/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/gdi/salnativewidgets-luna.cxx @@ -1162,20 +1162,35 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, * aCaption: A caption or title string (like button text etc) */ bool WinSalGraphics::drawNativeControl( ControlType nType, - ControlPart nPart, - const Rectangle& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - const OUString& aCaption ) + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const OUString& aCaption ) { bool bOk = false; HTHEME hTheme = NULL; Rectangle buttonRect = rControlRegion; + Rectangle cacheRect = rControlRegion; + Size keySize = cacheRect.GetSize(); WinOpenGLSalGraphicsImpl* pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get()); - ControlCacheKey aControlCacheKey(nType, nPart, nState, buttonRect.GetSize()); + // tdf#95618 - A few controls render outside the region they're given. + if (pImpl && nType == CTRL_TAB_ITEM) + { + Rectangle rNativeBoundingRegion; + Rectangle rNativeContentRegion; + if (getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, aCaption, + rNativeBoundingRegion, rNativeContentRegion)) + { + cacheRect = rNativeBoundingRegion; + keySize = rNativeBoundingRegion.GetSize(); + } + } + + ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize); if (pImpl != NULL && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top())) { return true; @@ -1288,18 +1303,18 @@ bool WinSalGraphics::drawNativeControl( ControlType nType, else { // We can do OpenGL - OpenGLCompatibleDC aBlackDC(*this, buttonRect.Left(), buttonRect.Top(), buttonRect.GetWidth(), buttonRect.GetHeight()); + OpenGLCompatibleDC aBlackDC(*this, cacheRect.Left(), cacheRect.Top(), cacheRect.GetWidth()+1, cacheRect.GetHeight()+1); SetTextAlign(aBlackDC.getCompatibleHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP); aBlackDC.fill(MAKE_SALCOLOR(0, 0, 0)); - OpenGLCompatibleDC aWhiteDC(*this, buttonRect.Left(), buttonRect.Top(), buttonRect.GetWidth(), buttonRect.GetHeight()); + OpenGLCompatibleDC aWhiteDC(*this, cacheRect.Left(), cacheRect.Top(), cacheRect.GetWidth()+1, cacheRect.GetHeight()+1); SetTextAlign(aWhiteDC.getCompatibleHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP); aWhiteDC.fill(MAKE_SALCOLOR(0xff, 0xff, 0xff)); if (ImplDrawNativeControl(aBlackDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr) && ImplDrawNativeControl(aWhiteDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr)) { - bOk = pImpl->RenderAndCacheNativeControl(aWhiteDC, aBlackDC, buttonRect.Left(), buttonRect.Top(), aControlCacheKey); + bOk = pImpl->RenderAndCacheNativeControl(aWhiteDC, aBlackDC, cacheRect.Left(), cacheRect.Top(), aControlCacheKey); } } @@ -1330,6 +1345,9 @@ bool WinSalGraphics::getNativeControlRegion( ControlType nType, { bool bRet = FALSE; + // FIXME: rNativeBoundingRegion has a different origin + // depending on which part is used; horrors. + HDC hDC = GetDC( mhWnd ); if( nType == CTRL_TOOLBAR ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits