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

Side by Side Diff: core/fxge/apple/fx_apple_platform.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/apple/apple_int.h ('k') | core/fxge/apple/fx_quartz_device.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 "core/fxcrt/include/fx_system.h" 7 #include "core/fxcrt/include/fx_system.h"
8 8
9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
10 10
11 #ifndef _SKIA_SUPPORT_ 11 #ifndef _SKIA_SUPPORT_
12 #include "core/fxge/agg/fx_agg_driver.h" 12 #include "core/fxge/agg/fx_agg_driver.h"
13 #endif 13 #endif
14 14
15 #include "core/fxge/apple/apple_int.h" 15 #include "core/fxge/apple/apple_int.h"
16 #include "core/fxge/apple/cfx_quartzdevice.h" 16 #include "core/fxge/apple/cfx_quartzdevice.h"
17 #include "core/fxge/dib/dib_int.h" 17 #include "core/fxge/dib/dib_int.h"
18 #include "core/fxge/ge/cfx_cliprgn.h" 18 #include "core/fxge/ge/cfx_cliprgn.h"
19 #include "core/fxge/ge/fx_text_int.h" 19 #include "core/fxge/ge/fx_text_int.h"
20 #include "core/fxge/include/cfx_facecache.h" 20 #include "core/fxge/include/cfx_facecache.h"
21 #include "core/fxge/include/cfx_fontcache.h"
21 #include "core/fxge/include/cfx_gemodule.h" 22 #include "core/fxge/include/cfx_gemodule.h"
22 #include "core/fxge/include/cfx_renderdevice.h" 23 #include "core/fxge/include/cfx_renderdevice.h"
23 #include "core/fxge/include/fx_freetype.h" 24 #include "core/fxge/include/fx_freetype.h"
24 25
25 #ifndef _SKIA_SUPPORT_ 26 #ifndef _SKIA_SUPPORT_
26 27
27 namespace { 28 namespace {
28 29
29 void DoNothing(void* info, const void* data, size_t size) {} 30 void DoNothing(void* info, const void* data, size_t size) {}
30 31
31 FX_BOOL CGDrawGlyphRun(CGContextRef pContext, 32 FX_BOOL CGDrawGlyphRun(CGContextRef pContext,
32 int nChars, 33 int nChars,
33 const FXTEXT_CHARPOS* pCharPos, 34 const FXTEXT_CHARPOS* pCharPos,
34 CFX_Font* pFont, 35 CFX_Font* pFont,
36 CFX_FontCache* pCache,
35 const CFX_Matrix* pObject2Device, 37 const CFX_Matrix* pObject2Device,
36 FX_FLOAT font_size, 38 FX_FLOAT font_size,
37 uint32_t argb) { 39 uint32_t argb) {
38 if (nChars == 0) 40 if (nChars == 0)
39 return TRUE; 41 return TRUE;
40 42
41 CFX_Matrix new_matrix; 43 CFX_Matrix new_matrix;
42 FX_BOOL bNegSize = font_size < 0; 44 FX_BOOL bNegSize = font_size < 0;
43 if (bNegSize) 45 if (bNegSize)
44 font_size = -font_size; 46 font_size = -font_size;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ->m_quartz2d; 99 ->m_quartz2d;
98 if (m_pPlatformGraphics) { 100 if (m_pPlatformGraphics) {
99 quartz2d.destroyGraphics(m_pPlatformGraphics); 101 quartz2d.destroyGraphics(m_pPlatformGraphics);
100 m_pPlatformGraphics = nullptr; 102 m_pPlatformGraphics = nullptr;
101 } 103 }
102 } 104 }
103 105
104 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, 106 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
105 const FXTEXT_CHARPOS* pCharPos, 107 const FXTEXT_CHARPOS* pCharPos,
106 CFX_Font* pFont, 108 CFX_Font* pFont,
109 CFX_FontCache* pCache,
107 const CFX_Matrix* pObject2Device, 110 const CFX_Matrix* pObject2Device,
108 FX_FLOAT font_size, 111 FX_FLOAT font_size,
109 uint32_t argb) { 112 uint32_t argb) {
110 if (!pFont) 113 if (!pFont)
111 return FALSE; 114 return FALSE;
112 115
113 FX_BOOL bBold = pFont->IsBold(); 116 FX_BOOL bBold = pFont->IsBold();
114 if (!bBold && pFont->GetSubstFont() && 117 if (!bBold && pFont->GetSubstFont() &&
115 pFont->GetSubstFont()->m_Weight >= 500 && 118 pFont->GetSubstFont()->m_Weight >= 500 &&
116 pFont->GetSubstFont()->m_Weight <= 600) { 119 pFont->GetSubstFont()->m_Weight <= 600) {
(...skipping 28 matching lines...) Expand all
145 } 148 }
146 } else { 149 } else {
147 rect_cg = CGRectMake(0, 0, m_pBitmap->GetWidth(), m_pBitmap->GetHeight()); 150 rect_cg = CGRectMake(0, 0, m_pBitmap->GetWidth(), m_pBitmap->GetHeight());
148 } 151 }
149 rect_cg = CGContextConvertRectToDeviceSpace(ctx, rect_cg); 152 rect_cg = CGContextConvertRectToDeviceSpace(ctx, rect_cg);
150 if (pImageCG) 153 if (pImageCG)
151 CGContextClipToMask(ctx, rect_cg, pImageCG); 154 CGContextClipToMask(ctx, rect_cg, pImageCG);
152 else 155 else
153 CGContextClipToRect(ctx, rect_cg); 156 CGContextClipToRect(ctx, rect_cg);
154 157
155 FX_BOOL ret = CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pObject2Device, 158 FX_BOOL ret = CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pCache,
156 font_size, argb); 159 pObject2Device, font_size, argb);
157 if (pImageCG) 160 if (pImageCG)
158 CGImageRelease(pImageCG); 161 CGImageRelease(pImageCG);
159 CGContextRestoreGState(ctx); 162 CGContextRestoreGState(ctx);
160 return ret; 163 return ret;
161 } 164 }
162 165
163 #endif // _SKIA_SUPPORT_ 166 #endif // _SKIA_SUPPORT_
164 167
165 void CFX_FaceCache::InitPlatform() {} 168 void CFX_FaceCache::InitPlatform() {}
166 169
167 void CFX_FaceCache::DestroyPlatform() {} 170 void CFX_FaceCache::DestroyPlatform() {}
168 171
169 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext( 172 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext(
170 const CFX_Font* pFont, 173 CFX_Font* pFont,
171 uint32_t glyph_index, 174 uint32_t glyph_index,
172 const CFX_Matrix* pMatrix, 175 const CFX_Matrix* pMatrix,
173 int dest_width, 176 int dest_width,
174 int anti_alias) { 177 int anti_alias) {
175 return nullptr; 178 return nullptr;
176 } 179 }
177 180
178 void CFX_Font::ReleasePlatformResource() { 181 void CFX_Font::ReleasePlatformResource() {
179 if (m_pPlatformFont) { 182 if (m_pPlatformFont) {
180 CQuartz2D& quartz2d = 183 CQuartz2D& quartz2d =
181 static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData()) 184 static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
182 ->m_quartz2d; 185 ->m_quartz2d;
183 quartz2d.DestroyFont(m_pPlatformFont); 186 quartz2d.DestroyFont(m_pPlatformFont);
184 m_pPlatformFont = nullptr; 187 m_pPlatformFont = nullptr;
185 } 188 }
186 } 189 }
187 190
188 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 191 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
OLDNEW
« no previous file with comments | « core/fxge/apple/apple_int.h ('k') | core/fxge/apple/fx_quartz_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698