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

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

Issue 1410343003: [Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase to origin/xfa Created 5 years, 2 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/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfppo.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 "../../public/fpdf_edit.h" 7 #include "../../public/fpdf_edit.h"
8 #include "../../public/fpdf_formfill.h" 8 #include "../../public/fpdf_formfill.h"
9 #include "../include/fsdk_define.h" 9 #include "../include/fsdk_define.h"
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../include/fpdfxfa/fpdfxfa_doc.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 int rotate = 0; 101 int rotate = 0;
102 if (pDict != NULL) { 102 if (pDict != NULL) {
103 if (pDict->KeyExist("Rotate")) 103 if (pDict->KeyExist("Rotate"))
104 rotate = pDict->GetElement("Rotate")->GetDirect() 104 rotate = pDict->GetElement("Rotate")->GetDirect()
105 ? pDict->GetElement("Rotate")->GetDirect()->GetInteger() / 90 105 ? pDict->GetElement("Rotate")->GetDirect()->GetInteger() / 90
106 : 0; 106 : 0;
107 else { 107 else {
108 if (pDict->KeyExist("Parent")) { 108 if (pDict->KeyExist("Parent")) {
109 CPDF_Dictionary* pPages = 109 CPDF_Dictionary* pPages =
110 (CPDF_Dictionary*)pDict->GetElement("Parent")->GetDirect(); 110 ToDictionary(pDict->GetElement("Parent")->GetDirect());
111 while (pPages) { 111 while (pPages) {
112 if (pPages->KeyExist("Rotate")) { 112 if (pPages->KeyExist("Rotate")) {
113 rotate = 113 rotate =
114 pPages->GetElement("Rotate")->GetDirect() 114 pPages->GetElement("Rotate")->GetDirect()
115 ? pPages->GetElement("Rotate")->GetDirect()->GetInteger() / 115 ? pPages->GetElement("Rotate")->GetDirect()->GetInteger() /
116 90 116 90
117 : 0; 117 : 0;
118 break; 118 break;
119 } else if (pPages->KeyExist("Parent")) 119 } else if (pPages->KeyExist("Parent"))
120 pPages = 120 pPages = ToDictionary(pPages->GetElement("Parent")->GetDirect());
121 (CPDF_Dictionary*)pPages->GetElement("Parent")->GetDirect();
122 else 121 else
123 break; 122 break;
124 } 123 }
125 } 124 }
126 } 125 }
127 } else { 126 } else {
128 return -1; 127 return -1;
129 } 128 }
130 129
131 return rotate; 130 return rotate;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return FALSE; 209 return FALSE;
211 CPDF_PageObject* pPageObj = (CPDF_PageObject*)pageObject; 210 CPDF_PageObject* pPageObj = (CPDF_PageObject*)pageObject;
212 211
213 const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState; 212 const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState;
214 int blend_type = 213 int blend_type =
215 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL; 214 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL;
216 if (blend_type != FXDIB_BLEND_NORMAL) 215 if (blend_type != FXDIB_BLEND_NORMAL)
217 return TRUE; 216 return TRUE;
218 217
219 CPDF_Dictionary* pSMaskDict = 218 CPDF_Dictionary* pSMaskDict =
220 pGeneralState ? (CPDF_Dictionary*)pGeneralState->m_pSoftMask : NULL; 219 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL;
221 if (pSMaskDict) 220 if (pSMaskDict)
222 return TRUE; 221 return TRUE;
223 222
224 if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f) 223 if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f)
225 return TRUE; 224 return TRUE;
226 225
227 if (pPageObj->m_Type == PDFPAGE_PATH) { 226 if (pPageObj->m_Type == PDFPAGE_PATH) {
228 if (pGeneralState && pGeneralState->m_StrokeAlpha != 1.0f) 227 if (pGeneralState && pGeneralState->m_StrokeAlpha != 1.0f)
229 return TRUE; 228 return TRUE;
230 } 229 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 310 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
312 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 311 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
313 "Page")) { 312 "Page")) {
314 return; 313 return;
315 } 314 }
316 CPDF_Dictionary* pDict = pPage->m_pFormDict; 315 CPDF_Dictionary* pDict = pPage->m_pFormDict;
317 rotate %= 4; 316 rotate %= 4;
318 317
319 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 318 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
320 } 319 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698