summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-28 18:43:55 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-28 18:56:01 +0900
commit8400e87a41b5613f2fcf27525b97b40f653a3178 (patch)
tree98ec97bffa274ba9c96fbac1b27ba43c29b3054f /svtools
parent02482eef0189e6c9f6ea233d495c9fd8a0d2a877 (diff)
fix highlight rendering for iconview with more effective clipping
Change-Id: I9d8f2341477b9b9c0acd71a7d33cd5a9a55757d2
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/contnr/imivctl1.cxx58
1 files changed, 38 insertions, 20 deletions
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 51ba7a448e8a..07221d55d7cf 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -663,13 +663,8 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
if (!nCount)
return;
- bool bResetClipRegion = false;
- if (!rRenderContext.IsClipRegion())
- {
- vcl::Region const aOutputArea(GetOutputRect());
- bResetClipRegion = true;
- rRenderContext.SetClipRegion(aOutputArea);
- }
+ rRenderContext.Push(PushFlags::CLIPREGION);
+ rRenderContext.SetClipRegion(vcl::Region(rRect));
SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl();
boost::scoped_ptr<SvxIconChoiceCtrlEntryList_impl> pPaintedEntries(new SvxIconChoiceCtrlEntryList_impl());
@@ -701,15 +696,27 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
}
pPaintedEntries.reset();
- if (bResetClipRegion)
- rRenderContext.SetClipRegion();
+ rRenderContext.Pop();
}
-void SvxIconChoiceCtrl_Impl::RepaintEntries(SvxIconViewFlags /*nEntryFlagsMask*/)
+void SvxIconChoiceCtrl_Impl::RepaintEntries(SvxIconViewFlags nEntryFlagsMask)
{
- pView->Invalidate();
-}
+ const size_t nCount = pZOrderList->size();
+ if (!nCount)
+ return;
+ Rectangle aOutRect(GetOutputRect());
+ for (size_t nCur = 0; nCur < nCount; nCur++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[nCur];
+ if (pEntry->GetFlags() & nEntryFlagsMask)
+ {
+ const Rectangle& rBoundRect = GetEntryBoundRect(pEntry);
+ if (aOutRect.IsOver(rBoundRect))
+ pView->Invalidate(rBoundRect);
+ }
+ }
+}
void SvxIconChoiceCtrl_Impl::InitScrollBarBox()
{
@@ -1691,7 +1698,9 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
PaintEmphasis(aTextRect, aBmpRect, bSelected, bDropTarget, bCursored, rRenderContext, bIsBackgroundPainted);
if ( bShowSelection )
- pView->DrawSelectionBackground(CalcFocusRect(pEntry), bActiveSelection ? 1 : 2, false, true, false);
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *pView.get(), CalcFocusRect(pEntry),
+ bActiveSelection ? 1 : 2, false, true, false);
+
PaintItem(aBmpRect, IcnViewFieldTypeImage, pEntry, nBmpPaintFlags, rRenderContext);
@@ -3575,12 +3584,20 @@ void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEn
if( !bKeepHighlightFlags )
bHighlightFramePressed = false;
- HideEntryHighlightFrame();
+ if (pCurHighlightFrame)
+ {
+ Rectangle aInvalidationRect(GetEntryBoundRect(pCurHighlightFrame));
+ aInvalidationRect.expand(5);
+ pCurHighlightFrame = nullptr;
+ pView->Invalidate(aInvalidationRect);
+ }
+
pCurHighlightFrame = pEntry;
- if( pEntry )
+ if (pEntry)
{
- Rectangle aBmpRect(CalcFocusRect(pEntry));
- pView->Invalidate(aBmpRect);
+ Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
+ aInvalidationRect.expand(5);
+ pView->Invalidate(aInvalidationRect);
}
}
@@ -3590,9 +3607,10 @@ void SvxIconChoiceCtrl_Impl::HideEntryHighlightFrame()
return;
SvxIconChoiceCtrlEntry* pEntry = pCurHighlightFrame;
- pCurHighlightFrame = 0;
- Rectangle aBmpRect(CalcFocusRect(pEntry));
- pView->Invalidate(aBmpRect);
+ pCurHighlightFrame = nullptr;
+ Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
+ aInvalidationRect.expand(5);
+ pView->Invalidate(aInvalidationRect);
}
void SvxIconChoiceCtrl_Impl::CallSelectHandler( SvxIconChoiceCtrlEntry* )