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

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

Issue 1239313005: Merge to XFA - else after returns. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Fix issues. Created 5 years, 4 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/fpdfdoc/doc_metadata.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 "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dict ionary *pGroupDict) 8 static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dict ionary *pGroupDict)
9 { 9 {
10 if (pObject == NULL || pGroupDict == NULL) { 10 if (pObject == NULL || pGroupDict == NULL) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 int32_t iCount = pExpression->GetCount(); 200 int32_t iCount = pExpression->GetCount();
201 CPDF_Object *pOCGObj; 201 CPDF_Object *pOCGObj;
202 CFX_ByteString csOperator = pExpression->GetString(0); 202 CFX_ByteString csOperator = pExpression->GetString(0);
203 if (csOperator == FX_BSTRC("Not")) { 203 if (csOperator == FX_BSTRC("Not")) {
204 pOCGObj = pExpression->GetElementValue(1); 204 pOCGObj = pExpression->GetElementValue(1);
205 if (pOCGObj == NULL) { 205 if (pOCGObj == NULL) {
206 return FALSE; 206 return FALSE;
207 } 207 }
208 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { 208 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) {
209 return !(bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : Get OCGVisible((CPDF_Dictionary*)pOCGObj)); 209 return !(bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : Get OCGVisible((CPDF_Dictionary*)pOCGObj));
210 } else if (pOCGObj->GetType() == PDFOBJ_ARRAY) { 210 }
211 if (pOCGObj->GetType() == PDFOBJ_ARRAY) {
211 return !GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1); 212 return !GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1);
212 } else {
213 return FALSE;
214 } 213 }
214 return FALSE;
215 } 215 }
216 if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { 216 if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) {
217 FX_BOOL bValue = FALSE; 217 FX_BOOL bValue = FALSE;
218 for (int32_t i = 1; i < iCount; i ++) { 218 for (int32_t i = 1; i < iCount; i ++) {
219 pOCGObj = pExpression->GetElementValue(1); 219 pOCGObj = pExpression->GetElementValue(1);
220 if (pOCGObj == NULL) { 220 if (pOCGObj == NULL) {
221 continue; 221 continue;
222 } 222 }
223 FX_BOOL bItem = FALSE; 223 FX_BOOL bItem = FALSE;
224 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { 224 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return FALSE; 279 return FALSE;
280 } 280 }
281 if (csP == FX_BSTRC("AllOff") && bItem) { 281 if (csP == FX_BSTRC("AllOff") && bItem) {
282 return FALSE; 282 return FALSE;
283 } 283 }
284 } 284 }
285 return bState; 285 return bState;
286 } 286 }
287 FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict) 287 FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict)
288 { 288 {
289 if (pOCGDict == NULL) { 289 if (!pOCGDict) {
290 return TRUE; 290 return TRUE;
291 } 291 }
292 CFX_ByteString csType = pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG" )); 292 CFX_ByteString csType = pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG" ));
293 if (csType == FX_BSTRC("OCG")) { 293 if (csType == FX_BSTRC("OCG")) {
294 return GetOCGVisible(pOCGDict); 294 return GetOCGVisible(pOCGDict);
295 } else {
296 return LoadOCMDState(pOCGDict, FALSE);
297 } 295 }
296 return LoadOCMDState(pOCGDict, FALSE);
298 } 297 }
299 void CPDF_OCContext::ResetOCContext() 298 void CPDF_OCContext::ResetOCContext()
300 { 299 {
301 m_OCGStates.clear(); 300 m_OCGStates.clear();
302 } 301 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_metadata.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698