OLD | NEW |
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 Loading... |
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->m_TextMode; |
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 Loading... |
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->m_CTM; |
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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.New()->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 } |
OLD | NEW |