diff options
author | dan sinclair <dsinclair@chromium.org> | 2018-03-09 22:53:31 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-09 22:53:31 +0000 |
commit | 0d0d3ad30ca8ec3d0bd04a92f89882409c1a14ff (patch) | |
tree | 4d570bcf692cbf902123f3305528182949048da9 | |
parent | 69da36c5f841e8c6e5ded6c704d9ef58c57d532a (diff) | |
download | pdfium-0d0d3ad30ca8ec3d0bd04a92f89882409c1a14ff.tar.xz |
Remove default params from CPDF_DefaultAppearance methodschromium/3368chromium/3367
This CL removes default params from CPDF_DefaultAppearance methods.
Change-Id: Iaeebc7b35ebb6140850f3f0e0828c3ae9e3c5548
Reviewed-on: https://pdfium-review.googlesource.com/28350
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | core/fpdfdoc/cpdf_defaultappearance.cpp | 39 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_defaultappearance.h | 10 |
2 files changed, 15 insertions, 34 deletions
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp index 32bdefbc32..4542c59a7d 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.cpp +++ b/core/fpdfdoc/cpdf_defaultappearance.cpp @@ -35,26 +35,19 @@ ByteString CPDF_DefaultAppearance::GetFont(float* fFontSize) { return PDF_NameDecode(csFontNameTag); } -bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) { +bool CPDF_DefaultAppearance::HasColor() { if (m_csDA.IsEmpty()) return false; CPDF_SimpleParser syntax(m_csDA.AsStringView()); - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) { + if (syntax.FindTagParamFromStart("g", 1)) return true; - } - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) { + if (syntax.FindTagParamFromStart("rg", 3)) return true; - } - return syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "K" : "k"), 4); + return syntax.FindTagParamFromStart("k", 4); } -void CPDF_DefaultAppearance::GetColor(int& iColorType, - float fc[4], - PaintOperation nOperation) { +void CPDF_DefaultAppearance::GetColor(int& iColorType, float fc[4]) { iColorType = CFX_Color::kTransparent; for (int c = 0; c < 4; c++) fc[c] = 0; @@ -63,22 +56,19 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType, return; CPDF_SimpleParser syntax(m_csDA.AsStringView()); - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) { + if (syntax.FindTagParamFromStart("g", 1)) { iColorType = CFX_Color::kGray; fc[0] = FX_atof(syntax.GetWord()); return; } - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) { + if (syntax.FindTagParamFromStart("rg", 3)) { iColorType = CFX_Color::kRGB; fc[0] = FX_atof(syntax.GetWord()); fc[1] = FX_atof(syntax.GetWord()); fc[2] = FX_atof(syntax.GetWord()); return; } - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) { + if (syntax.FindTagParamFromStart("k", 4)) { iColorType = CFX_Color::kCMYK; fc[0] = FX_atof(syntax.GetWord()); fc[1] = FX_atof(syntax.GetWord()); @@ -87,24 +77,20 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType, } } -void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, - int& iColorType, - PaintOperation nOperation) { +void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType) { color = 0; iColorType = CFX_Color::kTransparent; if (m_csDA.IsEmpty()) return; CPDF_SimpleParser syntax(m_csDA.AsStringView()); - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) { + if (syntax.FindTagParamFromStart("g", 1)) { iColorType = CFX_Color::kGray; float g = FX_atof(syntax.GetWord()) * 255 + 0.5f; color = ArgbEncode(255, (int)g, (int)g, (int)g); return; } - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) { + if (syntax.FindTagParamFromStart("rg", 3)) { iColorType = CFX_Color::kRGB; float r = FX_atof(syntax.GetWord()) * 255 + 0.5f; float g = FX_atof(syntax.GetWord()) * 255 + 0.5f; @@ -112,8 +98,7 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, color = ArgbEncode(255, (int)r, (int)g, (int)b); return; } - if (syntax.FindTagParamFromStart( - (nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) { + if (syntax.FindTagParamFromStart("k", 4)) { iColorType = CFX_Color::kCMYK; float c = FX_atof(syntax.GetWord()); float m = FX_atof(syntax.GetWord()); diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h index 13e6307339..f27856ae4e 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.h +++ b/core/fpdfdoc/cpdf_defaultappearance.h @@ -30,13 +30,9 @@ class CPDF_DefaultAppearance { bool HasFont(); ByteString GetFont(float* fFontSize); - bool HasColor(PaintOperation nOperation = PaintOperation::FILL); - void GetColor(int& iColorType, - float fc[4], - PaintOperation nOperation = PaintOperation::FILL); - void GetColor(FX_ARGB& color, - int& iColorType, - PaintOperation nOperation = PaintOperation::FILL); + bool HasColor(); + void GetColor(int& iColorType, float fc[4]); + void GetColor(FX_ARGB& color, int& iColorType); private: ByteString m_csDA; |