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

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

Issue 1567343002: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: actually compile 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 FX_FLOAT r = pEntry->GetNumber(0) * 255; 353 FX_FLOAT r = pEntry->GetNumber(0) * 255;
352 FX_FLOAT g = pEntry->GetNumber(1) * 255; 354 FX_FLOAT g = pEntry->GetNumber(1) * 255;
353 FX_FLOAT b = pEntry->GetNumber(2) * 255; 355 FX_FLOAT b = pEntry->GetNumber(2) * 255;
354 color = ArgbEncode(255, (int)r, (int)g, (int)b); 356 color = ArgbEncode(255, (int)r, (int)g, (int)b);
355 } else if (dwCount == 4) { 357 } else if (dwCount == 4) {
356 iColorType = COLORTYPE_CMYK; 358 iColorType = COLORTYPE_CMYK;
357 FX_FLOAT c = pEntry->GetNumber(0); 359 FX_FLOAT c = pEntry->GetNumber(0);
358 FX_FLOAT m = pEntry->GetNumber(1); 360 FX_FLOAT m = pEntry->GetNumber(1);
359 FX_FLOAT y = pEntry->GetNumber(2); 361 FX_FLOAT y = pEntry->GetNumber(2);
360 FX_FLOAT k = pEntry->GetNumber(3); 362 FX_FLOAT k = pEntry->GetNumber(3);
361 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); 363 FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
362 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); 364 FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
363 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); 365 FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
364 color = ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255)); 366 color = ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255));
365 } 367 }
366 return color; 368 return color;
367 } 369 }
368 370
369 FX_FLOAT CPDF_ApSettings::GetOriginalColor( 371 FX_FLOAT CPDF_ApSettings::GetOriginalColor(
370 int index, 372 int index,
371 const CFX_ByteStringC& csEntry) const { 373 const CFX_ByteStringC& csEntry) const {
372 if (!m_pDict) 374 if (!m_pDict)
373 return 0; 375 return 0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return m_pDict ? m_pDict->GetStream(csEntry) : nullptr; 419 return m_pDict ? m_pDict->GetStream(csEntry) : nullptr;
418 } 420 }
419 421
420 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { 422 CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
421 return m_pDict ? m_pDict->GetDict("IF") : nullptr; 423 return m_pDict ? m_pDict->GetDict("IF") : nullptr;
422 } 424 }
423 425
424 int CPDF_ApSettings::GetTextPosition() const { 426 int CPDF_ApSettings::GetTextPosition() const {
425 return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION; 427 return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION;
426 } 428 }
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