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

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

Issue 2287313004: Make CPDF_TextState have a CPDF_TextStateData rather than inheriting one. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@moar_better_constness
Patch Set: Casts, Casts, New -> Emplace. Created 4 years, 3 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/include/cpdf_textstatedata.h ('k') | core/fpdftext/cpdf_textpage.cpp » ('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 <vector> 9 #include <vector>
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 pGlyph->m_Bitmap.TakeOver(pResBitmap.get()); 224 pGlyph->m_Bitmap.TakeOver(pResBitmap.get());
225 return pGlyph; 225 return pGlyph;
226 } 226 }
227 227
228 FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, 228 FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
229 const CFX_Matrix* pObj2Device, 229 const CFX_Matrix* pObj2Device,
230 CFX_PathData* pClippingPath) { 230 CFX_PathData* pClippingPath) {
231 if (textobj->m_nChars == 0) 231 if (textobj->m_nChars == 0)
232 return TRUE; 232 return TRUE;
233 233
234 const TextRenderingMode& text_render_mode = 234 const TextRenderingMode text_render_mode = textobj->m_TextState.GetTextMode();
235 textobj->m_TextState.GetObject()->m_TextMode;
236 if (text_render_mode == TextRenderingMode::MODE_INVISIBLE) 235 if (text_render_mode == TextRenderingMode::MODE_INVISIBLE)
237 return TRUE; 236 return TRUE;
238 237
239 CPDF_Font* pFont = textobj->m_TextState.GetFont(); 238 CPDF_Font* pFont = textobj->m_TextState.GetFont();
240 if (pFont->IsType3Font()) 239 if (pFont->IsType3Font())
241 return ProcessType3Text(textobj, pObj2Device); 240 return ProcessType3Text(textobj, pObj2Device);
242 241
243 bool bFill = false; 242 bool bFill = false;
244 bool bStroke = false; 243 bool bStroke = false;
245 bool bClip = false; 244 bool bClip = false;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); 300 FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
302 if (bPattern) { 301 if (bPattern) {
303 DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, 302 DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
304 &text_matrix, bFill, bStroke); 303 &text_matrix, bFill, bStroke);
305 return TRUE; 304 return TRUE;
306 } 305 }
307 if (bClip || bStroke) { 306 if (bClip || bStroke) {
308 const CFX_Matrix* pDeviceMatrix = pObj2Device; 307 const CFX_Matrix* pDeviceMatrix = pObj2Device;
309 CFX_Matrix device_matrix; 308 CFX_Matrix device_matrix;
310 if (bStroke) { 309 if (bStroke) {
311 const FX_FLOAT* pCTM = textobj->m_TextState.GetObject()->m_CTM; 310 const FX_FLOAT* pCTM = textobj->m_TextState.GetCTM();
312 if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) { 311 if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) {
313 CFX_Matrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0); 312 CFX_Matrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0);
314 text_matrix.ConcatInverse(ctm); 313 text_matrix.ConcatInverse(ctm);
315 device_matrix.Copy(ctm); 314 device_matrix.Copy(ctm);
316 device_matrix.Concat(*pObj2Device); 315 device_matrix.Concat(*pObj2Device);
317 pDeviceMatrix = &device_matrix; 316 pDeviceMatrix = &device_matrix;
318 } 317 }
319 } 318 }
320 int flag = 0; 319 int flag = 0;
321 if (bStroke && bFill) { 320 if (bStroke && bFill) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 FX_BOOL bFill, 809 FX_BOOL bFill,
811 FX_BOOL bStroke) { 810 FX_BOOL bStroke) {
812 if (!bStroke) { 811 if (!bStroke) {
813 CPDF_PathObject path; 812 CPDF_PathObject path;
814 std::vector<std::unique_ptr<CPDF_TextObject>> pCopy; 813 std::vector<std::unique_ptr<CPDF_TextObject>> pCopy;
815 pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone())); 814 pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone()));
816 path.m_bStroke = FALSE; 815 path.m_bStroke = FALSE;
817 path.m_FillType = FXFILL_WINDING; 816 path.m_FillType = FXFILL_WINDING;
818 path.m_ClipPath.AppendTexts(&pCopy); 817 path.m_ClipPath.AppendTexts(&pCopy);
819 path.m_ColorState = textobj->m_ColorState; 818 path.m_ColorState = textobj->m_ColorState;
820 path.m_Path.New()->AppendRect(textobj->m_Left, textobj->m_Bottom, 819 path.m_Path.Emplace()->AppendRect(textobj->m_Left, textobj->m_Bottom,
821 textobj->m_Right, textobj->m_Top); 820 textobj->m_Right, textobj->m_Top);
822 path.m_Left = textobj->m_Left; 821 path.m_Left = textobj->m_Left;
823 path.m_Bottom = textobj->m_Bottom; 822 path.m_Bottom = textobj->m_Bottom;
824 path.m_Right = textobj->m_Right; 823 path.m_Right = textobj->m_Right;
825 path.m_Top = textobj->m_Top; 824 path.m_Top = textobj->m_Top;
826 RenderSingleObject(&path, pObj2Device); 825 RenderSingleObject(&path, pObj2Device);
827 return; 826 return;
828 } 827 }
829 CFX_FontCache* pCache; 828 CFX_FontCache* pCache;
830 if (pFont->m_pDocument) { 829 if (pFont->m_pDocument) {
831 pCache = pFont->m_pDocument->GetRenderData()->GetFontCache(); 830 pCache = pFont->m_pDocument->GetRenderData()->GetFontCache();
(...skipping 25 matching lines...) Expand all
857 } 856 }
858 CPDF_PathObject path; 857 CPDF_PathObject path;
859 path.m_GraphState = textobj->m_GraphState; 858 path.m_GraphState = textobj->m_GraphState;
860 path.m_ColorState = textobj->m_ColorState; 859 path.m_ColorState = textobj->m_ColorState;
861 CFX_Matrix matrix; 860 CFX_Matrix matrix;
862 if (charpos.m_bGlyphAdjust) 861 if (charpos.m_bGlyphAdjust)
863 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], 862 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1],
864 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); 863 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0);
865 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, 864 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX,
866 charpos.m_OriginY); 865 charpos.m_OriginY);
867 path.m_Path.New()->Append(pPath, &matrix); 866 path.m_Path.Emplace()->Append(pPath, &matrix);
868 path.m_Matrix = *pTextMatrix; 867 path.m_Matrix = *pTextMatrix;
869 path.m_bStroke = bStroke; 868 path.m_bStroke = bStroke;
870 path.m_FillType = bFill ? FXFILL_WINDING : 0; 869 path.m_FillType = bFill ? FXFILL_WINDING : 0;
871 path.CalcBoundingBox(); 870 path.CalcBoundingBox();
872 ProcessPath(&path, pObj2Device); 871 ProcessPath(&path, pObj2Device);
873 } 872 }
874 } 873 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h ('k') | core/fpdftext/cpdf_textpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698