| 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 <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 23 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 24 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 24 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
| 25 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 25 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 26 #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" | 26 #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" |
| 27 #include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" | 27 #include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" |
| 28 #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" | 28 #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" |
| 29 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" | 29 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" |
| 30 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" | 30 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" |
| 31 #include "core/fpdfapi/include/cpdf_modulemgr.h" | 31 #include "core/fpdfapi/include/cpdf_modulemgr.h" |
| 32 #include "core/fpdfdoc/include/cpdf_occontext.h" | 32 #include "core/fpdfdoc/include/cpdf_occontext.h" |
| 33 #include "core/fxge/include/cfx_fontcache.h" | |
| 34 #include "core/fxge/include/cfx_fxgedevice.h" | 33 #include "core/fxge/include/cfx_fxgedevice.h" |
| 35 #include "core/fxge/include/cfx_graphstatedata.h" | 34 #include "core/fxge/include/cfx_graphstatedata.h" |
| 36 #include "core/fxge/include/cfx_pathdata.h" | 35 #include "core/fxge/include/cfx_pathdata.h" |
| 37 #include "core/fxge/include/cfx_renderdevice.h" | 36 #include "core/fxge/include/cfx_renderdevice.h" |
| 38 | 37 |
| 39 CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) | 38 CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) |
| 40 : m_pPDFDoc(pPDFDoc), m_pFontCache(new CFX_FontCache) {} | 39 : m_pPDFDoc(pPDFDoc) {} |
| 41 | 40 |
| 42 CPDF_DocRenderData::~CPDF_DocRenderData() { | 41 CPDF_DocRenderData::~CPDF_DocRenderData() { |
| 43 Clear(TRUE); | 42 Clear(TRUE); |
| 44 } | 43 } |
| 45 | 44 |
| 46 void CPDF_DocRenderData::Clear(FX_BOOL bRelease) { | 45 void CPDF_DocRenderData::Clear(FX_BOOL bRelease) { |
| 47 for (auto it = m_Type3FaceMap.begin(); it != m_Type3FaceMap.end();) { | 46 for (auto it = m_Type3FaceMap.begin(); it != m_Type3FaceMap.end();) { |
| 48 auto curr_it = it++; | 47 auto curr_it = it++; |
| 49 CPDF_CountedObject<CPDF_Type3Cache>* cache = curr_it->second; | 48 CPDF_CountedObject<CPDF_Type3Cache>* cache = curr_it->second; |
| 50 if (bRelease || cache->use_count() < 2) { | 49 if (bRelease || cache->use_count() < 2) { |
| 51 delete cache->get(); | 50 delete cache->get(); |
| 52 delete cache; | 51 delete cache; |
| 53 m_Type3FaceMap.erase(curr_it); | 52 m_Type3FaceMap.erase(curr_it); |
| 54 } | 53 } |
| 55 } | 54 } |
| 56 | 55 |
| 57 for (auto it = m_TransferFuncMap.begin(); it != m_TransferFuncMap.end();) { | 56 for (auto it = m_TransferFuncMap.begin(); it != m_TransferFuncMap.end();) { |
| 58 auto curr_it = it++; | 57 auto curr_it = it++; |
| 59 CPDF_CountedObject<CPDF_TransferFunc>* value = curr_it->second; | 58 CPDF_CountedObject<CPDF_TransferFunc>* value = curr_it->second; |
| 60 if (bRelease || value->use_count() < 2) { | 59 if (bRelease || value->use_count() < 2) { |
| 61 delete value->get(); | 60 delete value->get(); |
| 62 delete value; | 61 delete value; |
| 63 m_TransferFuncMap.erase(curr_it); | 62 m_TransferFuncMap.erase(curr_it); |
| 64 } | 63 } |
| 65 } | 64 } |
| 66 | |
| 67 if (m_pFontCache) { | |
| 68 if (bRelease) { | |
| 69 delete m_pFontCache; | |
| 70 m_pFontCache = nullptr; | |
| 71 } else { | |
| 72 m_pFontCache->FreeCache(FALSE); | |
| 73 } | |
| 74 } | |
| 75 } | 65 } |
| 76 | 66 |
| 77 CPDF_Type3Cache* CPDF_DocRenderData::GetCachedType3(CPDF_Type3Font* pFont) { | 67 CPDF_Type3Cache* CPDF_DocRenderData::GetCachedType3(CPDF_Type3Font* pFont) { |
| 78 CPDF_CountedObject<CPDF_Type3Cache>* pCache; | 68 CPDF_CountedObject<CPDF_Type3Cache>* pCache; |
| 79 auto it = m_Type3FaceMap.find(pFont); | 69 auto it = m_Type3FaceMap.find(pFont); |
| 80 if (it == m_Type3FaceMap.end()) { | 70 if (it == m_Type3FaceMap.end()) { |
| 81 CPDF_Type3Cache* pType3 = new CPDF_Type3Cache(pFont); | 71 CPDF_Type3Cache* pType3 = new CPDF_Type3Cache(pFont); |
| 82 pCache = new CPDF_CountedObject<CPDF_Type3Cache>(pType3); | 72 pCache = new CPDF_CountedObject<CPDF_Type3Cache>(pType3); |
| 83 m_Type3FaceMap[pFont] = pCache; | 73 m_Type3FaceMap[pFont] = pCache; |
| 84 } else { | 74 } else { |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1280 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
| 1291 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1281 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
| 1292 } | 1282 } |
| 1293 } | 1283 } |
| 1294 | 1284 |
| 1295 #if defined _SKIA_SUPPORT_ | 1285 #if defined _SKIA_SUPPORT_ |
| 1296 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { | 1286 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { |
| 1297 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); | 1287 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); |
| 1298 } | 1288 } |
| 1299 #endif | 1289 #endif |
| OLD | NEW |