| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/include/xfa_ffdocview.h" | 7 #include "xfa/fxfa/include/xfa_ffdocview.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" | 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 void CXFA_FFDocView::LockUpdate() { | 533 void CXFA_FFDocView::LockUpdate() { |
| 534 m_iLock++; | 534 m_iLock++; |
| 535 } | 535 } |
| 536 void CXFA_FFDocView::UnlockUpdate() { | 536 void CXFA_FFDocView::UnlockUpdate() { |
| 537 m_iLock--; | 537 m_iLock--; |
| 538 } | 538 } |
| 539 FX_BOOL CXFA_FFDocView::IsUpdateLocked() { | 539 FX_BOOL CXFA_FFDocView::IsUpdateLocked() { |
| 540 return m_iLock; | 540 return m_iLock; |
| 541 } | 541 } |
| 542 void CXFA_FFDocView::ClearInvalidateList() { | 542 void CXFA_FFDocView::ClearInvalidateList() { |
| 543 FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); | 543 m_mapPageInvalidate.clear(); |
| 544 while (ps) { | |
| 545 void* pPageView = NULL; | |
| 546 CFX_RectF* pRect = NULL; | |
| 547 m_mapPageInvalidate.GetNextAssoc(ps, pPageView, (void*&)pRect); | |
| 548 delete pRect; | |
| 549 } | |
| 550 m_mapPageInvalidate.RemoveAll(); | |
| 551 } | 544 } |
| 552 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, | 545 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, |
| 553 const CFX_RectF& rtInvalidate) { | 546 const CFX_RectF& rtInvalidate) { |
| 554 AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); | 547 AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); |
| 555 } | 548 } |
| 549 |
| 556 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, | 550 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, |
| 557 const CFX_RectF& rtInvalidate) { | 551 const CFX_RectF& rtInvalidate) { |
| 558 CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); | 552 if (m_mapPageInvalidate[pPageView]) { |
| 559 if (!pRect) { | 553 m_mapPageInvalidate[pPageView]->Union(rtInvalidate); |
| 560 pRect = new CFX_RectF; | 554 return; |
| 561 pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, | |
| 562 rtInvalidate.height); | |
| 563 m_mapPageInvalidate.SetAt(pPageView, pRect); | |
| 564 } else { | |
| 565 pRect->Union(rtInvalidate); | |
| 566 } | 555 } |
| 556 CFX_RectF* pRect = new CFX_RectF; |
| 557 pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, |
| 558 rtInvalidate.height); |
| 559 m_mapPageInvalidate[pPageView].reset(pRect); |
| 567 } | 560 } |
| 561 |
| 568 void CXFA_FFDocView::RunInvalidate() { | 562 void CXFA_FFDocView::RunInvalidate() { |
| 569 FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); | 563 for (const auto& pair : m_mapPageInvalidate) |
| 570 while (ps) { | 564 m_pDoc->GetDocProvider()->InvalidateRect(pair.first, *pair.second); |
| 571 CXFA_FFPageView* pPageView = NULL; | 565 m_mapPageInvalidate.clear(); |
| 572 CFX_RectF* pRect = NULL; | |
| 573 m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); | |
| 574 m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); | |
| 575 delete pRect; | |
| 576 } | |
| 577 m_mapPageInvalidate.RemoveAll(); | |
| 578 } | 566 } |
| 567 |
| 579 FX_BOOL CXFA_FFDocView::RunLayout() { | 568 FX_BOOL CXFA_FFDocView::RunLayout() { |
| 580 LockUpdate(); | 569 LockUpdate(); |
| 581 m_bInLayoutStatus = TRUE; | 570 m_bInLayoutStatus = TRUE; |
| 582 if (!m_pXFADocLayout->IncrementLayout() && | 571 if (!m_pXFADocLayout->IncrementLayout() && |
| 583 m_pXFADocLayout->StartLayout() < 100) { | 572 m_pXFADocLayout->StartLayout() < 100) { |
| 584 m_pXFADocLayout->DoLayout(); | 573 m_pXFADocLayout->DoLayout(); |
| 585 UnlockUpdate(); | 574 UnlockUpdate(); |
| 586 m_bInLayoutStatus = FALSE; | 575 m_bInLayoutStatus = FALSE; |
| 587 m_pDoc->GetDocProvider()->PageViewEvent(nullptr, | 576 m_pDoc->GetDocProvider()->PageViewEvent(nullptr, |
| 588 XFA_PAGEVIEWEVENT_StopLayout); | 577 XFA_PAGEVIEWEVENT_StopLayout); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { | 887 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { |
| 899 return NULL; | 888 return NULL; |
| 900 } | 889 } |
| 901 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { | 890 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { |
| 902 return FALSE; | 891 return FALSE; |
| 903 } | 892 } |
| 904 void CXFA_WidgetAccIterator::SkipTree() { | 893 void CXFA_WidgetAccIterator::SkipTree() { |
| 905 m_ContentIterator.SkipChildrenAndMoveToNext(); | 894 m_ContentIterator.SkipChildrenAndMoveToNext(); |
| 906 m_pCurWidgetAcc = NULL; | 895 m_pCurWidgetAcc = NULL; |
| 907 } | 896 } |
| OLD | NEW |