Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_flatten.h" | 7 #include "public/fpdf_flatten.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "core/fpdfapi/page/cpdf_page.h" | 11 #include "core/fpdfapi/page/cpdf_page.h" |
| 12 #include "core/fpdfapi/page/cpdf_pageobject.h" | 12 #include "core/fpdfapi/page/cpdf_pageobject.h" |
| 13 #include "core/fpdfapi/parser/cpdf_array.h" | 13 #include "core/fpdfapi/parser/cpdf_array.h" |
| 14 #include "core/fpdfapi/parser/cpdf_document.h" | 14 #include "core/fpdfapi/parser/cpdf_document.h" |
| 15 #include "core/fpdfapi/parser/cpdf_number.h" | 15 #include "core/fpdfapi/parser/cpdf_number.h" |
| 16 #include "core/fpdfapi/parser/cpdf_stream.h" | 16 #include "core/fpdfapi/parser/cpdf_stream.h" |
| 17 #include "core/fpdfapi/parser/cpdf_stream_acc.h" | 17 #include "core/fpdfapi/parser/cpdf_stream_acc.h" |
| 18 #include "core/fpdfdoc/cpdf_annot.h" | 18 #include "core/fpdfdoc/cpdf_annot.h" |
| 19 #include "fpdfsdk/fsdk_define.h" | 19 #include "fpdfsdk/fsdk_define.h" |
| 20 #include "third_party/base/stl_util.h" | 20 #include "third_party/base/stl_util.h" |
| 21 | 21 |
| 22 typedef CFX_ArrayTemplate<CFX_FloatRect> CPDF_RectArray; | |
| 23 | |
| 24 enum FPDF_TYPE { MAX, MIN }; | 22 enum FPDF_TYPE { MAX, MIN }; |
| 25 enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM }; | 23 enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM }; |
| 26 | 24 |
| 27 namespace { | 25 namespace { |
| 28 | 26 |
| 29 bool IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) { | 27 bool IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) { |
| 30 if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f) | 28 if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f) |
| 31 return false; | 29 return false; |
| 32 | 30 |
| 33 if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f && | 31 if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f && |
| 34 rect.bottom == 0.0f) | 32 rect.bottom == 0.0f) |
| 35 return false; | 33 return false; |
| 36 | 34 |
| 37 if (!rcPage.IsEmpty()) { | 35 if (!rcPage.IsEmpty()) { |
| 38 if (rect.left - rcPage.left < -10.000001f || | 36 if (rect.left - rcPage.left < -10.000001f || |
| 39 rect.right - rcPage.right > 10.000001f || | 37 rect.right - rcPage.right > 10.000001f || |
| 40 rect.top - rcPage.top > 10.000001f || | 38 rect.top - rcPage.top > 10.000001f || |
| 41 rect.bottom - rcPage.bottom < -10.000001f) | 39 rect.bottom - rcPage.bottom < -10.000001f) |
| 42 return false; | 40 return false; |
| 43 } | 41 } |
| 44 | 42 |
| 45 return true; | 43 return true; |
| 46 } | 44 } |
| 47 | 45 |
| 48 void GetContentsRect(CPDF_Document* pDoc, | 46 void GetContentsRect(CPDF_Document* pDoc, |
| 49 CPDF_Dictionary* pDict, | 47 CPDF_Dictionary* pDict, |
| 50 CPDF_RectArray* pRectArray) { | 48 std::vector<CFX_FloatRect>* pRectArray) { |
| 51 std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false)); | 49 std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false)); |
| 52 pPDFPage->ParseContent(); | 50 pPDFPage->ParseContent(); |
| 53 | 51 |
| 54 for (const auto& pPageObject : *pPDFPage->GetPageObjectList()) { | 52 for (const auto& pPageObject : *pPDFPage->GetPageObjectList()) { |
| 55 CFX_FloatRect rc; | 53 CFX_FloatRect rc; |
| 56 rc.left = pPageObject->m_Left; | 54 rc.left = pPageObject->m_Left; |
| 57 rc.right = pPageObject->m_Right; | 55 rc.right = pPageObject->m_Right; |
| 58 rc.bottom = pPageObject->m_Bottom; | 56 rc.bottom = pPageObject->m_Bottom; |
| 59 rc.top = pPageObject->m_Top; | 57 rc.top = pPageObject->m_Top; |
| 60 if (IsValiableRect(rc, pDict->GetRectFor("MediaBox"))) | 58 if (IsValiableRect(rc, pDict->GetRectFor("MediaBox"))) |
| 61 pRectArray->Add(rc); | 59 pRectArray->push_back(rc); |
| 62 } | 60 } |
| 63 } | 61 } |
| 64 | 62 |
| 65 void ParserStream(CPDF_Dictionary* pPageDic, | 63 void ParserStream(CPDF_Dictionary* pPageDic, |
| 66 CPDF_Dictionary* pStream, | 64 CPDF_Dictionary* pStream, |
| 67 CPDF_RectArray* pRectArray, | 65 std::vector<CFX_FloatRect>* pRectArray, |
| 68 std::vector<CPDF_Dictionary*>* pObjectArray) { | 66 std::vector<CPDF_Dictionary*>* pObjectArray) { |
| 69 if (!pStream) | 67 if (!pStream) |
| 70 return; | 68 return; |
| 71 CFX_FloatRect rect; | 69 CFX_FloatRect rect; |
| 72 if (pStream->KeyExist("Rect")) | 70 if (pStream->KeyExist("Rect")) |
| 73 rect = pStream->GetRectFor("Rect"); | 71 rect = pStream->GetRectFor("Rect"); |
| 74 else if (pStream->KeyExist("BBox")) | 72 else if (pStream->KeyExist("BBox")) |
| 75 rect = pStream->GetRectFor("BBox"); | 73 rect = pStream->GetRectFor("BBox"); |
| 76 | 74 |
| 77 if (IsValiableRect(rect, pPageDic->GetRectFor("MediaBox"))) | 75 if (IsValiableRect(rect, pPageDic->GetRectFor("MediaBox"))) |
| 78 pRectArray->Add(rect); | 76 pRectArray->push_back(rect); |
| 79 | 77 |
| 80 pObjectArray->push_back(pStream); | 78 pObjectArray->push_back(pStream); |
| 81 } | 79 } |
| 82 | 80 |
| 83 int ParserAnnots(CPDF_Document* pSourceDoc, | 81 int ParserAnnots(CPDF_Document* pSourceDoc, |
| 84 CPDF_Dictionary* pPageDic, | 82 CPDF_Dictionary* pPageDic, |
| 85 CPDF_RectArray* pRectArray, | 83 std::vector<CFX_FloatRect>* pRectArray, |
| 86 std::vector<CPDF_Dictionary*>* pObjectArray, | 84 std::vector<CPDF_Dictionary*>* pObjectArray, |
| 87 int nUsage) { | 85 int nUsage) { |
| 88 if (!pSourceDoc || !pPageDic) | 86 if (!pSourceDoc || !pPageDic) |
| 89 return FLATTEN_FAIL; | 87 return FLATTEN_FAIL; |
| 90 | 88 |
| 91 GetContentsRect(pSourceDoc, pPageDic, pRectArray); | 89 GetContentsRect(pSourceDoc, pPageDic, pRectArray); |
| 92 CPDF_Array* pAnnots = pPageDic->GetArrayFor("Annots"); | 90 CPDF_Array* pAnnots = pPageDic->GetArrayFor("Annots"); |
| 93 if (!pAnnots) | 91 if (!pAnnots) |
| 94 return FLATTEN_NOTHINGTODO; | 92 return FLATTEN_NOTHINGTODO; |
| 95 | 93 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 113 | 111 |
| 114 ParserStream(pPageDic, pAnnotDic, pRectArray, pObjectArray); | 112 ParserStream(pPageDic, pAnnotDic, pRectArray, pObjectArray); |
| 115 } else { | 113 } else { |
| 116 if (nAnnotFlag & ANNOTFLAG_PRINT) | 114 if (nAnnotFlag & ANNOTFLAG_PRINT) |
| 117 ParserStream(pPageDic, pAnnotDic, pRectArray, pObjectArray); | 115 ParserStream(pPageDic, pAnnotDic, pRectArray, pObjectArray); |
| 118 } | 116 } |
| 119 } | 117 } |
| 120 return FLATTEN_SUCCESS; | 118 return FLATTEN_SUCCESS; |
| 121 } | 119 } |
| 122 | 120 |
| 123 FX_FLOAT GetMinMaxValue(CPDF_RectArray& array, | 121 FX_FLOAT GetMinMaxValue(const std::vector<CFX_FloatRect>& array, |
| 124 FPDF_TYPE type, | 122 FPDF_TYPE type, |
| 125 FPDF_VALUE value) { | 123 FPDF_VALUE value) { |
| 126 int nRects = array.GetSize(); | 124 int nRects = pdfium::CollectionSize<int>(array); |
|
Lei Zhang
2016/11/09 22:10:20
Can we just do size_t everywhere?
Tom Sepez
2016/11/09 22:28:22
Done.
| |
| 127 FX_FLOAT fRet = 0.0f; | |
| 128 | |
| 129 if (nRects <= 0) | 125 if (nRects <= 0) |
| 130 return 0.0f; | 126 return 0.0f; |
| 131 | 127 |
| 132 FX_FLOAT* pArray = new FX_FLOAT[nRects]; | 128 std::unique_ptr<FX_FLOAT[]> pArray(new FX_FLOAT[nRects]); |
|
Lei Zhang
2016/11/09 22:10:20
std::vector?
Tom Sepez
2016/11/09 22:28:22
Done.
| |
| 133 switch (value) { | 129 switch (value) { |
| 134 case LEFT: { | 130 case LEFT: |
| 135 for (int i = 0; i < nRects; i++) | 131 for (int i = 0; i < nRects; i++) |
| 136 pArray[i] = CFX_FloatRect(array.GetAt(i)).left; | 132 pArray[i] = array[i].left; |
| 137 | |
| 138 break; | 133 break; |
| 139 } | 134 case TOP: |
| 140 case TOP: { | |
| 141 for (int i = 0; i < nRects; i++) | 135 for (int i = 0; i < nRects; i++) |
| 142 pArray[i] = CFX_FloatRect(array.GetAt(i)).top; | 136 pArray[i] = array[i].top; |
| 143 | |
| 144 break; | 137 break; |
| 145 } | 138 case RIGHT: |
| 146 case RIGHT: { | |
| 147 for (int i = 0; i < nRects; i++) | 139 for (int i = 0; i < nRects; i++) |
| 148 pArray[i] = CFX_FloatRect(array.GetAt(i)).right; | 140 pArray[i] = array[i].right; |
| 149 | |
| 150 break; | 141 break; |
| 151 } | 142 case BOTTOM: |
| 152 case BOTTOM: { | |
| 153 for (int i = 0; i < nRects; i++) | 143 for (int i = 0; i < nRects; i++) |
| 154 pArray[i] = CFX_FloatRect(array.GetAt(i)).bottom; | 144 pArray[i] = array[i].bottom; |
| 155 | |
| 156 break; | 145 break; |
| 157 } | |
| 158 default: | 146 default: |
| 159 // Not reachable. | 147 // Not reachable. |
| 160 return 0.0f; | 148 return 0.0f; |
| 161 } | 149 } |
| 162 fRet = pArray[0]; | 150 |
| 151 FX_FLOAT fRet = pArray[0]; | |
| 163 if (type == MAX) { | 152 if (type == MAX) { |
| 164 for (int i = 1; i < nRects; i++) | 153 for (int i = 1; i < nRects; i++) |
| 165 if (fRet <= pArray[i]) | 154 if (fRet <= pArray[i]) |
|
Lei Zhang
2016/11/09 22:10:20
More opportunities for std::max / min?
Tom Sepez
2016/11/09 22:28:22
Done.
| |
| 166 fRet = pArray[i]; | 155 fRet = pArray[i]; |
| 167 } else { | 156 } else { |
| 168 for (int i = 1; i < nRects; i++) | 157 for (int i = 1; i < nRects; i++) |
| 169 if (fRet >= pArray[i]) | 158 if (fRet >= pArray[i]) |
| 170 fRet = pArray[i]; | 159 fRet = pArray[i]; |
| 171 } | 160 } |
| 172 delete[] pArray; | |
| 173 return fRet; | 161 return fRet; |
| 174 } | 162 } |
| 175 | 163 |
| 176 CFX_FloatRect CalculateRect(CPDF_RectArray* pRectArray) { | 164 CFX_FloatRect CalculateRect(std::vector<CFX_FloatRect>* pRectArray) { |
| 177 CFX_FloatRect rcRet; | 165 CFX_FloatRect rcRet; |
| 178 | 166 |
| 179 rcRet.left = GetMinMaxValue(*pRectArray, MIN, LEFT); | 167 rcRet.left = GetMinMaxValue(*pRectArray, MIN, LEFT); |
| 180 rcRet.top = GetMinMaxValue(*pRectArray, MAX, TOP); | 168 rcRet.top = GetMinMaxValue(*pRectArray, MAX, TOP); |
| 181 rcRet.right = GetMinMaxValue(*pRectArray, MAX, RIGHT); | 169 rcRet.right = GetMinMaxValue(*pRectArray, MAX, RIGHT); |
| 182 rcRet.bottom = GetMinMaxValue(*pRectArray, MIN, BOTTOM); | 170 rcRet.bottom = GetMinMaxValue(*pRectArray, MIN, BOTTOM); |
| 183 | 171 |
| 184 return rcRet; | 172 return rcRet; |
| 185 } | 173 } |
| 186 | 174 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 | 231 |
| 244 FX_FLOAT e = rcAnnot.left - rcStream.left * a; | 232 FX_FLOAT e = rcAnnot.left - rcStream.left * a; |
| 245 FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d; | 233 FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d; |
| 246 return CFX_Matrix(a, 0, 0, d, e, f); | 234 return CFX_Matrix(a, 0, 0, d, e, f); |
| 247 } | 235 } |
| 248 | 236 |
| 249 } // namespace | 237 } // namespace |
| 250 | 238 |
| 251 DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { | 239 DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { |
| 252 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 240 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 253 if (!page) { | 241 if (!page) |
| 254 return FLATTEN_FAIL; | 242 return FLATTEN_FAIL; |
| 255 } | |
| 256 | 243 |
| 257 CPDF_Document* pDocument = pPage->m_pDocument; | 244 CPDF_Document* pDocument = pPage->m_pDocument; |
| 258 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; | 245 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; |
| 259 | 246 if (!pDocument || !pPageDict) |
| 260 if (!pDocument || !pPageDict) { | |
| 261 return FLATTEN_FAIL; | 247 return FLATTEN_FAIL; |
| 262 } | |
| 263 | 248 |
| 264 std::vector<CPDF_Dictionary*> ObjectArray; | 249 std::vector<CPDF_Dictionary*> ObjectArray; |
| 265 CPDF_RectArray RectArray; | 250 std::vector<CFX_FloatRect> RectArray; |
| 266 | 251 int iRet = |
| 267 int iRet = FLATTEN_FAIL; | 252 ParserAnnots(pDocument, pPageDict, &RectArray, &ObjectArray, nFlag); |
| 268 iRet = ParserAnnots(pDocument, pPageDict, &RectArray, &ObjectArray, nFlag); | |
| 269 if (iRet == FLATTEN_NOTHINGTODO || iRet == FLATTEN_FAIL) | 253 if (iRet == FLATTEN_NOTHINGTODO || iRet == FLATTEN_FAIL) |
| 270 return iRet; | 254 return iRet; |
| 271 | 255 |
| 272 CFX_FloatRect rcOriginalCB; | 256 CFX_FloatRect rcOriginalCB; |
| 273 CFX_FloatRect rcMerger = CalculateRect(&RectArray); | 257 CFX_FloatRect rcMerger = CalculateRect(&RectArray); |
| 274 CFX_FloatRect rcOriginalMB = pPageDict->GetRectFor("MediaBox"); | 258 CFX_FloatRect rcOriginalMB = pPageDict->GetRectFor("MediaBox"); |
| 275 | |
| 276 if (pPageDict->KeyExist("CropBox")) | 259 if (pPageDict->KeyExist("CropBox")) |
| 277 rcOriginalMB = pPageDict->GetRectFor("CropBox"); | 260 rcOriginalMB = pPageDict->GetRectFor("CropBox"); |
| 278 | 261 |
| 279 if (rcOriginalMB.IsEmpty()) { | 262 if (rcOriginalMB.IsEmpty()) |
| 280 rcOriginalMB = CFX_FloatRect(0.0f, 0.0f, 612.0f, 792.0f); | 263 rcOriginalMB = CFX_FloatRect(0.0f, 0.0f, 612.0f, 792.0f); |
| 281 } | |
| 282 | 264 |
| 283 rcMerger.left = | 265 rcMerger.left = std::max(rcMerger.left, rcOriginalMB.left); |
|
Tom Sepez
2016/11/09 21:34:06
Note: Doublecheck my logic here.
| |
| 284 rcMerger.left < rcOriginalMB.left ? rcOriginalMB.left : rcMerger.left; | 266 rcMerger.right = std::min(rcMerger.right, rcOriginalMB.right); |
| 285 rcMerger.right = | 267 rcMerger.bottom = std::max(rcMerger.bottom, rcOriginalMB.bottom); |
| 286 rcMerger.right > rcOriginalMB.right ? rcOriginalMB.right : rcMerger.right; | 268 rcMerger.top = std::min(rcMerger.top, rcOriginalMB.top); |
| 287 rcMerger.top = | |
| 288 rcMerger.top > rcOriginalMB.top ? rcOriginalMB.top : rcMerger.top; | |
| 289 rcMerger.bottom = rcMerger.bottom < rcOriginalMB.bottom ? rcOriginalMB.bottom | |
| 290 : rcMerger.bottom; | |
| 291 | |
| 292 if (pPageDict->KeyExist("ArtBox")) | 269 if (pPageDict->KeyExist("ArtBox")) |
| 293 rcOriginalCB = pPageDict->GetRectFor("ArtBox"); | 270 rcOriginalCB = pPageDict->GetRectFor("ArtBox"); |
| 294 else | 271 else |
| 295 rcOriginalCB = rcOriginalMB; | 272 rcOriginalCB = rcOriginalMB; |
| 296 | 273 |
| 297 if (!rcOriginalMB.IsEmpty()) { | 274 if (!rcOriginalMB.IsEmpty()) { |
| 298 CPDF_Array* pMediaBox = new CPDF_Array(); | 275 CPDF_Array* pMediaBox = new CPDF_Array(); |
| 299 pMediaBox->Add(new CPDF_Number(rcOriginalMB.left)); | 276 pMediaBox->Add(new CPDF_Number(rcOriginalMB.left)); |
| 300 pMediaBox->Add(new CPDF_Number(rcOriginalMB.bottom)); | 277 pMediaBox->Add(new CPDF_Number(rcOriginalMB.bottom)); |
| 301 pMediaBox->Add(new CPDF_Number(rcOriginalMB.right)); | 278 pMediaBox->Add(new CPDF_Number(rcOriginalMB.right)); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 323 | 300 |
| 324 uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject); | 301 uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject); |
| 325 CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject"); | 302 CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject"); |
| 326 if (!pPageXObject) { | 303 if (!pPageXObject) { |
| 327 pPageXObject = new CPDF_Dictionary(pDocument->GetByteStringPool()); | 304 pPageXObject = new CPDF_Dictionary(pDocument->GetByteStringPool()); |
| 328 pRes->SetFor("XObject", pPageXObject); | 305 pRes->SetFor("XObject", pPageXObject); |
| 329 } | 306 } |
| 330 | 307 |
| 331 CFX_ByteString key = ""; | 308 CFX_ByteString key = ""; |
| 332 int nStreams = pdfium::CollectionSize<int>(ObjectArray); | 309 int nStreams = pdfium::CollectionSize<int>(ObjectArray); |
| 333 | |
| 334 if (nStreams > 0) { | 310 if (nStreams > 0) { |
| 335 for (int iKey = 0; /*iKey < 100*/; iKey++) { | 311 for (int iKey = 0; /*iKey < 100*/; iKey++) { |
| 336 char sExtend[5] = {}; | 312 char sExtend[5] = {}; |
| 337 FXSYS_itoa(iKey, sExtend, 10); | 313 FXSYS_itoa(iKey, sExtend, 10); |
| 338 key = CFX_ByteString("FFT") + CFX_ByteString(sExtend); | 314 key = CFX_ByteString("FFT") + CFX_ByteString(sExtend); |
| 339 if (!pPageXObject->KeyExist(key)) | 315 if (!pPageXObject->KeyExist(key)) |
| 340 break; | 316 break; |
| 341 } | 317 } |
| 342 } | 318 } |
| 343 | 319 |
| 344 SetPageContents(key, pPageDict, pDocument); | 320 SetPageContents(key, pPageDict, pDocument); |
| 345 | 321 |
| 346 CPDF_Dictionary* pNewXORes = nullptr; | 322 CPDF_Dictionary* pNewXORes = nullptr; |
| 347 | |
| 348 if (!key.IsEmpty()) { | 323 if (!key.IsEmpty()) { |
| 349 pPageXObject->SetReferenceFor(key, pDocument, dwObjNum); | 324 pPageXObject->SetReferenceFor(key, pDocument, dwObjNum); |
| 350 CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict(); | 325 CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict(); |
| 351 pNewXORes = new CPDF_Dictionary(pDocument->GetByteStringPool()); | 326 pNewXORes = new CPDF_Dictionary(pDocument->GetByteStringPool()); |
| 352 pNewOXbjectDic->SetFor("Resources", pNewXORes); | 327 pNewOXbjectDic->SetFor("Resources", pNewXORes); |
| 353 pNewOXbjectDic->SetNameFor("Type", "XObject"); | 328 pNewOXbjectDic->SetNameFor("Type", "XObject"); |
| 354 pNewOXbjectDic->SetNameFor("Subtype", "Form"); | 329 pNewOXbjectDic->SetNameFor("Subtype", "Form"); |
| 355 pNewOXbjectDic->SetIntegerFor("FormType", 1); | 330 pNewOXbjectDic->SetIntegerFor("FormType", 1); |
| 356 pNewOXbjectDic->SetNameFor("Name", "FRM"); | 331 pNewOXbjectDic->SetNameFor("Name", "FRM"); |
| 357 CFX_FloatRect rcBBox = pPageDict->GetRectFor("ArtBox"); | 332 CFX_FloatRect rcBBox = pPageDict->GetRectFor("ArtBox"); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 } | 420 } |
| 446 | 421 |
| 447 CFX_ByteString sTemp; | 422 CFX_ByteString sTemp; |
| 448 CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix); | 423 CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix); |
| 449 sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, | 424 sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, |
| 450 sFormName.c_str()); | 425 sFormName.c_str()); |
| 451 sStream += sTemp; | 426 sStream += sTemp; |
| 452 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength()); | 427 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength()); |
| 453 } | 428 } |
| 454 pPageDict->RemoveFor("Annots"); | 429 pPageDict->RemoveFor("Annots"); |
| 455 | |
| 456 RectArray.RemoveAll(); | |
| 457 return FLATTEN_SUCCESS; | 430 return FLATTEN_SUCCESS; |
| 458 } | 431 } |
| OLD | NEW |