Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: xfa/fxfa/app/xfa_ffdocview.cpp

Issue 1993313005: Remove CFX_MapPtrToPtr in xfa_ffdocview.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | xfa/fxfa/include/xfa_ffdocview.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffdocview.cpp
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index faf5c8baff853d914afbca428af8c5f6a174faca..d8543fa51140d92b8e88c024a668f75d8848d014 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;
« no previous file with comments | « no previous file | xfa/fxfa/include/xfa_ffdocview.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698