summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-16 18:41:51 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-16 18:41:51 +0000
commitad729d325e06fb774637141541f3b5f2ab84c1a6 (patch)
tree42b4dddc2500deb44d8d7bf0e7a80c5a0b4147f8
parent4aa00d537a7e328c4ce23887fd93b87986e93589 (diff)
downloadpdfium-ad729d325e06fb774637141541f3b5f2ab84c1a6.tar.xz
Add Black/WhitePoint array constant in CPDF_ColorSpace.
Change-Id: I7068735efc6ac41420901e068dbd40f684bb88b8 Reviewed-on: https://pdfium-review.googlesource.com/30795 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 26b4d14227..8db74d529d 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -71,6 +71,8 @@ const uint8_t g_sRGBSamples2[] = {
250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255,
};
+constexpr size_t kBlackWhitePointCount = 3;
+
class CPDF_CalGray : public CPDF_ColorSpace {
public:
explicit CPDF_CalGray(CPDF_Document* pDoc);
@@ -92,8 +94,8 @@ class CPDF_CalGray : public CPDF_ColorSpace {
static constexpr float kDefaultGamma = 1.0f;
float m_Gamma = kDefaultGamma;
- float m_WhitePoint[3];
- float m_BlackPoint[3];
+ float m_WhitePoint[kBlackWhitePointCount];
+ float m_BlackPoint[kBlackWhitePointCount];
};
class CPDF_CalRGB : public CPDF_ColorSpace {
@@ -118,8 +120,8 @@ class CPDF_CalRGB : public CPDF_ColorSpace {
static constexpr size_t kGammaCount = 3;
static constexpr size_t kMatrixCount = 9;
- float m_WhitePoint[3];
- float m_BlackPoint[3];
+ float m_WhitePoint[kBlackWhitePointCount];
+ float m_BlackPoint[kBlackWhitePointCount];
float m_Gamma[kGammaCount];
float m_Matrix[kMatrixCount];
bool m_bGamma = false;
@@ -151,8 +153,8 @@ class CPDF_LabCS : public CPDF_ColorSpace {
private:
static constexpr size_t kRangesCount = 4;
- float m_WhitePoint[3];
- float m_BlackPoint[3];
+ float m_WhitePoint[kBlackWhitePointCount];
+ float m_BlackPoint[kBlackWhitePointCount];
float m_Ranges[kRangesCount];
};
@@ -583,11 +585,11 @@ uint32_t CPDF_CalGray::v_Load(CPDF_Document* pDoc,
return 0;
CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
- for (int i = 0; i < 3; i++)
+ for (size_t i = 0; i < kBlackWhitePointCount; ++i)
m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
pParam = pDict->GetArrayFor("BlackPoint");
- for (int i = 0; i < 3; i++)
+ for (size_t i = 0; i < kBlackWhitePointCount; ++i)
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
m_Gamma = pDict->GetNumberFor("Gamma");
@@ -630,11 +632,11 @@ uint32_t CPDF_CalRGB::v_Load(CPDF_Document* pDoc,
return 0;
CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
- for (int i = 0; i < 3; i++)
+ for (size_t i = 0; i < kBlackWhitePointCount; ++i)
m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
pParam = pDict->GetArrayFor("BlackPoint");
- for (int i = 0; i < 3; i++)
+ for (size_t i = 0; i < kBlackWhitePointCount; ++i)
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
pParam = pDict->GetArrayFor("Gamma");
@@ -737,11 +739,11 @@ uint32_t CPDF_LabCS::v_Load(CPDF_Document* pDoc,
return 0;
CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
- for (int i = 0; i < 3; i++)
+ for (size_t i = 0; i < kBlackWhitePointCount; ++i)
m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
pParam = pDict->GetArrayFor("BlackPoint");
- for (int i = 0; i < 3; i++)
+ for (size_t i = 0; i < kBlackWhitePointCount; ++i)
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
pParam = pDict->GetArrayFor("Range");