diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-20 10:20:35 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-20 10:20:35 -0700 |
commit | 3c3201f333eaf22931fbd4916f2ef0fd0479fead (patch) | |
tree | 97752c2afcd5f7ec945e393235691a0f9c5afee9 /fpdfsdk | |
parent | d50b172a9d3a05704748f0798b5aaa422485abbd (diff) | |
download | pdfium-3c3201f333eaf22931fbd4916f2ef0fd0479fead.tar.xz |
Merge to XFA: Tidy public fpdfview.h and fpdf_flatten.h.
Original Review URL: https://codereview.chromium.org/1139993003
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1144973004
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/src/fpdf_flatten.cpp | 90 |
1 files changed, 41 insertions, 49 deletions
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index 9356db9842..3dd768742f 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.cpp @@ -88,47 +88,44 @@ 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) + return FLATTEN_NOTHINGTODO; + + FX_DWORD dwSize = pAnnots->GetCount(); + for (int i = 0; i < (int)dwSize; i++) + { + CPDF_Object* pObj = pAnnots->GetElementValue(i); + if (!pObj || pObj->GetType() != PDFOBJ_DICTIONARY) + continue; + + 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; } @@ -351,14 +348,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"); |