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

Side by Side Diff: xfa/fxfa/app/xfa_ffdoc.cpp

Issue 2443723002: Rename IFX_ stream names (Closed)
Patch Set: Nits Created 4 years, 1 month 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 | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/app/xfa_ffwidget.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 "xfa/fxfa/xfa_ffdoc.h" 7 #include "xfa/fxfa/xfa_ffdoc.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return pair.second.get(); 283 return pair.second.get();
284 } 284 }
285 return nullptr; 285 return nullptr;
286 } 286 }
287 287
288 CXFA_FFDocView* CXFA_FFDoc::GetDocView() { 288 CXFA_FFDocView* CXFA_FFDoc::GetDocView() {
289 auto it = m_TypeToDocViewMap.begin(); 289 auto it = m_TypeToDocViewMap.begin();
290 return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr; 290 return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr;
291 } 291 }
292 292
293 FX_BOOL CXFA_FFDoc::OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile) { 293 FX_BOOL CXFA_FFDoc::OpenDoc(IFX_SeekableReadStream* pStream,
294 FX_BOOL bTakeOverFile) {
294 m_bOwnStream = bTakeOverFile; 295 m_bOwnStream = bTakeOverFile;
295 m_pStream = pStream; 296 m_pStream = pStream;
296 return TRUE; 297 return TRUE;
297 } 298 }
298 FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { 299 FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
299 if (!pPDFDoc) 300 if (!pPDFDoc)
300 return FALSE; 301 return FALSE;
301 302
302 CPDF_Dictionary* pRoot = pPDFDoc->GetRoot(); 303 CPDF_Dictionary* pRoot = pPDFDoc->GetRoot();
303 if (!pRoot) 304 if (!pRoot)
(...skipping 13 matching lines...) Expand all
317 for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { 318 for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) {
318 if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) 319 if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1))
319 xfaStreams.push_back(pStream); 320 xfaStreams.push_back(pStream);
320 } 321 }
321 } else if (pElementXFA->IsStream()) { 322 } else if (pElementXFA->IsStream()) {
322 xfaStreams.push_back((CPDF_Stream*)pElementXFA); 323 xfaStreams.push_back((CPDF_Stream*)pElementXFA);
323 } 324 }
324 if (xfaStreams.empty()) 325 if (xfaStreams.empty())
325 return FALSE; 326 return FALSE;
326 327
327 IFX_FileRead* pFileRead = new CXFA_FileRead(xfaStreams); 328 IFX_SeekableReadStream* pFileRead = new CXFA_FileRead(xfaStreams);
328 m_pPDFDoc = pPDFDoc; 329 m_pPDFDoc = pPDFDoc;
329 if (m_pStream) { 330 if (m_pStream) {
330 m_pStream->Release(); 331 m_pStream->Release();
331 m_pStream = nullptr; 332 m_pStream = nullptr;
332 } 333 }
333 m_pStream = pFileRead; 334 m_pStream = pFileRead;
334 m_bOwnStream = TRUE; 335 m_bOwnStream = TRUE;
335 return TRUE; 336 return TRUE;
336 } 337 }
337 338
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 410 }
410 } 411 }
411 412
412 CPDF_Stream* pStream = ToStream(pObject); 413 CPDF_Stream* pStream = ToStream(pObject);
413 if (!pStream) 414 if (!pStream)
414 return nullptr; 415 return nullptr;
415 416
416 CPDF_StreamAcc streamAcc; 417 CPDF_StreamAcc streamAcc;
417 streamAcc.LoadAllData(pStream); 418 streamAcc.LoadAllData(pStream);
418 419
419 IFX_FileRead* pImageFileRead = 420 IFX_SeekableReadStream* pImageFileRead =
420 FX_CreateMemoryStream((uint8_t*)streamAcc.GetData(), streamAcc.GetSize()); 421 FX_CreateMemoryStream((uint8_t*)streamAcc.GetData(), streamAcc.GetSize());
421 422
422 CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer( 423 CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer(
423 pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi); 424 pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
424 m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi}; 425 m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi};
425 pImageFileRead->Release(); 426 pImageFileRead->Release();
426 return pDibSource; 427 return pDibSource;
427 } 428 }
428 429
429 bool CXFA_FFDoc::SavePackage(XFA_HashCode code, 430 bool CXFA_FFDoc::SavePackage(XFA_HashCode code,
430 IFX_FileWrite* pFile, 431 IFX_SeekableWriteStream* pFile,
431 CXFA_ChecksumContext* pCSContext) { 432 CXFA_ChecksumContext* pCSContext) {
432 CXFA_Document* doc = m_pDocumentParser->GetDocument(); 433 CXFA_Document* doc = m_pDocumentParser->GetDocument();
433 434
434 std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc)); 435 std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc));
435 CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot() 436 CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot()
436 : ToNode(doc->GetXFAObject(code)); 437 : ToNode(doc->GetXFAObject(code));
437 if (!pNode) 438 if (!pNode)
438 return !!pExport->Export(pFile); 439 return !!pExport->Export(pFile);
439 440
440 CFX_ByteString bsChecksum; 441 CFX_ByteString bsChecksum;
441 if (pCSContext) 442 if (pCSContext)
442 bsChecksum = pCSContext->GetChecksum(); 443 bsChecksum = pCSContext->GetChecksum();
443 444
444 return !!pExport->Export( 445 return !!pExport->Export(
445 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); 446 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
446 } 447 }
447 448
448 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { 449 FX_BOOL CXFA_FFDoc::ImportData(IFX_SeekableReadStream* pStream, FX_BOOL bXDP) {
449 std::unique_ptr<CXFA_DataImporter> importer( 450 std::unique_ptr<CXFA_DataImporter> importer(
450 new CXFA_DataImporter(m_pDocumentParser->GetDocument())); 451 new CXFA_DataImporter(m_pDocumentParser->GetDocument()));
451 return importer->ImportData(pStream); 452 return importer->ImportData(pStream);
452 } 453 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/app/xfa_ffwidget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698