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

Side by Side Diff: fpdfsdk/src/fsdk_baseannot.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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 | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fsdk_baseannot.h" 9 #include "../include/fsdk_baseannot.h"
10 10
11 11
12 //--------------------------------------------------------------------------- 12 //---------------------------------------------------------------------------
13 // CPDFSDK_DateTime 13 // CPDFSDK_DateTime
14 //--------------------------------------------------------------------------- 14 //---------------------------------------------------------------------------
15 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) 15 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute)
16 { 16 {
17 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); 17 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60);
18 } 18 }
19 19
20 FX_BOOL _gAfxIsLeapYear(int16_t year) 20 bool _gAfxIsLeapYear(int16_t year)
21 { 21 {
22 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); 22 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)));
23 } 23 }
24 24
25 FX_WORD _gAfxGetYearDays(int16_t year) 25 FX_WORD _gAfxGetYearDays(int16_t year)
26 { 26 {
27 » return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365); 27 » return (_gAfxIsLeapYear(year) == true ? 366 : 365);
28 } 28 }
29 29
30 uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month) 30 uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month)
31 { 31 {
32 uint8_t mDays; 32 uint8_t mDays;
33 switch (month) 33 switch (month)
34 { 34 {
35 case 1: 35 case 1:
36 case 3: 36 case 3:
37 case 5: 37 case 5:
38 case 7: 38 case 7:
39 case 8: 39 case 8:
40 case 10: 40 case 10:
41 case 12: 41 case 12:
42 mDays = 31; 42 mDays = 31;
43 break; 43 break;
44 44
45 case 4: 45 case 4:
46 case 6: 46 case 6:
47 case 9: 47 case 9:
48 case 11: 48 case 11:
49 mDays = 30; 49 mDays = 30;
50 break; 50 break;
51 51
52 case 2: 52 case 2:
53 » » if (_gAfxIsLeapYear(year) == TRUE) 53 » » if (_gAfxIsLeapYear(year) == true)
54 mDays = 29; 54 mDays = 29;
55 else 55 else
56 mDays = 28; 56 mDays = 28;
57 break; 57 break;
58 58
59 default: 59 default:
60 mDays = 0; 60 mDays = 0;
61 break; 61 break;
62 } 62 }
63 63
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 dt.month = (uint8_t)st.wMonth; 121 dt.month = (uint8_t)st.wMonth;
122 dt.day = (uint8_t)st.wDay; 122 dt.day = (uint8_t)st.wDay;
123 dt.hour = (uint8_t)st.wHour; 123 dt.hour = (uint8_t)st.wHour;
124 dt.minute = (uint8_t)st.wMinute; 124 dt.minute = (uint8_t)st.wMinute;
125 dt.second = (uint8_t)st.wSecond; 125 dt.second = (uint8_t)st.wSecond;
126 // dt.tzHour = _timezone / 3600 * -1; 126 // dt.tzHour = _timezone / 3600 * -1;
127 // dt.tzMinute = (abs(_timezone) % 3600) / 60; 127 // dt.tzMinute = (abs(_timezone) % 3600) / 60;
128 return *this; 128 return *this;
129 } 129 }
130 130
131 FX_BOOL CPDFSDK_DateTime::operator == (CPDFSDK_DateTime& datetime) 131 bool CPDFSDK_DateTime::operator == (CPDFSDK_DateTime& datetime)
132 { 132 {
133 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0); 133 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0);
134 } 134 }
135 135
136 FX_BOOL CPDFSDK_DateTime::operator != (CPDFSDK_DateTime& datetime) 136 bool CPDFSDK_DateTime::operator != (CPDFSDK_DateTime& datetime)
137 { 137 {
138 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0); 138 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0);
139 } 139 }
140 140
141 FX_BOOL CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime) 141 bool CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime)
142 { 142 {
143 CPDFSDK_DateTime dt1 = ToGMT(); 143 CPDFSDK_DateTime dt1 = ToGMT();
144 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 144 CPDFSDK_DateTime dt2 = datetime.ToGMT();
145 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day; 145 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day;
146 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second; 146 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second;
147 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day; 147 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day;
148 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second; 148 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second;
149 149
150 » if (d1 > d3) return TRUE; 150 » if (d1 > d3) return true;
151 » if (d2 > d4) return TRUE; 151 » if (d2 > d4) return true;
152 » return FALSE; 152 » return false;
153 } 153 }
154 154
155 FX_BOOL CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime) 155 bool CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime)
156 { 156 {
157 CPDFSDK_DateTime dt1 = ToGMT(); 157 CPDFSDK_DateTime dt1 = ToGMT();
158 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 158 CPDFSDK_DateTime dt2 = datetime.ToGMT();
159 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day; 159 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day;
160 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second; 160 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second;
161 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day; 161 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day;
162 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second; 162 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second;
163 163
164 » if (d1 >= d3) return TRUE; 164 » if (d1 >= d3) return true;
165 » if (d2 >= d4) return TRUE; 165 » if (d2 >= d4) return true;
166 » return FALSE; 166 » return false;
167 } 167 }
168 168
169 FX_BOOL CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime) 169 bool CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime)
170 { 170 {
171 CPDFSDK_DateTime dt1 = ToGMT(); 171 CPDFSDK_DateTime dt1 = ToGMT();
172 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 172 CPDFSDK_DateTime dt2 = datetime.ToGMT();
173 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day; 173 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day;
174 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second; 174 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second;
175 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day; 175 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day;
176 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second; 176 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second;
177 177
178 » if (d1 < d3) return TRUE; 178 » if (d1 < d3) return true;
179 » if (d2 < d4) return TRUE; 179 » if (d2 < d4) return true;
180 » return FALSE; 180 » return false;
181 } 181 }
182 182
183 FX_BOOL CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime) 183 bool CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime)
184 { 184 {
185 CPDFSDK_DateTime dt1 = ToGMT(); 185 CPDFSDK_DateTime dt1 = ToGMT();
186 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 186 CPDFSDK_DateTime dt2 = datetime.ToGMT();
187 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day; 187 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int) dt1.dt.day;
188 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second; 188 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int )dt1.dt.second;
189 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day; 189 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int) dt2.dt.day;
190 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second; 190 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int )dt2.dt.second;
191 191
192 » if (d1 <= d3) return TRUE; 192 » if (d1 <= d3) return true;
193 » if (d2 <= d4) return TRUE; 193 » if (d2 <= d4) return true;
194 » return FALSE; 194 » return false;
195 } 195 }
196 196
197 CPDFSDK_DateTime::operator time_t() 197 CPDFSDK_DateTime::operator time_t()
198 { 198 {
199 struct tm newtime; 199 struct tm newtime;
200 200
201 newtime.tm_year = dt.year - 1900; 201 newtime.tm_year = dt.year - 1900;
202 newtime.tm_mon = dt.month - 1; 202 newtime.tm_mon = dt.month - 1;
203 newtime.tm_mday = dt.day; 203 newtime.tm_mday = dt.day;
204 newtime.tm_hour = dt.hour; 204 newtime.tm_hour = dt.hour;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return *this; 499 return *this;
500 } 500 }
501 501
502 502
503 //--------------------------------------------------------------------------- 503 //---------------------------------------------------------------------------
504 // CPDFSDK_Annot 504 // CPDFSDK_Annot
505 //--------------------------------------------------------------------------- 505 //---------------------------------------------------------------------------
506 CPDFSDK_Annot::CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) : 506 CPDFSDK_Annot::CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) :
507 m_pAnnot(pAnnot), 507 m_pAnnot(pAnnot),
508 m_pPageView(pPageView), 508 m_pPageView(pPageView),
509 m_bSelected(FALSE), 509 m_bSelected(false),
510 m_nTabOrder(-1) 510 m_nTabOrder(-1)
511 { 511 {
512 } 512 }
513 513
514 CPDFSDK_Annot::~CPDFSDK_Annot() 514 CPDFSDK_Annot::~CPDFSDK_Annot()
515 { 515 {
516 m_pAnnot = NULL; 516 m_pAnnot = NULL;
517 m_pPageView = NULL; 517 m_pPageView = NULL;
518 } 518 }
519 519
(...skipping 12 matching lines...) Expand all
532 void CPDFSDK_Annot::SetPage(CPDFSDK_PageView* pPageView) 532 void CPDFSDK_Annot::SetPage(CPDFSDK_PageView* pPageView)
533 { 533 {
534 m_pPageView = pPageView; 534 m_pPageView = pPageView;
535 } 535 }
536 536
537 CPDFSDK_PageView* CPDFSDK_Annot::GetPageView() 537 CPDFSDK_PageView* CPDFSDK_Annot::GetPageView()
538 { 538 {
539 return m_pPageView; 539 return m_pPageView;
540 } 540 }
541 541
542 FX_BOOL CPDFSDK_Annot::IsSelected() 542 bool CPDFSDK_Annot::IsSelected()
543 { 543 {
544 return m_bSelected; 544 return m_bSelected;
545 } 545 }
546 546
547 void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) 547 void CPDFSDK_Annot::SetSelected(bool bSelected)
548 { 548 {
549 m_bSelected = bSelected; 549 m_bSelected = bSelected;
550 } 550 }
551 551
552 // Tab Order 552 // Tab Order
553 int CPDFSDK_Annot::GetTabOrder() 553 int CPDFSDK_Annot::GetTabOrder()
554 { 554 {
555 return m_nTabOrder; 555 return m_nTabOrder;
556 } 556 }
557 557
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 599
600 void CPDFSDK_Annot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device, 600 void CPDFSDK_Annot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
601 CPDF_Annot::A ppearanceMode mode, const CPDF_RenderOptions* pOptions) 601 CPDF_Annot::A ppearanceMode mode, const CPDF_RenderOptions* pOptions)
602 { 602 {
603 ASSERT(m_pPageView != NULL); 603 ASSERT(m_pPageView != NULL);
604 ASSERT(m_pAnnot != NULL); 604 ASSERT(m_pAnnot != NULL);
605 605
606 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Devic e, mode, pOptions); 606 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Devic e, mode, pOptions);
607 } 607 }
608 608
609 FX_BOOL»CPDFSDK_Annot::IsAppearanceValid() 609 bool» CPDFSDK_Annot::IsAppearanceValid()
610 { 610 {
611 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; 611 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL;
612 } 612 }
613 613
614 FX_BOOL»CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) 614 bool» CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode)
615 { 615 {
616 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); 616 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
617 » if (pAP == NULL) return FALSE; 617 » if (pAP == NULL) return false;
618 618
619 // Choose the right sub-ap 619 // Choose the right sub-ap
620 const FX_CHAR* ap_entry = "N"; 620 const FX_CHAR* ap_entry = "N";
621 if (mode == CPDF_Annot::Down) 621 if (mode == CPDF_Annot::Down)
622 ap_entry = "D"; 622 ap_entry = "D";
623 else if (mode == CPDF_Annot::Rollover) 623 else if (mode == CPDF_Annot::Rollover)
624 ap_entry = "R"; 624 ap_entry = "R";
625 if (!pAP->KeyExist(ap_entry)) 625 if (!pAP->KeyExist(ap_entry))
626 ap_entry = "N"; 626 ap_entry = "N";
627 627
628 // Get the AP stream or subdirectory 628 // Get the AP stream or subdirectory
629 CPDF_Object* psub = pAP->GetElementValue(ap_entry); 629 CPDF_Object* psub = pAP->GetElementValue(ap_entry);
630 » if (psub == NULL) return FALSE; 630 » if (psub == NULL) return false;
631 631
632 » return TRUE; 632 » return true;
633 } 633 }
634 634
635 void CPDFSDK_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUs er2Device, 635 void CPDFSDK_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUs er2Device,
636 const CPDF_RenderOptions* pOp tions) 636 const CPDF_RenderOptions* pOp tions)
637 { 637 {
638 ASSERT(m_pAnnot != NULL); 638 ASSERT(m_pAnnot != NULL);
639 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); 639 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions);
640 } 640 }
641 641
642 void CPDFSDK_Annot::ClearCachedAP() 642 void CPDFSDK_Annot::ClearCachedAP()
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); 877 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f);
878 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); 878 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f);
879 m_pAnnot->GetAnnotDict()->SetAt("C", pArray); 879 m_pAnnot->GetAnnotDict()->SetAt("C", pArray);
880 } 880 }
881 881
882 void CPDFSDK_Annot::RemoveColor() 882 void CPDFSDK_Annot::RemoveColor()
883 { 883 {
884 m_pAnnot->GetAnnotDict()->RemoveAt("C"); 884 m_pAnnot->GetAnnotDict()->RemoveAt("C");
885 } 885 }
886 886
887 FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const 887 bool CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
888 { 888 {
889 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C")) 889 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C"))
890 { 890 {
891 int nCount = pEntry->GetCount(); 891 int nCount = pEntry->GetCount();
892 if (nCount == 1) 892 if (nCount == 1)
893 { 893 {
894 FX_FLOAT g = pEntry->GetNumber(0) * 255; 894 FX_FLOAT g = pEntry->GetNumber(0) * 255;
895 895
896 color = FXSYS_RGB((int)g, (int)g, (int)g); 896 color = FXSYS_RGB((int)g, (int)g, (int)g);
897 897
898 » » » return TRUE; 898 » » » return true;
899 } 899 }
900 else if (nCount == 3) 900 else if (nCount == 3)
901 { 901 {
902 FX_FLOAT r = pEntry->GetNumber(0) * 255; 902 FX_FLOAT r = pEntry->GetNumber(0) * 255;
903 FX_FLOAT g = pEntry->GetNumber(1) * 255; 903 FX_FLOAT g = pEntry->GetNumber(1) * 255;
904 FX_FLOAT b = pEntry->GetNumber(2) * 255; 904 FX_FLOAT b = pEntry->GetNumber(2) * 255;
905 905
906 color = FXSYS_RGB((int)r, (int)g, (int)b); 906 color = FXSYS_RGB((int)r, (int)g, (int)b);
907 907
908 » » » return TRUE; 908 » » » return true;
909 } 909 }
910 else if (nCount == 4) 910 else if (nCount == 4)
911 { 911 {
912 FX_FLOAT c = pEntry->GetNumber(0); 912 FX_FLOAT c = pEntry->GetNumber(0);
913 FX_FLOAT m = pEntry->GetNumber(1); 913 FX_FLOAT m = pEntry->GetNumber(1);
914 FX_FLOAT y = pEntry->GetNumber(2); 914 FX_FLOAT y = pEntry->GetNumber(2);
915 FX_FLOAT k = pEntry->GetNumber(3); 915 FX_FLOAT k = pEntry->GetNumber(3);
916 916
917 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); 917 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k);
918 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); 918 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k);
919 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); 919 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k);
920 920
921 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)( b * 255)); 921 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)( b * 255));
922 922
923 » » » return TRUE; 923 » » » return true;
924 } 924 }
925 } 925 }
926 926
927 » return FALSE; 927 » return false;
928 } 928 }
929 929
930 930
931 void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re ct& rcBBox, 931 void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re ct& rcBBox,
932 const CPDF_Matri x& matrix, const CFX_ByteString& sContents, 932 const CPDF_Matri x& matrix, const CFX_ByteString& sContents,
933 const CFX_ByteSt ring& sAPState) 933 const CFX_ByteSt ring& sAPState)
934 { 934 {
935 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); 935 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP");
936 936
937 if (!pAPDict) 937 if (!pAPDict)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 pStreamDict->SetAtInteger("FormType", 1); 978 pStreamDict->SetAtInteger("FormType", 1);
979 pStream->InitStream(NULL,0,pStreamDict); 979 pStream->InitStream(NULL,0,pStreamDict);
980 } 980 }
981 981
982 if (pStreamDict) 982 if (pStreamDict)
983 { 983 {
984 pStreamDict->SetAtMatrix("Matrix",matrix); 984 pStreamDict->SetAtMatrix("Matrix",matrix);
985 pStreamDict->SetAtRect("BBox", rcBBox); 985 pStreamDict->SetAtRect("BBox", rcBBox);
986 } 986 }
987 987
988 » pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FAL SE, FALSE); 988 » pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), fal se, false);
989 } 989 }
990 990
991 #define BA_ANNOT_MINWIDTH 1 991 #define BA_ANNOT_MINWIDTH 1
992 #define BA_ANNOT_MINHEIGHT 1 992 #define BA_ANNOT_MINHEIGHT 1
993 993
994 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const 994 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const
995 { 995 {
996 return BA_ANNOT_MINWIDTH; 996 return BA_ANNOT_MINWIDTH;
997 } 997 }
998 998
999 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const 999 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const
1000 { 1000 {
1001 return BA_ANNOT_MINHEIGHT; 1001 return BA_ANNOT_MINHEIGHT;
1002 } 1002 }
1003 1003
1004 FX_BOOL CPDFSDK_Annot::CreateFormFiller() 1004 bool CPDFSDK_Annot::CreateFormFiller()
1005 { 1005 {
1006 » return TRUE; 1006 » return true;
1007 } 1007 }
1008 FX_BOOL»CPDFSDK_Annot::IsVisible() const 1008 bool» CPDFSDK_Annot::IsVisible() const
1009 { 1009 {
1010 int nFlags = GetFlags(); 1010 int nFlags = GetFlags();
1011 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) | | (nFlags & ANNOTFLAG_NOVIEW)); 1011 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) | | (nFlags & ANNOTFLAG_NOVIEW));
1012 } 1012 }
1013 1013
1014 CPDF_Action CPDFSDK_Annot::GetAction() const 1014 CPDF_Action CPDFSDK_Annot::GetAction() const
1015 { 1015 {
1016 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A")); 1016 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A"));
1017 } 1017 }
1018 1018
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 return ; 1075 return ;
1076 } 1076 }
1077 1077
1078 CPDF_Page* CPDFSDK_Annot::GetPDFPage() 1078 CPDF_Page* CPDFSDK_Annot::GetPDFPage()
1079 { 1079 {
1080 if(m_pPageView) 1080 if(m_pPageView)
1081 return m_pPageView->GetPDFPage(); 1081 return m_pPageView->GetPDFPage();
1082 return NULL; 1082 return NULL;
1083 } 1083 }
1084 1084
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698