diff options
author | Nicolas Pena <npm@chromium.org> | 2017-02-13 16:08:51 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-13 22:07:02 +0000 |
commit | 58e4c5ac24a88f83d1ba8277dee87baf4cba36a0 (patch) | |
tree | 5c6c05ffb40c1bb2653b415842537f7043bd6407 /core/fpdfapi/page/cpdf_textobject.h | |
parent | 9787a7441a905e582b10d9ffc425098b3233d36c (diff) | |
download | pdfium-58e4c5ac24a88f83d1ba8277dee87baf4cba36a0.tar.xz |
Clean up CPDF_TextObject a bit
Modernizing CPDF_TextObject a little bit, in preparation for the addition of
APIs for adding text to PDFs. m_pCharCodes, m_pCharPos are now vectors, this
caused some propagation to other classes. Also m_Pos is now a point. Note that
GetItemInfo is being changed in another CL, so did minimal changes there.
Change-Id: I6e5f19b5d45872e3e714a7cb587c81c92e640ea3
Reviewed-on: https://pdfium-review.googlesource.com/2614
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_textobject.h')
-rw-r--r-- | core/fpdfapi/page/cpdf_textobject.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h index 7445f0d110..9e763a164e 100644 --- a/core/fpdfapi/page/cpdf_textobject.h +++ b/core/fpdfapi/page/cpdf_textobject.h @@ -8,6 +8,7 @@ #define CORE_FPDFAPI_PAGE_CPDF_TEXTOBJECT_H_ #include <memory> +#include <vector> #include "core/fpdfapi/page/cpdf_pageobject.h" #include "core/fxcrt/fx_string.h" @@ -38,7 +39,7 @@ class CPDF_TextObject : public CPDF_PageObject { int CountItems() const; void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const; int CountChars() const; - void GetCharInfo(int index, uint32_t& charcode, FX_FLOAT& kerning) const; + void GetCharInfo(int index, uint32_t* charcode, FX_FLOAT* kerning) const; void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const; FX_FLOAT GetCharWidth(uint32_t charcode) const; @@ -53,22 +54,22 @@ class CPDF_TextObject : public CPDF_PageObject { void RecalcPositionData(); - protected: + private: friend class CPDF_RenderStatus; friend class CPDF_StreamContentParser; friend class CPDF_TextRenderer; - void SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nSegs); + void SetSegments(const CFX_ByteString* pStrs, + const FX_FLOAT* pKerning, + int nSegs); void CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextAdvanceY, FX_FLOAT horz_scale); - FX_FLOAT m_PosX; - FX_FLOAT m_PosY; - int m_nChars; - uint32_t* m_pCharCodes; - FX_FLOAT* m_pCharPos; + CFX_PointF m_Pos; + std::vector<uint32_t> m_CharCodes; + std::vector<FX_FLOAT> m_CharPos; }; #endif // CORE_FPDFAPI_PAGE_CPDF_TEXTOBJECT_H_ |