diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-25 17:56:27 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-26 13:38:52 +0000 |
commit | 2bbb55162f0c9490a2085ed6eaa38038a7605609 (patch) | |
tree | df3b8cb6206be39dbae43b73311061fba329d1bb /core/fpdfapi | |
parent | 012ae898a069bda7afbfdad4eb4c8ba042b68dc7 (diff) | |
download | pdfium-2bbb55162f0c9490a2085ed6eaa38038a7605609.tar.xz |
Remove CPDF_Document parameter from CPDF_DeviceCS ctor.
It is always NULL.
Change-Id: Iebfb3bc645aebe05335f88d536164a55a7140539
Reviewed-on: https://pdfium-review.googlesource.com/4510
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/page/cpdf_devicecs_unittest.cpp | 32 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pagemodule.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/page/fpdf_page_colors.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/pageint.h | 2 |
4 files changed, 22 insertions, 22 deletions
diff --git a/core/fpdfapi/page/cpdf_devicecs_unittest.cpp b/core/fpdfapi/page/cpdf_devicecs_unittest.cpp index 742f4a0f15..22a961a1c1 100644 --- a/core/fpdfapi/page/cpdf_devicecs_unittest.cpp +++ b/core/fpdfapi/page/cpdf_devicecs_unittest.cpp @@ -11,40 +11,40 @@ TEST(CPDF_DeviceCSTest, GetRGBFromGray) { float R; float G; float B; - CPDF_DeviceCS deviceGray(nullptr, PDFCS_DEVICEGRAY); + CPDF_DeviceCS device_gray(PDFCS_DEVICEGRAY); // Test normal values. For gray, only first value from buf should be used. float buf[3] = {0.43f, 0.11f, 0.34f}; - ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_gray.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.43f, R); EXPECT_FLOAT_EQ(0.43f, G); EXPECT_FLOAT_EQ(0.43f, B); buf[0] = 0.872f; - ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_gray.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.872f, R); EXPECT_FLOAT_EQ(0.872f, G); EXPECT_FLOAT_EQ(0.872f, B); // Test boundary values buf[0] = {0.0f}; - ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_gray.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.0f, R); EXPECT_FLOAT_EQ(0.0f, G); EXPECT_FLOAT_EQ(0.0f, B); buf[0] = 1.0f; - ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_gray.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(1.0f, R); EXPECT_FLOAT_EQ(1.0f, G); EXPECT_FLOAT_EQ(1.0f, B); // Test out of range values buf[0] = -0.01f; - ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_gray.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.0f, R); EXPECT_FLOAT_EQ(0.0f, G); EXPECT_FLOAT_EQ(0.0f, B); buf[0] = 12.5f; - ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_gray.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(1.0f, R); EXPECT_FLOAT_EQ(1.0f, G); EXPECT_FLOAT_EQ(1.0f, B); @@ -54,18 +54,18 @@ TEST(CPDF_DeviceCSTest, GetRGBFromRGB) { float R; float G; float B; - CPDF_DeviceCS deviceRGB(nullptr, PDFCS_DEVICERGB); + CPDF_DeviceCS device_rgb(PDFCS_DEVICERGB); // Test normal values float buf[3] = {0.13f, 1.0f, 0.652f}; - ASSERT_TRUE(deviceRGB.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_rgb.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.13f, R); EXPECT_FLOAT_EQ(1.0f, G); EXPECT_FLOAT_EQ(0.652f, B); buf[0] = 0.0f; buf[1] = 0.52f; buf[2] = 0.78f; - ASSERT_TRUE(deviceRGB.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_rgb.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.0f, R); EXPECT_FLOAT_EQ(0.52f, G); EXPECT_FLOAT_EQ(0.78f, B); @@ -73,7 +73,7 @@ TEST(CPDF_DeviceCSTest, GetRGBFromRGB) { // Test out of range values buf[0] = -10.5f; buf[1] = 100.0f; - ASSERT_TRUE(deviceRGB.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_rgb.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.0f, R); EXPECT_FLOAT_EQ(1.0f, G); EXPECT_FLOAT_EQ(0.78f, B); @@ -83,23 +83,23 @@ TEST(CPDF_DeviceCSTest, GetRGBFromCMYK) { float R; float G; float B; - CPDF_DeviceCS deviceCMYK(nullptr, PDFCS_DEVICECMYK); + CPDF_DeviceCS device_cmyk(PDFCS_DEVICECMYK); // Test normal values float buf[4] = {0.6f, 0.5f, 0.3f, 0.9f}; - ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_cmyk.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.0627451f, R); EXPECT_FLOAT_EQ(0.0627451f, G); EXPECT_FLOAT_EQ(0.10588236f, B); buf[0] = 0.15f; buf[2] = 0.0f; - ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_cmyk.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.2f, R); EXPECT_FLOAT_EQ(0.0862745f, G); EXPECT_FLOAT_EQ(0.16470589f, B); buf[2] = 1.0f; buf[3] = 0.0f; - ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_cmyk.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.85098046f, R); EXPECT_FLOAT_EQ(0.552941f, G); EXPECT_FLOAT_EQ(0.15686275f, B); @@ -107,7 +107,7 @@ TEST(CPDF_DeviceCSTest, GetRGBFromCMYK) { // Test out of range values buf[2] = 1.5f; buf[3] = -0.6f; - ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B)); + ASSERT_TRUE(device_cmyk.GetRGB(buf, &R, &G, &B)); EXPECT_FLOAT_EQ(0.85098046f, R); EXPECT_FLOAT_EQ(0.552941f, G); EXPECT_FLOAT_EQ(0.15686275f, B); diff --git a/core/fpdfapi/page/cpdf_pagemodule.cpp b/core/fpdfapi/page/cpdf_pagemodule.cpp index 80edf2cdd0..c302b70c5b 100644 --- a/core/fpdfapi/page/cpdf_pagemodule.cpp +++ b/core/fpdfapi/page/cpdf_pagemodule.cpp @@ -7,9 +7,9 @@ #include "core/fpdfapi/page/cpdf_pagemodule.h" CPDF_PageModule::CPDF_PageModule() - : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY), - m_StockRGBCS(nullptr, PDFCS_DEVICERGB), - m_StockCMYKCS(nullptr, PDFCS_DEVICECMYK), + : m_StockGrayCS(PDFCS_DEVICEGRAY), + m_StockRGBCS(PDFCS_DEVICERGB), + m_StockCMYKCS(PDFCS_DEVICECMYK), m_StockPatternCS(nullptr) {} CPDF_PageModule::~CPDF_PageModule() {} diff --git a/core/fpdfapi/page/fpdf_page_colors.cpp b/core/fpdfapi/page/fpdf_page_colors.cpp index a59ca37d02..e30c780439 100644 --- a/core/fpdfapi/page/fpdf_page_colors.cpp +++ b/core/fpdfapi/page/fpdf_page_colors.cpp @@ -72,8 +72,8 @@ void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) { } } -CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family) - : CPDF_ColorSpace(pDoc, family, ComponentsForFamily(family)) { +CPDF_DeviceCS::CPDF_DeviceCS(int family) + : CPDF_ColorSpace(nullptr, family, ComponentsForFamily(family)) { ASSERT(family == PDFCS_DEVICEGRAY || family == PDFCS_DEVICERGB || family == PDFCS_DEVICECMYK); } diff --git a/core/fpdfapi/page/pageint.h b/core/fpdfapi/page/pageint.h index 05865ca58e..45ca671673 100644 --- a/core/fpdfapi/page/pageint.h +++ b/core/fpdfapi/page/pageint.h @@ -159,7 +159,7 @@ class CPDF_IccProfile : public CFX_Retainable { class CPDF_DeviceCS : public CPDF_ColorSpace { public: - CPDF_DeviceCS(CPDF_Document* pDoc, int family); + explicit CPDF_DeviceCS(int family); ~CPDF_DeviceCS() override; // CPDF_ColorSpace: |