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
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* )
......
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