| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include <algorithm> |
| 8 |
| 7 #include "core/include/fpdfdoc/fpdf_doc.h" | 9 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 8 #include "doc_utils.h" | 10 #include "doc_utils.h" |
| 9 | 11 |
| 10 static const int FPDFDOC_UTILS_MAXRECURSION = 32; | 12 static const int FPDFDOC_UTILS_MAXRECURSION = 32; |
| 11 | 13 |
| 12 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { | 14 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { |
| 13 CFX_WideString full_name; | 15 CFX_WideString full_name; |
| 14 CPDF_Dictionary* pLevel = pFieldDict; | 16 CPDF_Dictionary* pLevel = pFieldDict; |
| 15 while (pLevel) { | 17 while (pLevel) { |
| 16 CFX_WideString short_name = pLevel->GetUnicodeText("T"); | 18 CFX_WideString short_name = pLevel->GetUnicodeText("T"); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 color = ArgbEncode(255, (int)r, (int)g, (int)b); | 174 color = ArgbEncode(255, (int)r, (int)g, (int)b); |
| 173 return; | 175 return; |
| 174 } | 176 } |
| 175 syntax.SetPos(0); | 177 syntax.SetPos(0); |
| 176 if (syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4)) { | 178 if (syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4)) { |
| 177 iColorType = COLORTYPE_CMYK; | 179 iColorType = COLORTYPE_CMYK; |
| 178 FX_FLOAT c = FX_atof((CFX_ByteString)syntax.GetWord()); | 180 FX_FLOAT c = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 179 FX_FLOAT m = FX_atof((CFX_ByteString)syntax.GetWord()); | 181 FX_FLOAT m = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 180 FX_FLOAT y = FX_atof((CFX_ByteString)syntax.GetWord()); | 182 FX_FLOAT y = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 181 FX_FLOAT k = FX_atof((CFX_ByteString)syntax.GetWord()); | 183 FX_FLOAT k = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 182 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); | 184 FX_FLOAT r = 1.0f - std::min(1.0f, c + k); |
| 183 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); | 185 FX_FLOAT g = 1.0f - std::min(1.0f, m + k); |
| 184 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); | 186 FX_FLOAT b = 1.0f - std::min(1.0f, y + k); |
| 185 color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), | 187 color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), |
| 186 (int)(b * 255 + 0.5f)); | 188 (int)(b * 255 + 0.5f)); |
| 187 } | 189 } |
| 188 } | 190 } |
| 189 FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() { | 191 FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() { |
| 190 if (m_csDA.IsEmpty()) { | 192 if (m_csDA.IsEmpty()) { |
| 191 return FALSE; | 193 return FALSE; |
| 192 } | 194 } |
| 193 CPDF_SimpleParser syntax(m_csDA); | 195 CPDF_SimpleParser syntax(m_csDA); |
| 194 return syntax.FindTagParam("Tm", 6); | 196 return syntax.FindTagParam("Tm", 6); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); | 714 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); |
| 713 if (pAttr) { | 715 if (pAttr) { |
| 714 return pAttr; | 716 return pAttr; |
| 715 } | 717 } |
| 716 CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); | 718 CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); |
| 717 if (!pParent) { | 719 if (!pParent) { |
| 718 return NULL; | 720 return NULL; |
| 719 } | 721 } |
| 720 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); | 722 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); |
| 721 } | 723 } |
| OLD | NEW |