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/render/render_int.h" | 7 #include "core/fpdfapi/render/render_int.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 pCache = new CPDF_CountedObject<CPDF_Type3Cache>(pType3); | 73 pCache = new CPDF_CountedObject<CPDF_Type3Cache>(pType3); |
74 m_Type3FaceMap[pFont] = pCache; | 74 m_Type3FaceMap[pFont] = pCache; |
75 } else { | 75 } else { |
76 pCache = it->second; | 76 pCache = it->second; |
77 } | 77 } |
78 return pCache->AddRef(); | 78 return pCache->AddRef(); |
79 } | 79 } |
80 | 80 |
81 void CPDF_DocRenderData::ReleaseCachedType3(CPDF_Type3Font* pFont) { | 81 void CPDF_DocRenderData::ReleaseCachedType3(CPDF_Type3Font* pFont) { |
82 auto it = m_Type3FaceMap.find(pFont); | 82 auto it = m_Type3FaceMap.find(pFont); |
83 if (it != m_Type3FaceMap.end()) | 83 if (it != m_Type3FaceMap.end()) { |
84 it->second->RemoveRef(); | 84 it->second->RemoveRef(); |
| 85 if (it->second->use_count() < 2) { |
| 86 delete it->second->get(); |
| 87 delete it->second; |
| 88 m_Type3FaceMap.erase(it); |
| 89 } |
| 90 } |
85 } | 91 } |
86 | 92 |
87 CPDF_RenderOptions::CPDF_RenderOptions() | 93 CPDF_RenderOptions::CPDF_RenderOptions() |
88 : m_ColorMode(RENDER_COLOR_NORMAL), | 94 : m_ColorMode(RENDER_COLOR_NORMAL), |
89 m_Flags(RENDER_CLEARTYPE), | 95 m_Flags(RENDER_CLEARTYPE), |
90 m_Interpolation(0), | 96 m_Interpolation(0), |
91 m_AddFlags(0), | 97 m_AddFlags(0), |
92 m_pOCContext(nullptr), | 98 m_pOCContext(nullptr), |
93 m_dwLimitCacheSize(1024 * 1024 * 100), | 99 m_dwLimitCacheSize(1024 * 1024 * 100), |
94 m_HalftoneLimit(-1), | 100 m_HalftoneLimit(-1), |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 } | 1149 } |
1144 } | 1150 } |
1145 } | 1151 } |
1146 | 1152 |
1147 pTransfer->m_bIdentity = bIdentity; | 1153 pTransfer->m_bIdentity = bIdentity; |
1148 return pTransferCounter->AddRef(); | 1154 return pTransferCounter->AddRef(); |
1149 } | 1155 } |
1150 | 1156 |
1151 void CPDF_DocRenderData::ReleaseTransferFunc(CPDF_Object* pObj) { | 1157 void CPDF_DocRenderData::ReleaseTransferFunc(CPDF_Object* pObj) { |
1152 auto it = m_TransferFuncMap.find(pObj); | 1158 auto it = m_TransferFuncMap.find(pObj); |
1153 if (it != m_TransferFuncMap.end()) | 1159 if (it != m_TransferFuncMap.end()) { |
1154 it->second->RemoveRef(); | 1160 it->second->RemoveRef(); |
| 1161 if (it->second->use_count() < 2) { |
| 1162 delete it->second->get(); |
| 1163 delete it->second; |
| 1164 m_TransferFuncMap.erase(it); |
| 1165 } |
| 1166 } |
1155 } | 1167 } |
1156 | 1168 |
1157 CPDF_DeviceBuffer::CPDF_DeviceBuffer() | 1169 CPDF_DeviceBuffer::CPDF_DeviceBuffer() |
1158 : m_pDevice(nullptr), m_pContext(nullptr), m_pObject(nullptr) {} | 1170 : m_pDevice(nullptr), m_pContext(nullptr), m_pObject(nullptr) {} |
1159 | 1171 |
1160 CPDF_DeviceBuffer::~CPDF_DeviceBuffer() {} | 1172 CPDF_DeviceBuffer::~CPDF_DeviceBuffer() {} |
1161 | 1173 |
1162 bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, | 1174 bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, |
1163 CFX_RenderDevice* pDevice, | 1175 CFX_RenderDevice* pDevice, |
1164 FX_RECT* pRect, | 1176 FX_RECT* pRect, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1293 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
1282 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1294 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
1283 } | 1295 } |
1284 } | 1296 } |
1285 | 1297 |
1286 #if defined _SKIA_SUPPORT_ | 1298 #if defined _SKIA_SUPPORT_ |
1287 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { | 1299 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { |
1288 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); | 1300 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); |
1289 } | 1301 } |
1290 #endif | 1302 #endif |
OLD | NEW |