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

Side by Side Diff: core/fpdfdoc/cpdf_defaultappearance.cpp

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month 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/fpdfdoc/cpdf_defaultappearance.h ('k') | core/fpdfdoc/cpdf_formcontrol.h » ('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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfdoc/cpdf_defaultappearance.h" 7 #include "core/fpdfdoc/cpdf_defaultappearance.h"
8 8
9 #include "core/fpdfapi/parser/cpdf_simple_parser.h" 9 #include "core/fpdfapi/parser/cpdf_simple_parser.h"
10 #include "core/fpdfapi/parser/fpdf_parser_decode.h" 10 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
11 #include "core/fpdfdoc/cpdf_formcontrol.h" 11 #include "core/fpdfdoc/cpdf_formcontrol.h"
12 12
13 FX_BOOL CPDF_DefaultAppearance::HasFont() { 13 bool CPDF_DefaultAppearance::HasFont() {
14 if (m_csDA.IsEmpty()) 14 if (m_csDA.IsEmpty())
15 return FALSE; 15 return false;
16 16
17 CPDF_SimpleParser syntax(m_csDA.AsStringC()); 17 CPDF_SimpleParser syntax(m_csDA.AsStringC());
18 return syntax.FindTagParamFromStart("Tf", 2); 18 return syntax.FindTagParamFromStart("Tf", 2);
19 } 19 }
20 20
21 CFX_ByteString CPDF_DefaultAppearance::GetFontString() { 21 CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
22 CFX_ByteString csFont; 22 CFX_ByteString csFont;
23 if (m_csDA.IsEmpty()) 23 if (m_csDA.IsEmpty())
24 return csFont; 24 return csFont;
25 25
(...skipping 17 matching lines...) Expand all
43 43
44 CPDF_SimpleParser syntax(m_csDA.AsStringC()); 44 CPDF_SimpleParser syntax(m_csDA.AsStringC());
45 if (syntax.FindTagParamFromStart("Tf", 2)) { 45 if (syntax.FindTagParamFromStart("Tf", 2)) {
46 csFontNameTag = CFX_ByteString(syntax.GetWord()); 46 csFontNameTag = CFX_ByteString(syntax.GetWord());
47 csFontNameTag.Delete(0, 1); 47 csFontNameTag.Delete(0, 1);
48 fFontSize = FX_atof(syntax.GetWord()); 48 fFontSize = FX_atof(syntax.GetWord());
49 } 49 }
50 csFontNameTag = PDF_NameDecode(csFontNameTag); 50 csFontNameTag = PDF_NameDecode(csFontNameTag);
51 } 51 }
52 52
53 FX_BOOL CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) { 53 bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
54 if (m_csDA.IsEmpty()) 54 if (m_csDA.IsEmpty())
55 return FALSE; 55 return false;
56 56
57 CPDF_SimpleParser syntax(m_csDA.AsStringC()); 57 CPDF_SimpleParser syntax(m_csDA.AsStringC());
58 if (syntax.FindTagParamFromStart( 58 if (syntax.FindTagParamFromStart(
59 (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) { 59 (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
60 return TRUE; 60 return true;
61 } 61 }
62 if (syntax.FindTagParamFromStart( 62 if (syntax.FindTagParamFromStart(
63 (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) { 63 (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
64 return TRUE; 64 return true;
65 } 65 }
66 return syntax.FindTagParamFromStart( 66 return syntax.FindTagParamFromStart(
67 (nOperation == PaintOperation::STROKE ? "K" : "k"), 4); 67 (nOperation == PaintOperation::STROKE ? "K" : "k"), 4);
68 } 68 }
69 69
70 CFX_ByteString CPDF_DefaultAppearance::GetColorString( 70 CFX_ByteString CPDF_DefaultAppearance::GetColorString(
71 PaintOperation nOperation) { 71 PaintOperation nOperation) {
72 CFX_ByteString csColor; 72 CFX_ByteString csColor;
73 if (m_csDA.IsEmpty()) 73 if (m_csDA.IsEmpty())
74 return csColor; 74 return csColor;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 FX_FLOAT y = FX_atof(syntax.GetWord()); 175 FX_FLOAT y = FX_atof(syntax.GetWord());
176 FX_FLOAT k = FX_atof(syntax.GetWord()); 176 FX_FLOAT k = FX_atof(syntax.GetWord());
177 FX_FLOAT r = 1.0f - std::min(1.0f, c + k); 177 FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
178 FX_FLOAT g = 1.0f - std::min(1.0f, m + k); 178 FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
179 FX_FLOAT b = 1.0f - std::min(1.0f, y + k); 179 FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
180 color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), 180 color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f),
181 (int)(b * 255 + 0.5f)); 181 (int)(b * 255 + 0.5f));
182 } 182 }
183 } 183 }
184 184
185 FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() { 185 bool CPDF_DefaultAppearance::HasTextMatrix() {
186 if (m_csDA.IsEmpty()) 186 if (m_csDA.IsEmpty())
187 return FALSE; 187 return false;
188 188
189 CPDF_SimpleParser syntax(m_csDA.AsStringC()); 189 CPDF_SimpleParser syntax(m_csDA.AsStringC());
190 return syntax.FindTagParamFromStart("Tm", 6); 190 return syntax.FindTagParamFromStart("Tm", 6);
191 } 191 }
192 192
193 CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() { 193 CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
194 CFX_ByteString csTM; 194 CFX_ByteString csTM;
195 if (m_csDA.IsEmpty()) 195 if (m_csDA.IsEmpty())
196 return csTM; 196 return csTM;
197 197
(...skipping 15 matching lines...) Expand all
213 213
214 CPDF_SimpleParser syntax(m_csDA.AsStringC()); 214 CPDF_SimpleParser syntax(m_csDA.AsStringC());
215 if (syntax.FindTagParamFromStart("Tm", 6)) { 215 if (syntax.FindTagParamFromStart("Tm", 6)) {
216 FX_FLOAT f[6]; 216 FX_FLOAT f[6];
217 for (int i = 0; i < 6; i++) 217 for (int i = 0; i < 6; i++)
218 f[i] = FX_atof(syntax.GetWord()); 218 f[i] = FX_atof(syntax.GetWord());
219 tm.Set(f[0], f[1], f[2], f[3], f[4], f[5]); 219 tm.Set(f[0], f[1], f[2], f[3], f[4], f[5]);
220 } 220 }
221 return tm; 221 return tm;
222 } 222 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_defaultappearance.h ('k') | core/fpdfdoc/cpdf_formcontrol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698