summaryrefslogtreecommitdiff
path: root/xfa/fde/cfde_textout.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-14 10:26:59 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-14 14:50:00 +0000
commitdff02cee2d2410d81a55c59345fb38b5aac8a457 (patch)
treed09dfb18aeb7ae4af4ec96ab0034c6aafbcee883 /xfa/fde/cfde_textout.h
parentaeac95192c106b41c058c8372aa2ec8d0092f60b (diff)
downloadpdfium-dff02cee2d2410d81a55c59345fb38b5aac8a457.tar.xz
Cleanup FDE_TTO{STYLE|ALIGNMENT} defines.
This CL replaceds FDE_TTOSTYLE defines with a FDE_TextStyle struct which is used to set the needed flags. The FDE_TTOALIGNMENT defines are replaced with an enum class and unused members have been removed. Change-Id: Ib0e2818a82e7f1961de57f8d15703477f8235a03 Reviewed-on: https://pdfium-review.googlesource.com/10530 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/cfde_textout.h')
-rw-r--r--xfa/fde/cfde_textout.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 7424573b6b..8d99900566 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -17,28 +17,34 @@
#include "core/fxge/fx_dib.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
-#define FDE_TTOSTYLE_SingleLine 0x0010
-#define FDE_TTOSTYLE_LineWrap 0x0100
-#define FDE_TTOSTYLE_LastLineHeight 0x1000
-
-#define FDE_TTOALIGNMENT_TopLeft 0
-#define FDE_TTOALIGNMENT_TopCenter 1
-#define FDE_TTOALIGNMENT_TopRight 2
-#define FDE_TTOALIGNMENT_TopAuto 3
-#define FDE_TTOALIGNMENT_CenterLeft 4
-#define FDE_TTOALIGNMENT_Center 5
-#define FDE_TTOALIGNMENT_CenterRight 6
-#define FDE_TTOALIGNMENT_CenterAuto 7
-#define FDE_TTOALIGNMENT_BottomLeft 8
-#define FDE_TTOALIGNMENT_BottomCenter 9
-#define FDE_TTOALIGNMENT_BottomRight 10
-#define FDE_TTOALIGNMENT_BottomAuto 11
-
class CFDE_RenderDevice;
class CFX_RenderDevice;
class CFX_TxtBreak;
struct FX_TXTRUN;
+enum class FDE_TextAlignment : uint8_t {
+ kTopLeft = 0,
+ kCenterLeft,
+ kCenter,
+ kCenterRight
+};
+
+struct FDE_TextStyle {
+ FDE_TextStyle()
+ : single_line_(false), line_wrap_(false), last_line_height_(false) {}
+ ~FDE_TextStyle() {}
+
+ void Reset() {
+ single_line_ = false;
+ line_wrap_ = false;
+ last_line_height_ = false;
+ }
+
+ bool single_line_;
+ bool line_wrap_;
+ bool last_line_height_;
+};
+
struct FDE_TTOPIECE {
FDE_TTOPIECE();
FDE_TTOPIECE(const FDE_TTOPIECE& that);
@@ -77,10 +83,10 @@ class CFDE_TextOut {
void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
void SetFontSize(float fFontSize);
void SetTextColor(FX_ARGB color);
- void SetStyles(uint32_t dwStyles);
+ void SetStyles(const FDE_TextStyle& dwStyles);
void SetTabWidth(float fTabWidth);
void SetParagraphBreakChar(wchar_t wch);
- void SetAlignment(int32_t iAlignment);
+ void SetAlignment(FDE_TextAlignment iAlignment);
void SetLineSpace(float fLineSpace);
void SetDIBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIB);
void SetRenderDevice(CFX_RenderDevice* pDevice);
@@ -137,12 +143,12 @@ class CFDE_TextOut {
float m_fLineSpace;
float m_fLinePos;
float m_fTolerance;
- int32_t m_iAlignment;
+ FDE_TextAlignment m_iAlignment;
+ FDE_TextStyle m_Styles;
int32_t m_iTxtBkAlignment;
std::vector<int32_t> m_CharWidths;
wchar_t m_wParagraphBkChar;
FX_ARGB m_TxtColor;
- uint32_t m_dwStyles;
uint32_t m_dwTxtBkStyles;
CFX_WideString m_wsText;
CFX_RectF m_rtClip;