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

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: More vectors, fix leak 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
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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 728 }
729 void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, 729 void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
730 const CFX_Matrix* pObj2Device, 730 const CFX_Matrix* pObj2Device,
731 CPDF_Font* pFont, 731 CPDF_Font* pFont,
732 FX_FLOAT font_size, 732 FX_FLOAT font_size,
733 const CFX_Matrix* pTextMatrix, 733 const CFX_Matrix* pTextMatrix,
734 FX_BOOL bFill, 734 FX_BOOL bFill,
735 FX_BOOL bStroke) { 735 FX_BOOL bStroke) {
736 if (!bStroke) { 736 if (!bStroke) {
737 CPDF_PathObject path; 737 CPDF_PathObject path;
738 CPDF_TextObject* pCopy = textobj->Clone(); 738 std::vector<std::unique_ptr<CPDF_TextObject>> pCopy;
739 pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone()));
739 path.m_bStroke = FALSE; 740 path.m_bStroke = FALSE;
740 path.m_FillType = FXFILL_WINDING; 741 path.m_FillType = FXFILL_WINDING;
741 path.m_ClipPath.AppendTexts(&pCopy, 1); 742 path.m_ClipPath.AppendTexts(&pCopy);
742 path.m_ColorState = textobj->m_ColorState; 743 path.m_ColorState = textobj->m_ColorState;
743 path.m_Path.New()->AppendRect(textobj->m_Left, textobj->m_Bottom, 744 path.m_Path.New()->AppendRect(textobj->m_Left, textobj->m_Bottom,
744 textobj->m_Right, textobj->m_Top); 745 textobj->m_Right, textobj->m_Top);
745 path.m_Left = textobj->m_Left; 746 path.m_Left = textobj->m_Left;
746 path.m_Bottom = textobj->m_Bottom; 747 path.m_Bottom = textobj->m_Bottom;
747 path.m_Right = textobj->m_Right; 748 path.m_Right = textobj->m_Right;
748 path.m_Top = textobj->m_Top; 749 path.m_Top = textobj->m_Top;
749 RenderSingleObject(&path, pObj2Device); 750 RenderSingleObject(&path, pObj2Device);
750 return; 751 return;
751 } 752 }
(...skipping 25 matching lines...) Expand all
777 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, 778 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX,
778 charpos.m_OriginY); 779 charpos.m_OriginY);
779 path.m_Path.New()->Append(pPath, &matrix); 780 path.m_Path.New()->Append(pPath, &matrix);
780 path.m_Matrix = *pTextMatrix; 781 path.m_Matrix = *pTextMatrix;
781 path.m_bStroke = bStroke; 782 path.m_bStroke = bStroke;
782 path.m_FillType = bFill ? FXFILL_WINDING : 0; 783 path.m_FillType = bFill ? FXFILL_WINDING : 0;
783 path.CalcBoundingBox(); 784 path.CalcBoundingBox();
784 ProcessPath(&path, pObj2Device); 785 ProcessPath(&path, pObj2Device);
785 } 786 }
786 } 787 }
OLDNEW
« core/fpdfapi/fpdf_page/include/cpdf_clippath.h ('K') | « core/fpdfapi/fpdf_page/pageint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698