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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp

Issue 893493002: Merge to XFA: Fix infinite recursion in CPDF_RenderStatus::RenderSingleObject(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 10 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 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 "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fpdfapi/fpdf_render.h" 8 #include "../../../include/fpdfapi/fpdf_render.h"
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../../include/fpdfapi/fpdf_pageobj.h"
10 #include "../fpdf_page/pageint.h" 10 #include "../fpdf_page/pageint.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 CPDF_GraphicStates* pStates = CloneObjStates(textobj, FALSE); 416 CPDF_GraphicStates* pStates = CloneObjStates(textobj, FALSE);
417 CPDF_RenderOptions Options = m_Options; 417 CPDF_RenderOptions Options = m_Options;
418 Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA; 418 Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA;
419 Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE; 419 Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE;
420 CPDF_Dictionary* pFormResource = NULL; 420 CPDF_Dictionary* pFormResource = NULL;
421 if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) { 421 if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) {
422 pFormResource = pType3Char->m_pForm->m_pFormDict->GetDict(FX_BST RC("Resources")); 422 pFormResource = pType3Char->m_pForm->m_pFormDict->GetDict(FX_BST RC("Resources"));
423 } 423 }
424 if (fill_alpha == 255) { 424 if (fill_alpha == 255) {
425 CPDF_RenderStatus status; 425 CPDF_RenderStatus status;
426 status.Initialize(m_Level + 1, m_pContext, m_pDevice, NULL, NULL , this, pStates, &Options, 426 status.Initialize(m_pContext, m_pDevice, NULL, NULL, this, pStat es, &Options,
427 pType3Char->m_pForm->m_Transparency, m_bDropOb jects, pFormResource, FALSE, pType3Char, fill_argb); 427 pType3Char->m_pForm->m_Transparency, m_bDropOb jects, pFormResource, FALSE, pType3Char, fill_argb);
428 status.m_Type3FontCache.Append(m_Type3FontCache); 428 status.m_Type3FontCache.Append(m_Type3FontCache);
429 status.m_Type3FontCache.Add(pType3Font); 429 status.m_Type3FontCache.Add(pType3Font);
430 m_pDevice->SaveState(); 430 m_pDevice->SaveState();
431 status.RenderObjectList(pType3Char->m_pForm, &matrix); 431 status.RenderObjectList(pType3Char->m_pForm, &matrix);
432 m_pDevice->RestoreState(); 432 m_pDevice->RestoreState();
433 } else { 433 } else {
434 CFX_FloatRect rect_f = pType3Char->m_pForm->CalcBoundingBox(); 434 CFX_FloatRect rect_f = pType3Char->m_pForm->CalcBoundingBox();
435 rect_f.Transform(&matrix); 435 rect_f.Transform(&matrix);
436 FX_RECT rect = rect_f.GetOutterRect(); 436 FX_RECT rect = rect_f.GetOutterRect();
437 CFX_FxgeDevice bitmap_device; 437 CFX_FxgeDevice bitmap_device;
438 if (!bitmap_device.Create((int)(rect.Width() * sa), (int)(rect.H eight() * sd), FXDIB_Argb)) { 438 if (!bitmap_device.Create((int)(rect.Width() * sa), (int)(rect.H eight() * sd), FXDIB_Argb)) {
439 return TRUE; 439 return TRUE;
440 } 440 }
441 bitmap_device.GetBitmap()->Clear(0); 441 bitmap_device.GetBitmap()->Clear(0);
442 CPDF_RenderStatus status; 442 CPDF_RenderStatus status;
443 status.Initialize(m_Level + 1, m_pContext, &bitmap_device, NULL, NULL, this, pStates, &Options, 443 status.Initialize(m_pContext, &bitmap_device, NULL, NULL, this, pStates, &Options,
444 pType3Char->m_pForm->m_Transparency, m_bDropOb jects, pFormResource, FALSE, pType3Char, fill_argb); 444 pType3Char->m_pForm->m_Transparency, m_bDropOb jects, pFormResource, FALSE, pType3Char, fill_argb);
445 status.m_Type3FontCache.Append(m_Type3FontCache); 445 status.m_Type3FontCache.Append(m_Type3FontCache);
446 status.m_Type3FontCache.Add(pType3Font); 446 status.m_Type3FontCache.Add(pType3Font);
447 matrix.TranslateI(-rect.left, -rect.top); 447 matrix.TranslateI(-rect.left, -rect.top);
448 matrix.Scale(sa, sd); 448 matrix.Scale(sa, sd);
449 status.RenderObjectList(pType3Char->m_pForm, &matrix); 449 status.RenderObjectList(pType3Char->m_pForm, &matrix);
450 m_pDevice->SetDIBits(bitmap_device.GetBitmap(), rect.left, rect. top); 450 m_pDevice->SetDIBits(bitmap_device.GetBitmap(), rect.left, rect. top);
451 } 451 }
452 delete pStates; 452 delete pStates;
453 } else if (pType3Char->m_pBitmap) { 453 } else if (pType3Char->m_pBitmap) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 737 }
738 } 738 }
739 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) 739 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width)
740 { 740 {
741 int glyph_index = GlyphFromCharCode(charcode); 741 int glyph_index = GlyphFromCharCode(charcode);
742 if (m_Font.m_Face == NULL) { 742 if (m_Font.m_Face == NULL) {
743 return NULL; 743 return NULL;
744 } 744 }
745 return m_Font.LoadGlyphPath(glyph_index, dest_width); 745 return m_Font.LoadGlyphPath(glyph_index, dest_width);
746 } 746 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp ('k') | core/src/fpdfapi/fpdf_render/render_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698