summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp19
-rw-r--r--core/fpdftext/cpdf_textpage.h28
2 files changed, 15 insertions, 32 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index cc0c9db8a1..52b669638c 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -120,28 +120,18 @@ PDFTEXT_Obj::PDFTEXT_Obj(const PDFTEXT_Obj& that) = default;
PDFTEXT_Obj::~PDFTEXT_Obj() {}
-FPDF_CHAR_INFO::FPDF_CHAR_INFO()
- : m_Unicode(0),
- m_Charcode(0),
- m_Flag(0),
- m_FontSize(0),
- m_pTextObj(nullptr) {}
+FPDF_CHAR_INFO::FPDF_CHAR_INFO() {}
FPDF_CHAR_INFO::~FPDF_CHAR_INFO() {}
-PAGECHAR_INFO::PAGECHAR_INFO()
- : m_Index(0), m_CharCode(0), m_Unicode(0), m_Flag(0), m_pTextObj(nullptr) {}
+PAGECHAR_INFO::PAGECHAR_INFO() {}
PAGECHAR_INFO::PAGECHAR_INFO(const PAGECHAR_INFO&) = default;
PAGECHAR_INFO::~PAGECHAR_INFO() {}
CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, FPDFText_Direction flags)
- : m_pPage(pPage),
- m_parserflag(flags),
- m_pPreTextObj(nullptr),
- m_bIsParsed(false),
- m_TextlineDir(TextOrientation::Unknown) {
+ : m_pPage(pPage), m_parserflag(flags) {
m_TextBuf.EstimateSize(0, 10240);
const FX_RECT rect(0, 0, static_cast<int>(pPage->GetPageWidth()),
static_cast<int>(pPage->GetPageHeight()));
@@ -1446,9 +1436,8 @@ Optional<PAGECHAR_INFO> CPDF_TextPage::GenerateCharInfo(wchar_t unicode) {
PAGECHAR_INFO info;
info.m_Index = m_TextBuf.GetLength();
- info.m_Unicode = unicode;
- info.m_pTextObj = nullptr;
info.m_CharCode = CPDF_Font::kInvalidCharCode;
+ info.m_Unicode = unicode;
info.m_Flag = FPDFTEXT_CHAR_GENERATED;
int preWidth = 0;
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 66ece911ed..eb3950f145 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -49,31 +49,26 @@ class FPDF_CHAR_INFO {
FPDF_CHAR_INFO();
~FPDF_CHAR_INFO();
- wchar_t m_Unicode;
- wchar_t m_Charcode;
- int32_t m_Flag;
- float m_FontSize;
+ wchar_t m_Unicode = 0;
+ wchar_t m_Charcode = 0;
+ int32_t m_Flag = 0;
+ float m_FontSize = 0;
CFX_PointF m_Origin;
CFX_FloatRect m_CharBox;
UnownedPtr<CPDF_TextObject> m_pTextObj;
CFX_Matrix m_Matrix;
};
-struct FPDF_SEGMENT {
- int m_Start;
- int m_nCount;
-};
-
class PAGECHAR_INFO {
public:
PAGECHAR_INFO();
PAGECHAR_INFO(const PAGECHAR_INFO&);
~PAGECHAR_INFO();
- int m_Index;
- int m_CharCode;
- wchar_t m_Unicode;
- int32_t m_Flag;
+ int m_Index = 0;
+ int m_CharCode = 0;
+ wchar_t m_Unicode = 0;
+ int32_t m_Flag = 0;
CFX_PointF m_Origin;
CFX_FloatRect m_CharBox;
UnownedPtr<CPDF_TextObject> m_pTextObj;
@@ -94,7 +89,6 @@ class CPDF_TextPage {
CPDF_TextPage(const CPDF_Page* pPage, FPDFText_Direction flags);
~CPDF_TextPage();
- // IPDF_TextPage:
void ParseTextPage();
bool IsParsed() const { return m_bIsParsed; }
int CharIndexFromTextIndex(int TextIndex) const;
@@ -106,7 +100,7 @@ class CPDF_TextPage {
WideString GetTextByRect(const CFX_FloatRect& rect) const;
// Returns string with the text from |m_TextBuf| that are covered by the input
- // range. |start| and |count| are in terms of the m_CharIndex, so the range
+ // range. |start| and |count| are in terms of the |m_CharIndex|, so the range
// will be converted into appropriate indices.
WideString GetPageText(int start, int count) const;
WideString GetAllPageText() const { return GetPageText(0, CountChars()); }
@@ -176,11 +170,11 @@ class CPDF_TextPage {
const FPDFText_Direction m_parserflag;
UnownedPtr<CPDF_TextObject> m_pPreTextObj;
CFX_Matrix m_perMatrix;
- bool m_bIsParsed;
+ bool m_bIsParsed = false;
CFX_Matrix m_DisplayMatrix;
std::vector<CFX_FloatRect> m_SelRects;
std::vector<PDFTEXT_Obj> m_LineObj;
- TextOrientation m_TextlineDir;
+ TextOrientation m_TextlineDir = TextOrientation::Unknown;
CFX_FloatRect m_CurlineRect;
};