diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2014-12-31 17:25:05 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-04 20:40:43 +0900 |
commit | 7431bc263aa8411eb2934c8aefd2c222d5f83b28 (patch) | |
tree | d3255ba062efd57ec088f8bb6e09e15f7a17d3ad | |
parent | 8c639609984ffb7977934ce0575bbc1a1df7dee4 (diff) |
Draw a rect in the uncovered region of the native scrollbar
When the requested region is larger than the native scrollbar the
uncovered regions need to be drawn with a background color to
avoid artifacts.
This situation can happen when the TabBar is inline with scrollbar
when the width of the TabBar is greater than the width of the
scrollbar. Inline TabBar support is added in a later commit.
Change-Id: I70cb2e5bfd8d79401f77bbe55abe596adc160194
-rw-r--r-- | vcl/source/control/scrbar.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 06920fe036bc..e5a601fc794a 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -502,6 +502,20 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags ) aCtrlRegion.Union( maPage1Rect ); aCtrlRegion.Union( maPage2Rect ); aCtrlRegion.Union( maThumbRect ); + + Rectangle aRequestedRegion(Point(0,0), GetOutputSizePixel()); + // if the actual native control region is smaller then the region that + // we requested the control to draw in, then draw a background rectangle + // to avoid drawing artifacts in the uncovered region + if (aCtrlRegion.GetWidth() < aRequestedRegion.GetWidth() || + aCtrlRegion.GetHeight() < aRequestedRegion.GetHeight()) + { + Color aFaceColor = GetSettings().GetStyleSettings().GetFaceColor(); + SetFillColor(aFaceColor); + SetLineColor(aFaceColor); + DrawRect(aRequestedRegion); + } + bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, (bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT), aCtrlRegion, nState, scrValue, OUString() ); } @@ -613,7 +627,7 @@ void ScrollBar::ImplDraw( sal_uInt16 nDrawFlags, OutputDevice* pOutDev ) { DecorationView aDecoView( pOutDev ); Rectangle aTempRect; - sal_uInt16 nStyle; + sal_uInt16 nStyle; const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); SymbolType eSymbolType; bool bEnabled = IsEnabled(); |