summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-28 18:43:55 +0900
committerJan Holesovsky <kendy@collabora.com>2015-05-29 20:16:54 +0200
commit22e168424d774fb29dd9a77664bc1d2d6833c40b (patch)
treeb1eb165e2776a873307412fd154cd2cc3deacbf9 /svtools
parent3581b4dd6c23ab5827f6a89730909ae0fd98573d (diff)
fix highlight rendering for iconview with more effective clipping
Change-Id: I9d8f2341477b9b9c0acd71a7d33cd5a9a55757d2 Signed-off-by: Jan Holesovsky <kendy@collabora.com>
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 51dc4bbf4441..a6cf4575545d 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -671,13 +671,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());
@@ -709,15 +704,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()
{
@@ -1699,7 +1706,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);
@@ -3583,12 +3592,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);
}
}
@@ -3598,9 +3615,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* )