diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-16 17:17:48 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-16 17:17:48 +0000 |
commit | c51196cac2963d94cb0c6434f870fcea83d5c509 (patch) | |
tree | 0d85811f8fc2f1862c131298697dc90842398974 /core/fpdfapi/page | |
parent | 52d0cb2947d87f710f4e69dd300020604f10aa6d (diff) | |
download | pdfium-c51196cac2963d94cb0c6434f870fcea83d5c509.tar.xz |
Fix some nits in CPDF_ColorSpace.
Change-Id: I23c8e82c31db0a5a0ed4cbe2131452a26492109b
Reviewed-on: https://pdfium-review.googlesource.com/30714
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_colorspace.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index d9717f1d58..b6a0ed428b 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -346,9 +346,12 @@ void XYZ_to_sRGB_WhitePoint(float X, // The following RGB_xyz is based on // sRGB value {Rx,Ry}={0.64, 0.33}, {Gx,Gy}={0.30, 0.60}, {Bx,By}={0.15, 0.06} - float Rx = 0.64f, Ry = 0.33f; - float Gx = 0.30f, Gy = 0.60f; - float Bx = 0.15f, By = 0.06f; + constexpr float Rx = 0.64f; + constexpr float Ry = 0.33f; + constexpr float Gx = 0.30f; + constexpr float Gy = 0.60f; + constexpr float Bx = 0.15f; + constexpr float By = 0.06f; Matrix_3by3 RGB_xyz(Rx, Gx, Bx, Ry, Gy, By, 1 - Rx - Ry, 1 - Gx - Gy, 1 - Bx - By); Vector_3by1 whitePoint(Xw, Yw, Zw); @@ -405,10 +408,9 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load( pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pObj); - if (pObj->IsName()) { - return std::unique_ptr<CPDF_ColorSpace>( - ColorspaceFromName(pObj->GetString())); - } + if (pObj->IsName()) + return pdfium::WrapUnique(ColorspaceFromName(pObj->GetString())); + if (CPDF_Stream* pStream = pObj->AsStream()) { CPDF_Dictionary* pDict = pStream->GetDict(); if (!pDict) @@ -435,7 +437,7 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load( ByteString familyname = pFamilyObj->GetString(); if (pArray->GetCount() == 1) - return std::unique_ptr<CPDF_ColorSpace>(ColorspaceFromName(familyname)); + return pdfium::WrapUnique(ColorspaceFromName(familyname)); std::unique_ptr<CPDF_ColorSpace> pCS; switch (familyname.GetID()) { |