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

Side by Side Diff: xfa/fde/fde_gedevice.cpp

Issue 2350763002: Revert of Pdfium: Fix fonts leaking on ClosePage. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: 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/fxge/win32/win32_int.h ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.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 "xfa/fde/fde_gedevice.h" 7 #include "xfa/fde/fde_gedevice.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fxge/include/cfx_fontcache.h"
11 #include "core/fxge/include/cfx_gemodule.h" 12 #include "core/fxge/include/cfx_gemodule.h"
12 #include "core/fxge/include/cfx_graphstatedata.h" 13 #include "core/fxge/include/cfx_graphstatedata.h"
13 #include "core/fxge/include/cfx_renderdevice.h" 14 #include "core/fxge/include/cfx_renderdevice.h"
14 #include "core/fxge/include/cfx_substfont.h" 15 #include "core/fxge/include/cfx_substfont.h"
15 #include "xfa/fde/cfde_path.h" 16 #include "xfa/fde/cfde_path.h"
16 #include "xfa/fde/fde_object.h" 17 #include "xfa/fde/fde_object.h"
17 #include "xfa/fgas/font/fgas_font.h" 18 #include "xfa/fgas/font/fgas_font.h"
18 #include "xfa/fgas/font/fgas_gefont.h" 19 #include "xfa/fgas/font/fgas_gefont.h"
19 20
20 CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, 21 CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 m_pDevice->CancelDIBits(handle); 106 m_pDevice->CancelDIBits(handle);
106 return !!handle; 107 return !!handle;
107 } 108 }
108 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, 109 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
109 CFGAS_GEFont* pFont, 110 CFGAS_GEFont* pFont,
110 const FXTEXT_CHARPOS* pCharPos, 111 const FXTEXT_CHARPOS* pCharPos,
111 int32_t iCount, 112 int32_t iCount,
112 FX_FLOAT fFontSize, 113 FX_FLOAT fFontSize,
113 const CFX_Matrix* pMatrix) { 114 const CFX_Matrix* pMatrix) {
114 ASSERT(pBrush && pFont && pCharPos && iCount > 0); 115 ASSERT(pBrush && pFont && pCharPos && iCount > 0);
116 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache();
115 CFX_Font* pFxFont = pFont->GetDevFont(); 117 CFX_Font* pFxFont = pFont->GetDevFont();
116 FX_ARGB argb = pBrush->GetColor(); 118 FX_ARGB argb = pBrush->GetColor();
117 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && 119 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 &&
118 !pFxFont->IsItalic()) { 120 !pFxFont->IsItalic()) {
119 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; 121 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
120 FX_FLOAT* pAM; 122 FX_FLOAT* pAM;
121 for (int32_t i = 0; i < iCount; ++i) { 123 for (int32_t i = 0; i < iCount; ++i) {
122 static const FX_FLOAT mc = 0.267949f; 124 static const FX_FLOAT mc = 0.267949f;
123 pAM = pCP->m_AdjustMatrix; 125 pAM = pCP->m_AdjustMatrix;
124 pAM[2] = mc * pAM[0] + pAM[2]; 126 pAM[2] = mc * pAM[0] + pAM[2];
(...skipping 20 matching lines...) Expand all
145 147
146 for (int32_t i = 0; i < iCount; ++i) { 148 for (int32_t i = 0; i < iCount; ++i) {
147 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); 149 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex);
148 pCP->m_GlyphIndex &= 0x00FFFFFF; 150 pCP->m_GlyphIndex &= 0x00FFFFFF;
149 pCP->m_bFontStyle = false; 151 pCP->m_bFontStyle = false;
150 if (pCurFont != pSTFont) { 152 if (pCurFont != pSTFont) {
151 if (pCurFont) { 153 if (pCurFont) {
152 pFxFont = pCurFont->GetDevFont(); 154 pFxFont = pCurFont->GetDevFont();
153 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 155 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
154 FxFont.SetFace(pFxFont->GetFace()); 156 FxFont.SetFace(pFxFont->GetFace());
155 m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, 157 m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, pCache,
156 (const CFX_Matrix*)pMatrix, argb, 158 -fFontSize, (const CFX_Matrix*)pMatrix, argb,
157 FXTEXT_CLEARTYPE); 159 FXTEXT_CLEARTYPE);
158 #else 160 #else
159 m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, 161 m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache,
160 (const CFX_Matrix*)pMatrix, argb, 162 -fFontSize, (const CFX_Matrix*)pMatrix, argb,
161 FXTEXT_CLEARTYPE); 163 FXTEXT_CLEARTYPE);
162 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 164 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
163 } 165 }
164 pCurFont = pSTFont; 166 pCurFont = pSTFont;
165 pCurCP = pCP; 167 pCurCP = pCP;
166 iCurCount = 1; 168 iCurCount = 1;
167 } else { 169 } else {
168 iCurCount++; 170 iCurCount++;
169 } 171 }
170 pCP++; 172 pCP++;
171 } 173 }
172 if (pCurFont && iCurCount) { 174 if (pCurFont && iCurCount) {
173 pFxFont = pCurFont->GetDevFont(); 175 pFxFont = pCurFont->GetDevFont();
174 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 176 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
175 FxFont.SetFace(pFxFont->GetFace()); 177 FxFont.SetFace(pFxFont->GetFace());
176 FX_BOOL bRet = m_pDevice->DrawNormalText( 178 FX_BOOL bRet = m_pDevice->DrawNormalText(
177 iCurCount, pCurCP, &FxFont, -fFontSize, (const CFX_Matrix*)pMatrix, 179 iCurCount, pCurCP, &FxFont, pCache, -fFontSize,
178 argb, FXTEXT_CLEARTYPE); 180 (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE);
179 FxFont.SetFace(nullptr); 181 FxFont.SetFace(nullptr);
180 return bRet; 182 return bRet;
181 #else 183 #else
182 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, 184 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache,
183 (const CFX_Matrix*)pMatrix, argb, 185 -fFontSize, (const CFX_Matrix*)pMatrix,
184 FXTEXT_CLEARTYPE); 186 argb, FXTEXT_CLEARTYPE);
185 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 187 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
186 } 188 }
187 189
188 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 190 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
189 FxFont.SetFace(nullptr); 191 FxFont.SetFace(nullptr);
190 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 192 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
191 193
192 return TRUE; 194 return TRUE;
193 } 195 }
194 196
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 const CFX_Matrix* pMatrix) { 324 const CFX_Matrix* pMatrix) {
323 CFDE_Path* pGePath = (CFDE_Path*)pPath; 325 CFDE_Path* pGePath = (CFDE_Path*)pPath;
324 if (!pGePath) 326 if (!pGePath)
325 return FALSE; 327 return FALSE;
326 if (!pBrush) 328 if (!pBrush)
327 return FALSE; 329 return FALSE;
328 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, 330 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr,
329 pBrush->GetColor(), 0, FXFILL_WINDING); 331 pBrush->GetColor(), 0, FXFILL_WINDING);
330 } 332 }
331 333
OLDNEW
« no previous file with comments | « core/fxge/win32/win32_int.h ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698