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

Side by Side Diff: core/fxge/win32/fx_win32_print.cpp

Issue 2158023002: Pdfium: Fix fonts leaking on ClosePage. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix xfa tests. 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
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 "core/fxcrt/include/fx_system.h" 7 #include "core/fxcrt/include/fx_system.h"
8 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
10 10
11 #include <windows.h> 11 #include <windows.h>
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "core/fxge/dib/dib_int.h" 15 #include "core/fxge/dib/dib_int.h"
16 #include "core/fxge/ge/fx_text_int.h" 16 #include "core/fxge/ge/fx_text_int.h"
17 #include "core/fxge/include/cfx_fontcache.h"
18 #include "core/fxge/include/cfx_renderdevice.h" 17 #include "core/fxge/include/cfx_renderdevice.h"
19 #include "core/fxge/include/cfx_windowsdevice.h" 18 #include "core/fxge/include/cfx_windowsdevice.h"
20 #include "core/fxge/include/fx_freetype.h" 19 #include "core/fxge/include/fx_freetype.h"
21 #include "core/fxge/win32/win32_int.h" 20 #include "core/fxge/win32/win32_int.h"
22 21
23 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) 22 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
24 namespace { 23 namespace {
25 24
26 class ScopedState { 25 class ScopedState {
27 public: 26 public:
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return FALSE; 191 return FALSE;
193 192
194 return StretchDIBits(pTransformed.get(), color, full_rect.left, full_rect.top, 193 return StretchDIBits(pTransformed.get(), color, full_rect.left, full_rect.top,
195 full_rect.Width(), full_rect.Height(), nullptr, 0, 194 full_rect.Width(), full_rect.Height(), nullptr, 0,
196 blend_type); 195 blend_type);
197 } 196 }
198 197
199 FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars, 198 FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars,
200 const FXTEXT_CHARPOS* pCharPos, 199 const FXTEXT_CHARPOS* pCharPos,
201 CFX_Font* pFont, 200 CFX_Font* pFont,
202 CFX_FontCache* pCache,
203 const CFX_Matrix* pObject2Device, 201 const CFX_Matrix* pObject2Device,
204 FX_FLOAT font_size, 202 FX_FLOAT font_size,
205 uint32_t color) { 203 uint32_t color) {
206 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) 204 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
207 if (!g_pdfium_print_text_with_gdi) 205 if (!g_pdfium_print_text_with_gdi)
208 return FALSE; 206 return FALSE;
209 207
210 if (nChars < 1 || !pFont || !pFont->IsEmbedded() || !pFont->IsTTFont()) 208 if (nChars < 1 || !pFont || !pFont->IsEmbedded() || !pFont->IsTTFont())
211 return FALSE; 209 return FALSE;
212 210
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // Try to get the font and draw again. 322 // Try to get the font and draw again.
325 g_pdfium_typeface_accessible_func(&lf, wsText.c_str(), nChars); 323 g_pdfium_typeface_accessible_func(&lf, wsText.c_str(), nChars);
326 return ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(), 324 return ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(),
327 nChars, nChars > 1 ? &spacing[1] : nullptr); 325 nChars, nChars > 1 ? &spacing[1] : nullptr);
328 #else 326 #else
329 return FALSE; 327 return FALSE;
330 #endif 328 #endif
331 } 329 }
332 330
333 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 331 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698