summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_utils.cpp
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-08-02 12:25:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-02 12:25:15 -0700
commitb2e63373054f0f1c3dbcdfa5e75acf2831b113f6 (patch)
tree5ff5f07b7ca26e3bfd5e814edc2ee4453db248d7 /core/fpdfdoc/doc_utils.cpp
parent448c4337f2be2523727451b265311d48e9550ee5 (diff)
downloadpdfium-b2e63373054f0f1c3dbcdfa5e75acf2831b113f6.tar.xz
Use PaintOperation instead of bFillOrStroke in CPVT_GenerateAP.
Also, use PaintOperation instead of bStrokingOperation in CPDF_DefaultAppearance. Review-Url: https://codereview.chromium.org/2197353002
Diffstat (limited to 'core/fpdfdoc/doc_utils.cpp')
-rw-r--r--core/fpdfdoc/doc_utils.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp
index 284520d150..aaaaddf0c6 100644
--- a/core/fpdfdoc/doc_utils.cpp
+++ b/core/fpdfdoc/doc_utils.cpp
@@ -117,33 +117,38 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag,
}
csFontNameTag = PDF_NameDecode(csFontNameTag);
}
-FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation) {
+FX_BOOL CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
if (m_csDA.IsEmpty()) {
return FALSE;
}
CPDF_SimpleParser syntax(m_csDA.AsStringC());
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
return TRUE;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
return TRUE;
}
- return syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4);
+ return syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "K" : "k"), 4);
}
CFX_ByteString CPDF_DefaultAppearance::GetColorString(
- FX_BOOL bStrokingOperation) {
+ PaintOperation nOperation) {
CFX_ByteString csColor;
if (m_csDA.IsEmpty()) {
return csColor;
}
CPDF_SimpleParser syntax(m_csDA.AsStringC());
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
csColor += syntax.GetWord();
csColor += " ";
csColor += syntax.GetWord();
return csColor;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
csColor += syntax.GetWord();
csColor += " ";
csColor += syntax.GetWord();
@@ -153,7 +158,8 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString(
csColor += syntax.GetWord();
return csColor;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) {
csColor += syntax.GetWord();
csColor += " ";
csColor += syntax.GetWord();
@@ -168,7 +174,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString(
}
void CPDF_DefaultAppearance::GetColor(int& iColorType,
FX_FLOAT fc[4],
- FX_BOOL bStrokingOperation) {
+ PaintOperation nOperation) {
iColorType = COLORTYPE_TRANSPARENT;
for (int c = 0; c < 4; c++) {
fc[c] = 0;
@@ -177,19 +183,22 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType,
return;
}
CPDF_SimpleParser syntax(m_csDA.AsStringC());
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
fc[0] = FX_atof(syntax.GetWord());
return;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
iColorType = COLORTYPE_RGB;
fc[0] = FX_atof(syntax.GetWord());
fc[1] = FX_atof(syntax.GetWord());
fc[2] = FX_atof(syntax.GetWord());
return;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) {
iColorType = COLORTYPE_CMYK;
fc[0] = FX_atof(syntax.GetWord());
fc[1] = FX_atof(syntax.GetWord());
@@ -199,20 +208,22 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType,
}
void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
int& iColorType,
- FX_BOOL bStrokingOperation) {
+ PaintOperation nOperation) {
color = 0;
iColorType = COLORTYPE_TRANSPARENT;
if (m_csDA.IsEmpty()) {
return;
}
CPDF_SimpleParser syntax(m_csDA.AsStringC());
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
color = ArgbEncode(255, (int)g, (int)g, (int)g);
return;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
iColorType = COLORTYPE_RGB;
FX_FLOAT r = FX_atof(syntax.GetWord()) * 255 + 0.5f;
FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
@@ -220,7 +231,8 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
color = ArgbEncode(255, (int)r, (int)g, (int)b);
return;
}
- if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) {
+ if (syntax.FindTagParamFromStart(
+ (nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) {
iColorType = COLORTYPE_CMYK;
FX_FLOAT c = FX_atof(syntax.GetWord());
FX_FLOAT m = FX_atof(syntax.GetWord());