summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-16 11:38:28 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-16 11:38:28 -0700
commit92cb5e580cecf0412b74d51e8863ed557e2bd47a (patch)
treeacdc33aa1bd876742ae62bd5901183413b2ead1b /core
parent719a7a71d4cf1b714ad7f76e5f9ca28cfd5b74d3 (diff)
downloadpdfium-92cb5e580cecf0412b74d51e8863ed557e2bd47a.tar.xz
Convert border style defines to an enum class.
There were two defines, BBS_ and PBS_ for the various border styles in the system. They were the same, except PBS_ had an extra SHADOW define which was never used. This CL combines both of those into a single BorderStyle enum class and updates the code as needed. Also, removes ADDBIT, GETBIT unused defines. Updates barcode code to use the util.h defines instead of redefinition. fsdk_baseannot names starting with _ were cleaned up and some #defines moved to constants. Review-Url: https://codereview.chromium.org/1980973002
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp27
-rw-r--r--core/fpdfdoc/cpvt_generateap.h11
-rw-r--r--core/fpdfdoc/include/fpdf_doc.h2
-rw-r--r--core/fxcodec/codec/fx_codec_fax.cpp5
4 files changed, 18 insertions, 27 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index adaee6363e..aa49f79c12 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -107,7 +107,8 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
rcAnnot.right - rcAnnot.left);
break;
}
- int32_t nBorderStyle = PBS_SOLID;
+
+ BorderStyle nBorderStyle = BorderStyle::SOLID;
FX_FLOAT fBorderWidth = 1;
CPVT_Dash dsBorder(3, 0, 0);
CPVT_Color crLeftTop, crRightBottom;
@@ -121,25 +122,25 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
}
switch (pBSDict->GetStringBy("S").GetAt(0)) {
case 'S':
- nBorderStyle = PBS_SOLID;
+ nBorderStyle = BorderStyle::SOLID;
break;
case 'D':
- nBorderStyle = PBS_DASH;
+ nBorderStyle = BorderStyle::DASH;
break;
case 'B':
- nBorderStyle = PBS_BEVELED;
+ nBorderStyle = BorderStyle::BEVELED;
fBorderWidth *= 2;
crLeftTop = CPVT_Color(CPVT_Color::kGray, 1);
crRightBottom = CPVT_Color(CPVT_Color::kGray, 0.5);
break;
case 'I':
- nBorderStyle = PBS_INSET;
+ nBorderStyle = BorderStyle::INSET;
fBorderWidth *= 2;
crLeftTop = CPVT_Color(CPVT_Color::kGray, 0.5);
crRightBottom = CPVT_Color(CPVT_Color::kGray, 0.75);
break;
case 'U':
- nBorderStyle = PBS_UNDERLINED;
+ nBorderStyle = BorderStyle::UNDERLINE;
break;
}
}
@@ -318,7 +319,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CFX_ByteString sButtonBorder = CPVT_GenerateAP::GenerateBorderAP(
rcButton, 2, CPVT_Color(CPVT_Color::kGray, 0),
CPVT_Color(CPVT_Color::kGray, 1),
- CPVT_Color(CPVT_Color::kGray, 0.5), PBS_BEVELED,
+ CPVT_Color(CPVT_Color::kGray, 0.5), BorderStyle::BEVELED,
CPVT_Dash(3, 0, 0));
if (sButtonBorder.GetLength() > 0)
sAppStream << "q\n" << sButtonBorder << "Q\n";
@@ -589,7 +590,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
const CPVT_Color& color,
const CPVT_Color& crLeftTop,
const CPVT_Color& crRightBottom,
- int32_t nStyle,
+ BorderStyle nStyle,
const CPVT_Dash& dash) {
CFX_ByteTextBuf sAppStream;
CFX_ByteString sColor;
@@ -601,7 +602,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
FX_FLOAT fHalfWidth = fWidth / 2.0f;
switch (nStyle) {
default:
- case PBS_SOLID:
+ case BorderStyle::SOLID:
sColor = GenerateColorAP(color, TRUE);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
@@ -613,7 +614,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
sAppStream << "f*\n";
}
break;
- case PBS_DASH:
+ case BorderStyle::DASH:
sColor = GenerateColorAP(color, FALSE);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
@@ -632,8 +633,8 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
<< " l S\n";
}
break;
- case PBS_BEVELED:
- case PBS_INSET:
+ case BorderStyle::BEVELED:
+ case BorderStyle::INSET:
sColor = GenerateColorAP(crLeftTop, TRUE);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
@@ -676,7 +677,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
<< fTop - fBottom - fHalfWidth * 2 << " re f*\n";
}
break;
- case PBS_UNDERLINED:
+ case BorderStyle::UNDERLINE:
sColor = GenerateColorAP(color, FALSE);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h
index 924de40ed4..1258643d3e 100644
--- a/core/fpdfdoc/cpvt_generateap.h
+++ b/core/fpdfdoc/cpvt_generateap.h
@@ -10,18 +10,11 @@
#include "core/fpdfdoc/cpvt_color.h"
#include "core/fpdfdoc/cpvt_dash.h"
#include "core/fpdfdoc/include/cpdf_variabletext.h"
+#include "core/fpdfdoc/include/fpdf_doc.h"
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
-// border style
-#define PBS_SOLID 0
-#define PBS_DASH 1
-#define PBS_BEVELED 2
-#define PBS_INSET 3
-#define PBS_UNDERLINED 4
-#define PBS_SHADOW 5
-
class CPDF_Dictionary;
class CPDF_Document;
class IPVT_FontMap;
@@ -48,7 +41,7 @@ class CPVT_GenerateAP {
const CPVT_Color& color,
const CPVT_Color& crLeftTop,
const CPVT_Color& crRightBottom,
- int32_t nStyle,
+ BorderStyle nStyle,
const CPVT_Dash& dash);
static CFX_ByteString GenerateColorAP(const CPVT_Color& color,
const FX_BOOL& bFillOrStroke);
diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h
index d69887bd78..8758ab9a42 100644
--- a/core/fpdfdoc/include/fpdf_doc.h
+++ b/core/fpdfdoc/include/fpdf_doc.h
@@ -48,6 +48,8 @@ class CPDF_ViewerPreferences;
class CXML_Element;
class CFX_RenderDevice;
+enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE };
+
class CPDF_NameTree {
public:
explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index 91f9eb2eb8..97b7ee2ad6 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -132,11 +132,6 @@ void FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) {
#define NEXTBIT \
src_buf[bitpos / 8] & (1 << (7 - bitpos % 8)); \
bitpos++;
-#define ADDBIT(code, bit) \
- code = code << 1; \
- if (bit) \
- code++;
-#define GETBIT(bitpos) src_buf[bitpos / 8] & (1 << (7 - bitpos % 8))
const uint8_t FaxBlackRunIns[] = {
0, 2, 0x02, 3, 0, 0x03,