diff options
author | weili <weili@chromium.org> | 2016-06-14 17:21:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-14 17:21:14 -0700 |
commit | f4bb580add3824196dc49cd7de2f7d051019ede8 (patch) | |
tree | 15c1db6fb7000330d48c105c66acf1d468ba56bd /core/fpdfdoc/pdf_vt.h | |
parent | ee2abec93f22bd10522181dc0362f24d389fc66b (diff) | |
download | pdfium-f4bb580add3824196dc49cd7de2f7d051019ede8.tar.xz |
Make code compile with clang_use_chrome_plugin (part II)
This change contains files in core directory which were not covered
in part I. This is part of the efforts to make PDFium code compilable
by Clang chromium style plugins.
The changes are mainly the following:
-- move inline constructor/destructor of complex class/struct out-of-line;
-- add constructor/destructor of complex class/struct if not
explicitly defined;
-- add explicit out-of-line copy constructor when needed;
-- move inline virtual functions out-of-line;
-- Properly mark virtual functions with 'override';
-- some minor cleanups;
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2060913003
Diffstat (limited to 'core/fpdfdoc/pdf_vt.h')
-rw-r--r-- | core/fpdfdoc/pdf_vt.h | 60 |
1 files changed, 11 insertions, 49 deletions
diff --git a/core/fpdfdoc/pdf_vt.h b/core/fpdfdoc/pdf_vt.h index 3f06f7d6d6..71e28daad9 100644 --- a/core/fpdfdoc/pdf_vt.h +++ b/core/fpdfdoc/pdf_vt.h @@ -49,54 +49,16 @@ class CLine final { CPVT_LineInfo m_LineInfo; }; -class CLines final { - public: - CLines() : m_nTotal(0) {} - ~CLines() { RemoveAll(); } - - int32_t GetSize() const { return m_Lines.GetSize(); } - CLine* GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); } - void Empty() { m_nTotal = 0; } - void RemoveAll() { - for (int32_t i = 0, sz = GetSize(); i < sz; i++) { - delete GetAt(i); - } - m_Lines.RemoveAll(); - m_nTotal = 0; - } - int32_t Add(const CPVT_LineInfo& lineinfo) { - if (m_nTotal >= GetSize()) { - CLine* pLine = new CLine; - pLine->m_LineInfo = lineinfo; - m_Lines.Add(pLine); - } else if (CLine* pLine = GetAt(m_nTotal)) { - pLine->m_LineInfo = lineinfo; - } - return m_nTotal++; - } - void Clear() { - for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) { - delete GetAt(i); - m_Lines.RemoveAt(i); - } - } - - private: - CPVT_ArrayTemplate<CLine*> m_Lines; - int32_t m_nTotal; -}; - class CPDF_EditContainer { public: - CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {} - virtual ~CPDF_EditContainer() {} + CPDF_EditContainer(); + virtual ~CPDF_EditContainer(); + + virtual void SetPlateRect(const CFX_FloatRect& rect); + virtual const CFX_FloatRect& GetPlateRect() const; + virtual void SetContentRect(const CPVT_FloatRect& rect); + virtual CFX_FloatRect GetContentRect() const; - virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; } - virtual const CFX_FloatRect& GetPlateRect() const { return m_rcPlate; } - virtual void SetContentRect(const CPVT_FloatRect& rect) { - m_rcContent = rect; - } - virtual CFX_FloatRect GetContentRect() const { return m_rcContent; } FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } CFX_SizeF GetPlateSize() const { @@ -108,20 +70,20 @@ class CPDF_EditContainer { CFX_FloatPoint GetETPoint() const { return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); } - inline CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const { + CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const { return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); } - inline CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const { + CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const { return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } - inline CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const { + CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const { CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top)); CFX_FloatPoint ptRightBottom = InToOut(CFX_FloatPoint(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } - inline CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const { + CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const { CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top)); CFX_FloatPoint ptRightBottom = OutToIn(CFX_FloatPoint(rect.right, rect.bottom)); |