Kaydet (Commit) 22e16842 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Jan Holesovsky

fix highlight rendering for iconview with more effective clipping

Change-Id: I9d8f2341477b9b9c0acd71a7d33cd5a9a55757d2
Signed-off-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 3581b4dd
...@@ -671,13 +671,8 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec ...@@ -671,13 +671,8 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
if (!nCount) if (!nCount)
return; return;
bool bResetClipRegion = false; rRenderContext.Push(PushFlags::CLIPREGION);
if (!rRenderContext.IsClipRegion()) rRenderContext.SetClipRegion(vcl::Region(rRect));
{
vcl::Region const aOutputArea(GetOutputRect());
bResetClipRegion = true;
rRenderContext.SetClipRegion(aOutputArea);
}
SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl(); SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl();
boost::scoped_ptr<SvxIconChoiceCtrlEntryList_impl> pPaintedEntries(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 ...@@ -709,15 +704,27 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
} }
pPaintedEntries.reset(); pPaintedEntries.reset();
if (bResetClipRegion) rRenderContext.Pop();
rRenderContext.SetClipRegion();
} }
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() void SvxIconChoiceCtrl_Impl::InitScrollBarBox()
{ {
...@@ -1699,7 +1706,9 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po ...@@ -1699,7 +1706,9 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
PaintEmphasis(aTextRect, aBmpRect, bSelected, bDropTarget, bCursored, rRenderContext, bIsBackgroundPainted); PaintEmphasis(aTextRect, aBmpRect, bSelected, bDropTarget, bCursored, rRenderContext, bIsBackgroundPainted);
if ( bShowSelection ) 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); PaintItem(aBmpRect, IcnViewFieldTypeImage, pEntry, nBmpPaintFlags, rRenderContext);
...@@ -3583,12 +3592,20 @@ void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEn ...@@ -3583,12 +3592,20 @@ void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEn
if( !bKeepHighlightFlags ) if( !bKeepHighlightFlags )
bHighlightFramePressed = false; bHighlightFramePressed = false;
HideEntryHighlightFrame(); if (pCurHighlightFrame)
{
Rectangle aInvalidationRect(GetEntryBoundRect(pCurHighlightFrame));
aInvalidationRect.expand(5);
pCurHighlightFrame = nullptr;
pView->Invalidate(aInvalidationRect);
}
pCurHighlightFrame = pEntry; pCurHighlightFrame = pEntry;
if( pEntry ) if (pEntry)
{ {
Rectangle aBmpRect(CalcFocusRect(pEntry)); Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
pView->Invalidate(aBmpRect); aInvalidationRect.expand(5);
pView->Invalidate(aInvalidationRect);
} }
} }
...@@ -3598,9 +3615,10 @@ void SvxIconChoiceCtrl_Impl::HideEntryHighlightFrame() ...@@ -3598,9 +3615,10 @@ void SvxIconChoiceCtrl_Impl::HideEntryHighlightFrame()
return; return;
SvxIconChoiceCtrlEntry* pEntry = pCurHighlightFrame; SvxIconChoiceCtrlEntry* pEntry = pCurHighlightFrame;
pCurHighlightFrame = 0; pCurHighlightFrame = nullptr;
Rectangle aBmpRect(CalcFocusRect(pEntry)); Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
pView->Invalidate(aBmpRect); aInvalidationRect.expand(5);
pView->Invalidate(aInvalidationRect);
} }
void SvxIconChoiceCtrl_Impl::CallSelectHandler( SvxIconChoiceCtrlEntry* ) void SvxIconChoiceCtrl_Impl::CallSelectHandler( SvxIconChoiceCtrlEntry* )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment