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

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

Issue 1408063016: Fix a leak in CPDF_Type3Font::LoadChar(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@parser_b268
Patch Set: remove dead code, m_bPageRequired is always false Created 5 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 | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | no next file » | 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 "../../../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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 line += line_step; 122 line += line_step;
123 } 123 }
124 return -1; 124 return -1;
125 } 125 }
126 CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, 126 CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
127 FX_DWORD charcode, 127 FX_DWORD charcode,
128 const CFX_AffineMatrix* pMatrix, 128 const CFX_AffineMatrix* pMatrix,
129 FX_FLOAT retinaScaleX, 129 FX_FLOAT retinaScaleX,
130 FX_FLOAT retinaScaleY) { 130 FX_FLOAT retinaScaleY) {
131 CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); 131 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode);
132 if (pChar == NULL || pChar->m_pBitmap == NULL) { 132 if (!pChar || !pChar->m_pBitmap)
133 return NULL; 133 return nullptr;
134 } 134
135 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; 135 CFX_DIBitmap* pBitmap = pChar->m_pBitmap;
136 CFX_AffineMatrix image_matrix, text_matrix; 136 CFX_AffineMatrix image_matrix, text_matrix;
137 image_matrix = pChar->m_ImageMatrix; 137 image_matrix = pChar->m_ImageMatrix;
138 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); 138 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0);
139 image_matrix.Concat(text_matrix); 139 image_matrix.Concat(text_matrix);
140 CFX_DIBitmap* pResBitmap = NULL; 140 CFX_DIBitmap* pResBitmap = NULL;
141 int left, top; 141 int left, top;
142 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && 142 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 &&
143 FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { 143 FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) {
144 int top_line, bottom_line; 144 int top_line, bottom_line;
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 ProcessPath(&path, pObj2Device); 790 ProcessPath(&path, pObj2Device);
791 } 791 }
792 } 792 }
793 793
794 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { 794 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) {
795 int glyph_index = GlyphFromCharCode(charcode); 795 int glyph_index = GlyphFromCharCode(charcode);
796 if (!m_Font.GetFace()) 796 if (!m_Font.GetFace())
797 return nullptr; 797 return nullptr;
798 return m_Font.LoadGlyphPath(glyph_index, dest_width); 798 return m_Font.LoadGlyphPath(glyph_index, dest_width);
799 } 799 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698