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/fde/cfde_txtedtpage.h" | 7 #include "xfa/fde/cfde_txtedtpage.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 IFDE_TxtEdtPage* IFDE_TxtEdtPage::Create(CFDE_TxtEdtEngine* pEngine, | 26 IFDE_TxtEdtPage* IFDE_TxtEdtPage::Create(CFDE_TxtEdtEngine* pEngine, |
27 int32_t nIndex) { | 27 int32_t nIndex) { |
28 return new CFDE_TxtEdtPage(pEngine, nIndex); | 28 return new CFDE_TxtEdtPage(pEngine, nIndex); |
29 } | 29 } |
30 | 30 |
31 CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) | 31 CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) |
32 : m_pTextSet(nullptr), | 32 : m_pTextSet(nullptr), |
| 33 m_PieceMassArr(100), |
33 m_pBgnParag(nullptr), | 34 m_pBgnParag(nullptr), |
34 m_pEndParag(nullptr), | 35 m_pEndParag(nullptr), |
35 m_nRefCount(0), | 36 m_nRefCount(0), |
36 m_nPageStart(-1), | 37 m_nPageStart(-1), |
37 m_nCharCount(0), | 38 m_nCharCount(0), |
38 m_nPageIndex(nPageIndex), | 39 m_nPageIndex(nPageIndex), |
39 m_bLoaded(FALSE), | 40 m_bLoaded(FALSE), |
40 m_pCharWidth(nullptr) { | 41 m_pCharWidth(nullptr) { |
41 FXSYS_memset(&m_rtPage, 0, sizeof(CFX_RectF)); | 42 FXSYS_memset(&m_rtPage, 0, sizeof(CFX_RectF)); |
42 FXSYS_memset(&m_rtPageMargin, 0, sizeof(CFX_RectF)); | 43 FXSYS_memset(&m_rtPageMargin, 0, sizeof(CFX_RectF)); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 m_bLoaded = TRUE; | 440 m_bLoaded = TRUE; |
440 return 0; | 441 return 0; |
441 } | 442 } |
442 | 443 |
443 void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) { | 444 void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) { |
444 ASSERT(m_nRefCount > 0); | 445 ASSERT(m_nRefCount > 0); |
445 m_nRefCount--; | 446 m_nRefCount--; |
446 if (m_nRefCount != 0) | 447 if (m_nRefCount != 0) |
447 return; | 448 return; |
448 | 449 |
449 m_PieceMassArr.RemoveAll(); | 450 m_PieceMassArr.RemoveAll(FALSE); |
450 delete m_pTextSet; | 451 delete m_pTextSet; |
451 m_pTextSet = nullptr; | 452 m_pTextSet = nullptr; |
452 delete[] m_pCharWidth; | 453 delete[] m_pCharWidth; |
453 m_pCharWidth = nullptr; | 454 m_pCharWidth = nullptr; |
454 if (m_pBgnParag) { | 455 if (m_pBgnParag) { |
455 m_pBgnParag->UnloadParag(); | 456 m_pBgnParag->UnloadParag(); |
456 m_pBgnParag = nullptr; | 457 m_pBgnParag = nullptr; |
457 } | 458 } |
458 if (m_pEndParag) { | 459 if (m_pEndParag) { |
459 m_pEndParag->UnloadParag(); | 460 m_pEndParag->UnloadParag(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 ptF.x = rtF.left; | 516 ptF.x = rtF.left; |
516 } else if (ptF.x >= rtF.right()) { | 517 } else if (ptF.x >= rtF.right()) { |
517 ptF.x = rtF.right() - fTolerance; | 518 ptF.x = rtF.right() - fTolerance; |
518 } | 519 } |
519 if (ptF.y < rtF.top) { | 520 if (ptF.y < rtF.top) { |
520 ptF.y = rtF.top; | 521 ptF.y = rtF.top; |
521 } else if (ptF.y >= rtF.bottom()) { | 522 } else if (ptF.y >= rtF.bottom()) { |
522 ptF.y = rtF.bottom() - fTolerance; | 523 ptF.y = rtF.bottom() - fTolerance; |
523 } | 524 } |
524 } | 525 } |
OLD | NEW |