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

Side by Side Diff: core/fpdfapi/parser/cpdf_document.cpp

Issue 2442403002: Traverse PDF page tree only once in CPDF_Document Try 2 (Closed)
Patch Set: 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
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 "core/fpdfapi/parser/cpdf_document.h" 7 #include "core/fpdfapi/parser/cpdf_document.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <utility>
11 #include <vector> 12 #include <vector>
12 13
13 #include "core/fpdfapi/cpdf_modulemgr.h" 14 #include "core/fpdfapi/cpdf_modulemgr.h"
14 #include "core/fpdfapi/font/cpdf_fontencoding.h" 15 #include "core/fpdfapi/font/cpdf_fontencoding.h"
15 #include "core/fpdfapi/page/cpdf_docpagedata.h" 16 #include "core/fpdfapi/page/cpdf_docpagedata.h"
16 #include "core/fpdfapi/page/cpdf_pagemodule.h" 17 #include "core/fpdfapi/page/cpdf_pagemodule.h"
17 #include "core/fpdfapi/page/pageint.h" 18 #include "core/fpdfapi/page/pageint.h"
18 #include "core/fpdfapi/parser/cpdf_array.h" 19 #include "core/fpdfapi/parser/cpdf_array.h"
19 #include "core/fpdfapi/parser/cpdf_dictionary.h" 20 #include "core/fpdfapi/parser/cpdf_dictionary.h"
20 #include "core/fpdfapi/parser/cpdf_number.h" 21 #include "core/fpdfapi/parser/cpdf_number.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 int size = end - start + 1; 234 int size = end - start + 1;
234 int* widths = FX_Alloc(int, size); 235 int* widths = FX_Alloc(int, size);
235 int i; 236 int i;
236 for (i = 0; i < size; i++) { 237 for (i = 0; i < size; i++) {
237 int glyph_index = pEncoding->GlyphFromCharCode(start + i); 238 int glyph_index = pEncoding->GlyphFromCharCode(start + i);
238 widths[i] = pFont->GetGlyphWidth(glyph_index); 239 widths[i] = pFont->GetGlyphWidth(glyph_index);
239 } 240 }
240 InsertWidthArrayImpl(widths, size, pWidthArray); 241 InsertWidthArrayImpl(widths, size, pWidthArray);
241 } 242 }
242 243
243 int InsertDeletePDFPage(CPDF_Document* pDoc,
244 CPDF_Dictionary* pPages,
245 int nPagesToGo,
246 CPDF_Dictionary* pPage,
247 FX_BOOL bInsert,
248 std::set<CPDF_Dictionary*>* pVisited) {
249 CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
250 if (!pKidList)
251 return -1;
252
253 for (size_t i = 0; i < pKidList->GetCount(); i++) {
254 CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
255 if (pKid->GetStringFor("Type") == "Page") {
256 if (nPagesToGo == 0) {
257 if (bInsert) {
258 pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum()));
259 pPage->SetReferenceFor("Parent", pDoc, pPages->GetObjNum());
260 } else {
261 pKidList->RemoveAt(i);
262 }
263 pPages->SetIntegerFor(
264 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1));
265 return 1;
266 }
267 nPagesToGo--;
268 } else {
269 int nPages = pKid->GetIntegerFor("Count");
270 if (nPagesToGo < nPages) {
271 if (pdfium::ContainsKey(*pVisited, pKid))
272 return -1;
273
274 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid);
275 if (InsertDeletePDFPage(pDoc, pKid, nPagesToGo, pPage, bInsert,
276 pVisited) < 0) {
277 return -1;
278 }
279 pPages->SetIntegerFor(
280 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1));
281 return 1;
282 }
283 nPagesToGo -= nPages;
284 }
285 }
286 return 0;
287 }
288
289 int InsertNewPage(CPDF_Document* pDoc,
290 int iPage,
291 CPDF_Dictionary* pPageDict,
292 CFX_ArrayTemplate<uint32_t>& pageList) {
293 CPDF_Dictionary* pRoot = pDoc->GetRoot();
294 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr;
295 if (!pPages)
296 return -1;
297
298 int nPages = pDoc->GetPageCount();
299 if (iPage < 0 || iPage > nPages)
300 return -1;
301
302 if (iPage == nPages) {
303 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids");
304 if (!pPagesList) {
305 pPagesList = new CPDF_Array;
306 pPages->SetFor("Kids", pPagesList);
307 }
308 pPagesList->Add(new CPDF_Reference(pDoc, pPageDict->GetObjNum()));
309 pPages->SetIntegerFor("Count", nPages + 1);
310 pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum());
311 } else {
312 std::set<CPDF_Dictionary*> stack = {pPages};
313 if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0)
314 return -1;
315 }
316 pageList.InsertAt(iPage, pPageDict->GetObjNum());
317 return iPage;
318 }
319
320 int CountPages(CPDF_Dictionary* pPages, 244 int CountPages(CPDF_Dictionary* pPages,
321 std::set<CPDF_Dictionary*>* visited_pages) { 245 std::set<CPDF_Dictionary*>* visited_pages) {
322 int count = pPages->GetIntegerFor("Count"); 246 int count = pPages->GetIntegerFor("Count");
323 if (count > 0 && count < FPDF_PAGE_MAX_NUM) 247 if (count > 0 && count < FPDF_PAGE_MAX_NUM)
324 return count; 248 return count;
325 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); 249 CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
326 if (!pKidList) 250 if (!pKidList)
327 return 0; 251 return 0;
328 count = 0; 252 count = 0;
329 for (size_t i = 0; i < pKidList->GetCount(); i++) { 253 for (size_t i = 0; i < pKidList->GetCount(); i++) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 return pFontDesc; 330 return pFontDesc;
407 } 331 }
408 332
409 } // namespace 333 } // namespace
410 334
411 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) 335 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser)
412 : CPDF_IndirectObjectHolder(), 336 : CPDF_IndirectObjectHolder(),
413 m_pParser(std::move(pParser)), 337 m_pParser(std::move(pParser)),
414 m_pRootDict(nullptr), 338 m_pRootDict(nullptr),
415 m_pInfoDict(nullptr), 339 m_pInfoDict(nullptr),
340 m_iLastPageTraversed(-1),
416 m_bLinearized(false), 341 m_bLinearized(false),
417 m_iFirstPageNo(0), 342 m_iFirstPageNo(0),
418 m_dwFirstPageObjNum(0), 343 m_dwFirstPageObjNum(0),
419 m_pDocPage(new CPDF_DocPageData(this)), 344 m_pDocPage(new CPDF_DocPageData(this)),
420 m_pDocRender(new CPDF_DocRenderData(this)), 345 m_pDocRender(new CPDF_DocRenderData(this)),
421 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { 346 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {
422 if (pParser) 347 if (pParser)
423 SetLastObjNum(m_pParser->GetLastObjNum()); 348 SetLastObjNum(m_pParser->GetLastObjNum());
424 } 349 }
425 350
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 395
471 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); 396 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O");
472 if (ToNumber(pObjNum)) 397 if (ToNumber(pObjNum))
473 m_dwFirstPageObjNum = pObjNum->GetInteger(); 398 m_dwFirstPageObjNum = pObjNum->GetInteger();
474 } 399 }
475 400
476 void CPDF_Document::LoadPages() { 401 void CPDF_Document::LoadPages() {
477 m_PageList.SetSize(RetrievePageCount()); 402 m_PageList.SetSize(RetrievePageCount());
478 } 403 }
479 404
480 CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages, 405 void CPDF_Document::PopAndPropagate() {
npm 2016/10/26 15:04:06 Pop current node. Update index for the parent. Pop
481 int iPage, 406 m_pTreeTraversal.pop();
Tom Sepez 2016/10/26 15:52:23 Do we know that it's not empty to begin with?
npm 2016/10/26 17:20:18 Yes, it is only be called when it is nonempty.
482 int nPagesToGo, 407 if (!m_pTreeTraversal.empty()) {
Tom Sepez 2016/10/26 15:52:23 nit: maybe early return.
npm 2016/10/26 17:20:18 Done.
483 int level) { 408 std::pair<CPDF_Dictionary*, int>* top = &m_pTreeTraversal.top();
409 top->second++;
410 if (top->second ==
411 static_cast<int>(top->first->GetArrayFor("Kids")->GetCount() - 1))
Tom Sepez 2016/10/26 15:52:23 can count change inbetween subsequent calls so tha
npm 2016/10/26 17:20:18 When it is changed in InsertDeletePDFPage, we rese
412 PopAndPropagate();
413 }
414 }
415
416 CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, int nPagesToGo) {
417 std::pair<CPDF_Dictionary*, int>* lastProc = &m_pTreeTraversal.top();
418 CPDF_Dictionary* pPages = lastProc->first;
484 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); 419 CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
485 if (!pKidList) 420 if (!pKidList) {
npm 2016/10/26 15:04:06 This only happens when Pages dict is actually a pa
486 return nPagesToGo == 0 ? pPages : nullptr; 421 PopAndPropagate();
422 if (nPagesToGo != 1)
423 return nullptr;
424 m_PageList.SetAt(iPage, pPages->GetObjNum());
425 return pPages;
426 }
487 427
488 if (level >= FX_MAX_PAGE_LEVEL) 428 if (m_pTreeTraversal.size() >= FX_MAX_PAGE_LEVEL) {
429 PopAndPropagate();
489 return nullptr; 430 return nullptr;
431 }
490 432
491 for (size_t i = 0; i < pKidList->GetCount(); i++) { 433 CPDF_Dictionary* page = nullptr;
434 for (size_t i = lastProc->second + 1; i < pKidList->GetCount(); i++) {
492 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); 435 CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
493 if (!pKid) { 436 if (!pKid) {
494 nPagesToGo--; 437 nPagesToGo--;
438 lastProc->second++;
495 continue; 439 continue;
496 } 440 }
497 if (pKid == pPages) 441 if (pKid == pPages) {
442 lastProc->second++;
498 continue; 443 continue;
444 }
499 if (!pKid->KeyExist("Kids")) { 445 if (!pKid->KeyExist("Kids")) {
500 if (nPagesToGo == 0) 446 m_PageList.SetAt(iPage - nPagesToGo + 1, pKid->GetObjNum());
501 return pKid;
502
503 m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum());
504 nPagesToGo--; 447 nPagesToGo--;
448 lastProc->second++;
449 if (nPagesToGo == 0) {
450 page = pKid;
451 break;
452 }
505 } else { 453 } else {
506 int nPages = pKid->GetIntegerFor("Count"); 454 int nPages = pKid->GetIntegerFor("Count");
507 if (nPagesToGo < nPages) 455 m_pTreeTraversal.push(std::make_pair(pKid, -1));
npm 2016/10/26 15:04:06 Traverse kid, and break if the number of pages to
508 return FindPDFPage(pKid, iPage, nPagesToGo, level + 1); 456 CPDF_Dictionary* pageKid = TraversePDFPages(iPage, nPagesToGo);
509 457 if (nPagesToGo <= nPages) {
458 page = pageKid;
459 break;
460 }
510 nPagesToGo -= nPages; 461 nPagesToGo -= nPages;
511 } 462 }
512 } 463 }
513 return nullptr; 464 if (!m_pTreeTraversal.empty() && lastProc == &m_pTreeTraversal.top() &&
465 lastProc->second == static_cast<int>(pKidList->GetCount() - 1)) {
466 PopAndPropagate();
467 }
468 return page;
514 } 469 }
515 470
516 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { 471 CPDF_Dictionary* CPDF_Document::GetPagesDict() const {
517 CPDF_Dictionary* pRoot = GetRoot(); 472 CPDF_Dictionary* pRoot = GetRoot();
518 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; 473 return pRoot ? pRoot->GetDictFor("Pages") : nullptr;
519 } 474 }
520 475
521 bool CPDF_Document::IsPageLoaded(int iPage) const { 476 bool CPDF_Document::IsPageLoaded(int iPage) const {
522 return !!m_PageList.GetAt(iPage); 477 return !!m_PageList.GetAt(iPage);
523 } 478 }
524 479
525 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { 480 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
526 if (iPage < 0 || iPage >= m_PageList.GetSize()) 481 if (iPage < 0 || iPage >= m_PageList.GetSize())
527 return nullptr; 482 return nullptr;
528 483
529 if (m_bLinearized && (iPage == m_iFirstPageNo)) { 484 if (m_bLinearized && (iPage == m_iFirstPageNo)) {
530 if (CPDF_Dictionary* pDict = 485 if (CPDF_Dictionary* pDict =
531 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { 486 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) {
532 return pDict; 487 return pDict;
533 } 488 }
534 } 489 }
535 490
536 int objnum = m_PageList.GetAt(iPage); 491 int objnum = m_PageList.GetAt(iPage);
537 if (objnum) { 492 if (!objnum) {
538 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) 493 CPDF_Dictionary* pPages = GetPagesDict();
539 return pDict; 494 if (!pPages)
495 return nullptr;
496 if (m_pTreeTraversal.empty())
497 m_pTreeTraversal.push(std::make_pair(pPages, -1));
498 CPDF_Dictionary* page =
499 TraversePDFPages(iPage, iPage - m_iLastPageTraversed);
npm 2016/10/26 15:04:06 Traverse iPage - m_iLastPageTraversed pages, where
500 m_iLastPageTraversed = iPage;
501 return page;
540 } 502 }
541 503 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum)))
542 CPDF_Dictionary* pPages = GetPagesDict(); 504 return pDict;
543 if (!pPages) 505 return nullptr;
544 return nullptr;
545
546 CPDF_Dictionary* pPage = FindPDFPage(pPages, iPage, iPage, 0);
547 if (!pPage)
548 return nullptr;
549
550 m_PageList.SetAt(iPage, pPage->GetObjNum());
551 return pPage;
552 } 506 }
553 507
554 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { 508 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) {
555 m_PageList.SetAt(iPage, objNum); 509 m_PageList.SetAt(iPage, objNum);
556 } 510 }
557 511
558 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, 512 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode,
559 uint32_t& skip_count, 513 uint32_t& skip_count,
560 uint32_t objnum, 514 uint32_t objnum,
561 int& index, 515 int& index,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 pPages->SetFor("Kids", new CPDF_Array); 657 pPages->SetFor("Kids", new CPDF_Array);
704 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); 658 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages));
705 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); 659 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool);
706 AddIndirectObject(m_pInfoDict); 660 AddIndirectObject(m_pInfoDict);
707 } 661 }
708 662
709 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { 663 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) {
710 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); 664 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool);
711 pDict->SetNameFor("Type", "Page"); 665 pDict->SetNameFor("Type", "Page");
712 uint32_t dwObjNum = AddIndirectObject(pDict); 666 uint32_t dwObjNum = AddIndirectObject(pDict);
713 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { 667 if (InsertNewPage(iPage, pDict, m_PageList) < 0) {
714 ReleaseIndirectObject(dwObjNum); 668 ReleaseIndirectObject(dwObjNum);
715 return nullptr; 669 return nullptr;
716 } 670 }
717 return pDict; 671 return pDict;
718 } 672 }
719 673
674 int CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages,
675 int nPagesToGo,
676 CPDF_Dictionary* pPage,
677 FX_BOOL bInsert,
678 std::set<CPDF_Dictionary*>* pVisited) {
679 CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
680 if (!pKidList)
681 return -1;
682
683 for (size_t i = 0; i < pKidList->GetCount(); i++) {
684 CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
685 if (pKid->GetStringFor("Type") == "Page") {
686 if (nPagesToGo == 0) {
687 if (bInsert) {
688 pKidList->InsertAt(i, new CPDF_Reference(this, pPage->GetObjNum()));
689 pPage->SetReferenceFor("Parent", this, pPages->GetObjNum());
690 } else {
691 pKidList->RemoveAt(i);
692 }
693 pPages->SetIntegerFor(
694 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1));
695 // Tree will change, so reset tree transversal variables
696 m_iLastPageTraversed = -1;
697 m_pTreeTraversal = std::stack<std::pair<CPDF_Dictionary*, int>>();
698 return 1;
699 }
700 nPagesToGo--;
701 } else {
702 int nPages = pKid->GetIntegerFor("Count");
703 if (nPagesToGo < nPages) {
704 if (pdfium::ContainsKey(*pVisited, pKid))
705 return -1;
706
707 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid);
708 if (InsertDeletePDFPage(pKid, nPagesToGo, pPage, bInsert, pVisited) <
709 0) {
710 return -1;
711 }
712 pPages->SetIntegerFor(
713 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1));
714 return 1;
715 }
716 nPagesToGo -= nPages;
717 }
718 }
719 return 0;
720 }
721
722 int CPDF_Document::InsertNewPage(int iPage,
723 CPDF_Dictionary* pPageDict,
724 CFX_ArrayTemplate<uint32_t>& pageList) {
725 CPDF_Dictionary* pRoot = GetRoot();
726 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr;
727 if (!pPages)
728 return -1;
729
730 int nPages = GetPageCount();
731 if (iPage < 0 || iPage > nPages)
732 return -1;
733
734 if (iPage == nPages) {
735 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids");
736 if (!pPagesList) {
737 pPagesList = new CPDF_Array;
738 pPages->SetFor("Kids", pPagesList);
739 }
740 pPagesList->Add(new CPDF_Reference(this, pPageDict->GetObjNum()));
741 pPages->SetIntegerFor("Count", nPages + 1);
742 pPageDict->SetReferenceFor("Parent", this, pPages->GetObjNum());
743 } else {
744 std::set<CPDF_Dictionary*> stack = {pPages};
745 if (InsertDeletePDFPage(pPages, iPage, pPageDict, TRUE, &stack) < 0)
746 return -1;
747 }
748 pageList.InsertAt(iPage, pPageDict->GetObjNum());
749 return iPage;
750 }
751
720 void CPDF_Document::DeletePage(int iPage) { 752 void CPDF_Document::DeletePage(int iPage) {
721 CPDF_Dictionary* pPages = GetPagesDict(); 753 CPDF_Dictionary* pPages = GetPagesDict();
722 if (!pPages) 754 if (!pPages)
723 return; 755 return;
724 756
725 int nPages = pPages->GetIntegerFor("Count"); 757 int nPages = pPages->GetIntegerFor("Count");
726 if (iPage < 0 || iPage >= nPages) 758 if (iPage < 0 || iPage >= nPages)
727 return; 759 return;
728 760
729 std::set<CPDF_Dictionary*> stack = {pPages}; 761 std::set<CPDF_Dictionary*> stack = {pPages};
730 if (InsertDeletePDFPage(this, pPages, iPage, nullptr, FALSE, &stack) < 0) 762 if (InsertDeletePDFPage(pPages, iPage, nullptr, FALSE, &stack) < 0)
731 return; 763 return;
732 764
733 m_PageList.RemoveAt(iPage); 765 m_PageList.RemoveAt(iPage);
734 } 766 }
735 767
736 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, 768 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font,
737 CPDF_FontEncoding* pEncoding) { 769 CPDF_FontEncoding* pEncoding) {
738 CFX_ByteString name(font); 770 CFX_ByteString name(font);
739 if (PDF_GetStandardFontName(&name) < 0) 771 if (PDF_GetStandardFontName(&name) < 0)
740 return nullptr; 772 return nullptr;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 pBBox, pLogFont->lfWeight / 5); 1045 pBBox, pLogFont->lfWeight / 5);
1014 pFontDesc->SetIntegerFor("CapHeight", capheight); 1046 pFontDesc->SetIntegerFor("CapHeight", capheight);
1015 pFontDict->SetReferenceFor("FontDescriptor", this, 1047 pFontDict->SetReferenceFor("FontDescriptor", this,
1016 AddIndirectObject(pFontDesc)); 1048 AddIndirectObject(pFontDesc));
1017 hFont = SelectObject(hDC, hFont); 1049 hFont = SelectObject(hDC, hFont);
1018 DeleteObject(hFont); 1050 DeleteObject(hFont);
1019 DeleteDC(hDC); 1051 DeleteDC(hDC);
1020 return LoadFont(pBaseDict); 1052 return LoadFont(pBaseDict);
1021 } 1053 }
1022 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1054 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
OLDNEW
« core/fpdfapi/parser/cpdf_document.h ('K') | « core/fpdfapi/parser/cpdf_document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698