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

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

Issue 1998583002: Fix leak in CPDF_StreamContentParser::AddTextObject(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: CollectionSize Created 4 years, 7 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
« no previous file with comments | « core/fpdfapi/fpdf_page/pageint.h ('k') | core/fxcrt/include/fx_basic.h » ('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 "core/fpdfapi/fpdf_render/render_int.h" 7 #include "core/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" 9 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h"
10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" 10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h"
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 729 }
730 void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, 730 void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
731 const CFX_Matrix* pObj2Device, 731 const CFX_Matrix* pObj2Device,
732 CPDF_Font* pFont, 732 CPDF_Font* pFont,
733 FX_FLOAT font_size, 733 FX_FLOAT font_size,
734 const CFX_Matrix* pTextMatrix, 734 const CFX_Matrix* pTextMatrix,
735 FX_BOOL bFill, 735 FX_BOOL bFill,
736 FX_BOOL bStroke) { 736 FX_BOOL bStroke) {
737 if (!bStroke) { 737 if (!bStroke) {
738 CPDF_PathObject path; 738 CPDF_PathObject path;
739 CPDF_TextObject* pCopy = textobj->Clone(); 739 std::vector<std::unique_ptr<CPDF_TextObject>> pCopy;
740 pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone()));
740 path.m_bStroke = FALSE; 741 path.m_bStroke = FALSE;
741 path.m_FillType = FXFILL_WINDING; 742 path.m_FillType = FXFILL_WINDING;
742 path.m_ClipPath.AppendTexts(&pCopy, 1); 743 path.m_ClipPath.AppendTexts(&pCopy);
743 path.m_ColorState = textobj->m_ColorState; 744 path.m_ColorState = textobj->m_ColorState;
744 path.m_Path.New()->AppendRect(textobj->m_Left, textobj->m_Bottom, 745 path.m_Path.New()->AppendRect(textobj->m_Left, textobj->m_Bottom,
745 textobj->m_Right, textobj->m_Top); 746 textobj->m_Right, textobj->m_Top);
746 path.m_Left = textobj->m_Left; 747 path.m_Left = textobj->m_Left;
747 path.m_Bottom = textobj->m_Bottom; 748 path.m_Bottom = textobj->m_Bottom;
748 path.m_Right = textobj->m_Right; 749 path.m_Right = textobj->m_Right;
749 path.m_Top = textobj->m_Top; 750 path.m_Top = textobj->m_Top;
750 RenderSingleObject(&path, pObj2Device); 751 RenderSingleObject(&path, pObj2Device);
751 return; 752 return;
752 } 753 }
(...skipping 25 matching lines...) Expand all
778 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, 779 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX,
779 charpos.m_OriginY); 780 charpos.m_OriginY);
780 path.m_Path.New()->Append(pPath, &matrix); 781 path.m_Path.New()->Append(pPath, &matrix);
781 path.m_Matrix = *pTextMatrix; 782 path.m_Matrix = *pTextMatrix;
782 path.m_bStroke = bStroke; 783 path.m_bStroke = bStroke;
783 path.m_FillType = bFill ? FXFILL_WINDING : 0; 784 path.m_FillType = bFill ? FXFILL_WINDING : 0;
784 path.CalcBoundingBox(); 785 path.CalcBoundingBox();
785 ProcessPath(&path, pObj2Device); 786 ProcessPath(&path, pObj2Device);
786 } 787 }
787 } 788 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/pageint.h ('k') | core/fxcrt/include/fx_basic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698