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

Unified Diff: fpdfsdk/src/fpdf_flatten.cpp

Issue 1139993003: Tidy public fpdfview.h and fpdf_flatten.h. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Readability. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | public/fpdf_flatten.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdf_flatten.cpp
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index 4fea6a973c383b087be117fe2540b2804460503a..eb38296b4ae0a694cb3eca631689cc41f6c859bd 100644
--- a/fpdfsdk/src/fpdf_flatten.cpp
+++ b/fpdfsdk/src/fpdf_flatten.cpp
@@ -86,47 +86,48 @@ void ParserStream( CPDF_Dictionary * pPageDic, CPDF_Dictionary* pStream, CPDF_Re
int ParserAnnots( CPDF_Document* pSourceDoc, CPDF_Dictionary * pPageDic, CPDF_RectArray * pRectArray, CPDF_ObjectArray * pObjectArray, int nUsage)
{
- if (!pSourceDoc || !pPageDic) return FLATTEN_FAIL;
-
- GetContentsRect( pSourceDoc, pPageDic, pRectArray );
- CPDF_Array* pAnnots = pPageDic->GetArray("Annots");
- if (pAnnots)
- {
- FX_DWORD dwSize = pAnnots->GetCount();
-
- for (int i = 0; i < (int)dwSize; i++)
- {
- CPDF_Object* pObj = pAnnots->GetElementValue(i);
-
- if (!pObj)continue;
-
- if (pObj->GetType() == PDFOBJ_DICTIONARY)
- {
- CPDF_Dictionary* pAnnotDic = (CPDF_Dictionary*)pObj;
- CFX_ByteString sSubtype = pAnnotDic->GetString("Subtype");
- if (sSubtype == "Popup")continue;
-
- int nAnnotFlag = pAnnotDic->GetInteger("F");
-
- if(nAnnotFlag & ANNOTFLAG_HIDDEN)
- continue;
- if(nUsage == FLAT_NORMALDISPLAY)
- {
- if(nAnnotFlag & ANNOTFLAG_INVISIBLE)
- continue;
- ParserStream( pPageDic, pAnnotDic, pRectArray, pObjectArray );
- }
- else
- {
- if(nAnnotFlag & ANNOTFLAG_PRINT)
- ParserStream( pPageDic, pAnnotDic, pRectArray, pObjectArray );
- }
- }
- }
- return FLATTEN_SUCCESS;
- }else{
- return FLATTEN_NOTINGTODO;
- }
+ if (!pSourceDoc || !pPageDic)
+ return FLATTEN_FAIL;
+
+ GetContentsRect( pSourceDoc, pPageDic, pRectArray );
+ CPDF_Array* pAnnots = pPageDic->GetArray("Annots");
+ if (pAnnots)
+ {
+ FX_DWORD dwSize = pAnnots->GetCount();
+ for (int i = 0; i < (int)dwSize; i++)
+ {
+ CPDF_Object* pObj = pAnnots->GetElementValue(i);
+ if (!pObj)
+ continue;
+
+ if (pObj->GetType() == PDFOBJ_DICTIONARY)
+ {
+ CPDF_Dictionary* pAnnotDic = (CPDF_Dictionary*)pObj;
+ CFX_ByteString sSubtype = pAnnotDic->GetString("Subtype");
+ if (sSubtype == "Popup")
+ continue;
+
+ int nAnnotFlag = pAnnotDic->GetInteger("F");
+ if (nAnnotFlag & ANNOTFLAG_HIDDEN)
+ continue;
+
+ if(nUsage == FLAT_NORMALDISPLAY)
+ {
+ if (nAnnotFlag & ANNOTFLAG_INVISIBLE)
+ continue;
+
+ ParserStream( pPageDic, pAnnotDic, pRectArray, pObjectArray );
+ }
+ else
+ {
+ if (nAnnotFlag & ANNOTFLAG_PRINT)
+ ParserStream( pPageDic, pAnnotDic, pRectArray, pObjectArray );
+ }
+ }
+ }
+ return FLATTEN_SUCCESS;
+ }
+ return FLATTEN_NOTHINGTODO;
Lei Zhang 2015/05/19 20:20:37 Can we just do: if (!pAnnots) return FLATTEN_NO
Tom Sepez 2015/05/19 21:36:38 Done.
}
@@ -345,14 +346,9 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag)
int iRet = FLATTEN_FAIL;
iRet = ParserAnnots( pDocument, pPageDict, &RectArray, &ObjectArray, nFlag);
- if (iRet == FLATTEN_NOTINGTODO)
- {
- return FLATTEN_NOTINGTODO;
- }else if (iRet == FLATTEN_FAIL)
- {
- return FLATTEN_FAIL;
- }
-
+ if (iRet == FLATTEN_NOTHINGTODO || iRet == FLATTEN_FAIL)
+ return iret;
+
CPDF_Rect rcOriginalCB;
CPDF_Rect rcMerger = CalculateRect( &RectArray );
CPDF_Rect rcOriginalMB = pPageDict->GetRect("MediaBox");
« no previous file with comments | « no previous file | public/fpdf_flatten.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698