From c51196cac2963d94cb0c6434f870fcea83d5c509 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 16 Apr 2018 17:17:48 +0000 Subject: Fix some nits in CPDF_ColorSpace. Change-Id: I23c8e82c31db0a5a0ed4cbe2131452a26492109b Reviewed-on: https://pdfium-review.googlesource.com/30714 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- core/fpdfapi/page/cpdf_colorspace.cpp | 18 ++++++++++-------- 1 file 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::Load( pdfium::ScopedSetInsertion insertion(pVisited, pObj); - if (pObj->IsName()) { - return std::unique_ptr( - 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::Load( ByteString familyname = pFamilyObj->GetString(); if (pArray->GetCount() == 1) - return std::unique_ptr(ColorspaceFromName(familyname)); + return pdfium::WrapUnique(ColorspaceFromName(familyname)); std::unique_ptr pCS; switch (familyname.GetID()) { -- cgit v1.2.3