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 "core/fpdfapi/fpdf_font/cpdf_cidfont.h" |
| 10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" |
| 11 #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" |
| 12 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
9 #include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h" | 13 #include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 14 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
11 #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" | 15 #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" |
12 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" | 16 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" |
13 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" | 17 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" |
14 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" | 18 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" |
15 #include "core/fpdfapi/fpdf_page/pageint.h" | 19 #include "core/fpdfapi/fpdf_page/pageint.h" |
16 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 20 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
17 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 21 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
18 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" | 22 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE); | 315 pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE); |
312 return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont); | 316 return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont); |
313 } | 317 } |
314 static void ReleaseCachedType3(CPDF_Type3Font* pFont) { | 318 static void ReleaseCachedType3(CPDF_Type3Font* pFont) { |
315 if (!pFont->m_pDocument) { | 319 if (!pFont->m_pDocument) { |
316 return; | 320 return; |
317 } | 321 } |
318 pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont); | 322 pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont); |
319 pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict()); | 323 pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict()); |
320 } | 324 } |
321 FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { | 325 |
322 if (m_pBitmap || !m_pForm) { | |
323 return TRUE; | |
324 } | |
325 if (m_pForm->GetPageObjectList()->size() == 1 && !m_bColored) { | |
326 auto& pPageObj = m_pForm->GetPageObjectList()->front(); | |
327 if (pPageObj->IsImage()) { | |
328 m_ImageMatrix = pPageObj->AsImage()->m_Matrix; | |
329 const CFX_DIBSource* pSource = | |
330 pPageObj->AsImage()->m_pImage->LoadDIBSource(); | |
331 if (pSource) { | |
332 m_pBitmap = pSource->Clone(); | |
333 delete pSource; | |
334 } | |
335 delete m_pForm; | |
336 m_pForm = NULL; | |
337 return TRUE; | |
338 } | |
339 } | |
340 return FALSE; | |
341 } | |
342 class CPDF_RefType3Cache { | 326 class CPDF_RefType3Cache { |
343 public: | 327 public: |
344 CPDF_RefType3Cache(CPDF_Type3Font* pType3Font) { | 328 CPDF_RefType3Cache(CPDF_Type3Font* pType3Font) { |
345 m_dwCount = 0; | 329 m_dwCount = 0; |
346 m_pType3Font = pType3Font; | 330 m_pType3Font = pType3Font; |
347 } | 331 } |
348 ~CPDF_RefType3Cache() { | 332 ~CPDF_RefType3Cache() { |
349 while (m_dwCount--) { | 333 while (m_dwCount--) { |
350 ReleaseCachedType3(m_pType3Font); | 334 ReleaseCachedType3(m_pType3Font); |
351 } | 335 } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 767 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
784 charpos.m_OriginY); | 768 charpos.m_OriginY); |
785 path.m_Path.New()->Append(pPath, &matrix); | 769 path.m_Path.New()->Append(pPath, &matrix); |
786 path.m_Matrix = *pTextMatrix; | 770 path.m_Matrix = *pTextMatrix; |
787 path.m_bStroke = bStroke; | 771 path.m_bStroke = bStroke; |
788 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 772 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
789 path.CalcBoundingBox(); | 773 path.CalcBoundingBox(); |
790 ProcessPath(&path, pObj2Device); | 774 ProcessPath(&path, pObj2Device); |
791 } | 775 } |
792 } | 776 } |
OLD | NEW |