diff options
author | tsepez <tsepez@chromium.org> | 2016-05-19 17:14:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-19 17:14:41 -0700 |
commit | d77f417f0c82f16b4f370b913b80dd2b8dcf0f67 (patch) | |
tree | 6ba1f5537ae7122bd888410ae494b37d0e453e62 /xfa/fxfa/app/xfa_ffdocview.cpp | |
parent | bc2f0c5c4e3bbb5f317c29716c2b94af03c38329 (diff) | |
download | pdfium-d77f417f0c82f16b4f370b913b80dd2b8dcf0f67.tar.xz |
Remove CFX_MapPtrToPtr in xfa_ffdocview.h
Review-Url: https://codereview.chromium.org/1993313005
Diffstat (limited to 'xfa/fxfa/app/xfa_ffdocview.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdocview.cpp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index faf5c8baff..d8543fa511 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -540,42 +540,31 @@ FX_BOOL CXFA_FFDocView::IsUpdateLocked() { return m_iLock; } void CXFA_FFDocView::ClearInvalidateList() { - FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); - while (ps) { - void* pPageView = NULL; - CFX_RectF* pRect = NULL; - m_mapPageInvalidate.GetNextAssoc(ps, pPageView, (void*&)pRect); - delete pRect; - } - m_mapPageInvalidate.RemoveAll(); + m_mapPageInvalidate.clear(); } void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate) { AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); } + void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rtInvalidate) { - CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); - if (!pRect) { - pRect = new CFX_RectF; - pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, - rtInvalidate.height); - m_mapPageInvalidate.SetAt(pPageView, pRect); - } else { - pRect->Union(rtInvalidate); + if (m_mapPageInvalidate[pPageView]) { + m_mapPageInvalidate[pPageView]->Union(rtInvalidate); + return; } + CFX_RectF* pRect = new CFX_RectF; + pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, + rtInvalidate.height); + m_mapPageInvalidate[pPageView].reset(pRect); } + void CXFA_FFDocView::RunInvalidate() { - FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); - while (ps) { - CXFA_FFPageView* pPageView = NULL; - CFX_RectF* pRect = NULL; - m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); - m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); - delete pRect; - } - m_mapPageInvalidate.RemoveAll(); + for (const auto& pair : m_mapPageInvalidate) + m_pDoc->GetDocProvider()->InvalidateRect(pair.first, *pair.second); + m_mapPageInvalidate.clear(); } + FX_BOOL CXFA_FFDocView::RunLayout() { LockUpdate(); m_bInLayoutStatus = TRUE; |