Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Side by Side Diff: core/src/fpdfdoc/doc_formcontrol.cpp

Issue 1577503002: Merge to XFA: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
9 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, 11 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
10 CPDF_Dictionary* pWidgetDict) { 12 CPDF_Dictionary* pWidgetDict) {
11 m_pField = pField; 13 m_pField = pField;
12 m_pWidgetDict = pWidgetDict; 14 m_pWidgetDict = pWidgetDict;
13 m_pForm = m_pField->m_pForm; 15 m_pForm = m_pField->m_pForm;
14 } 16 }
15 CFX_FloatRect CPDF_FormControl::GetRect() const { 17 CFX_FloatRect CPDF_FormControl::GetRect() const {
16 return m_pWidgetDict->GetRect("Rect"); 18 return m_pWidgetDict->GetRect("Rect");
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 FX_FLOAT r = pEntry->GetNumber(0) * 255; 348 FX_FLOAT r = pEntry->GetNumber(0) * 255;
347 FX_FLOAT g = pEntry->GetNumber(1) * 255; 349 FX_FLOAT g = pEntry->GetNumber(1) * 255;
348 FX_FLOAT b = pEntry->GetNumber(2) * 255; 350 FX_FLOAT b = pEntry->GetNumber(2) * 255;
349 color = ArgbEncode(255, (int)r, (int)g, (int)b); 351 color = ArgbEncode(255, (int)r, (int)g, (int)b);
350 } else if (dwCount == 4) { 352 } else if (dwCount == 4) {
351 iColorType = COLORTYPE_CMYK; 353 iColorType = COLORTYPE_CMYK;
352 FX_FLOAT c = pEntry->GetNumber(0); 354 FX_FLOAT c = pEntry->GetNumber(0);
353 FX_FLOAT m = pEntry->GetNumber(1); 355 FX_FLOAT m = pEntry->GetNumber(1);
354 FX_FLOAT y = pEntry->GetNumber(2); 356 FX_FLOAT y = pEntry->GetNumber(2);
355 FX_FLOAT k = pEntry->GetNumber(3); 357 FX_FLOAT k = pEntry->GetNumber(3);
356 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); 358 FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
357 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); 359 FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
358 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); 360 FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
359 color = ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255)); 361 color = ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255));
360 } 362 }
361 return color; 363 return color;
362 } 364 }
363 365
364 FX_FLOAT CPDF_ApSettings::GetOriginalColor( 366 FX_FLOAT CPDF_ApSettings::GetOriginalColor(
365 int index, 367 int index,
366 const CFX_ByteStringC& csEntry) const { 368 const CFX_ByteStringC& csEntry) const {
367 if (!m_pDict) 369 if (!m_pDict)
368 return 0; 370 return 0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 return m_pDict ? m_pDict->GetStream(csEntry) : nullptr; 414 return m_pDict ? m_pDict->GetStream(csEntry) : nullptr;
413 } 415 }
414 416
415 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { 417 CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
416 return m_pDict ? m_pDict->GetDict("IF") : nullptr; 418 return m_pDict ? m_pDict->GetDict("IF") : nullptr;
417 } 419 }
418 420
419 int CPDF_ApSettings::GetTextPosition() const { 421 int CPDF_ApSettings::GetTextPosition() const {
420 return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION; 422 return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION;
421 } 423 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698