diff options
Diffstat (limited to 'core/fpdftext/cpdf_textpage.cpp')
-rw-r--r-- | core/fpdftext/cpdf_textpage.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 411ba398ae..77eae4de75 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -551,11 +551,13 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation() if (!pPageObj->IsText()) continue; - int32_t minH = std::max(static_cast<int32_t>(pPageObj->m_Left), 0); + int32_t minH = std::max(static_cast<int32_t>(pPageObj->GetRect().left), 0); int32_t maxH = - std::min(static_cast<int32_t>(pPageObj->m_Right), nPageWidth); - int32_t minV = std::max(static_cast<int32_t>(pPageObj->m_Bottom), 0); - int32_t maxV = std::min(static_cast<int32_t>(pPageObj->m_Top), nPageHeight); + std::min(static_cast<int32_t>(pPageObj->GetRect().right), nPageWidth); + int32_t minV = + std::max(static_cast<int32_t>(pPageObj->GetRect().bottom), 0); + int32_t maxV = + std::min(static_cast<int32_t>(pPageObj->GetRect().top), nPageHeight); if (minH >= maxH || minV >= maxV) continue; @@ -570,7 +572,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation() nEndV = std::max(nEndV, maxV); if (fLineHeight <= 0.0f) - fLineHeight = pPageObj->m_Top - pPageObj->m_Bottom; + fLineHeight = pPageObj->GetRect().Height(); } const int32_t nDoubleLineHeight = 2 * fLineHeight; if ((nEndV - nStartV) < nDoubleLineHeight) @@ -751,7 +753,7 @@ void CPDF_TextPage::ProcessTextObject( const CFX_Matrix& formMatrix, const CPDF_PageObjectList* pObjList, CPDF_PageObjectList::const_iterator ObjPos) { - if (fabs(pTextObj->m_Right - pTextObj->m_Left) < kSizeEpsilon) + if (fabs(pTextObj->GetRect().Width()) < kSizeEpsilon) return; size_t count = m_LineObj.size(); @@ -943,7 +945,7 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend, void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { CPDF_TextObject* pTextObj = Obj.m_pTextObj.Get(); - if (fabs(pTextObj->m_Right - pTextObj->m_Left) < kSizeEpsilon) + if (fabs(pTextObj->GetRect().Width()) < kSizeEpsilon) return; CFX_Matrix formMatrix = Obj.m_formMatrix; CPDF_Font* pFont = pTextObj->GetFont(); @@ -1244,8 +1246,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( CPDF_TextObjectItem item; pObj->GetItemInfo(0, &item); - CFX_FloatRect this_rect = pObj->GetRect(); - CFX_FloatRect prev_rect = m_pPreTextObj->GetRect(); + const CFX_FloatRect& this_rect = pObj->GetRect(); + const CFX_FloatRect& prev_rect = m_pPreTextObj->GetRect(); WideString wstrItem = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode); if (wstrItem.IsEmpty()) @@ -1299,14 +1301,16 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( m_DisplayMatrix.a > 0.9 && m_DisplayMatrix.b < 0.1 && m_DisplayMatrix.c < 0.1 && m_DisplayMatrix.d < -0.9 && m.b < 0.1 && m.c < 0.1) { - CFX_FloatRect re(0, m_pPreTextObj->m_Bottom, 1000, - m_pPreTextObj->m_Top); + CFX_FloatRect re(0, m_pPreTextObj->GetRect().bottom, 1000, + m_pPreTextObj->GetRect().top); if (re.Contains(pObj->GetPos())) { bNewline = false; } else { - if (CFX_FloatRect(0, pObj->m_Bottom, 1000, pObj->m_Top) - .Contains(m_pPreTextObj->GetPos())) + if (CFX_FloatRect(0, pObj->GetRect().bottom, 1000, + pObj->GetRect().top) + .Contains(m_pPreTextObj->GetPos())) { bNewline = false; + } } } } @@ -1356,7 +1360,7 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1, return false; CFX_FloatRect rcPreObj = pTextObj2->GetRect(); - CFX_FloatRect rcCurObj = pTextObj1->GetRect(); + const CFX_FloatRect& rcCurObj = pTextObj1->GetRect(); if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) { float dbXdif = fabs(rcPreObj.left - rcCurObj.left); size_t nCount = m_CharList.size(); |