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

Side by Side Diff: core/src/fxge/ge/fx_ge.cpp

Issue 1081443004: Remove checks in fxge/ge now that FX_NEW can't return 0. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix Typo. Created 5 years, 8 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 | « no previous file | core/src/fxge/ge/fx_ge_font.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 "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "text_int.h" 8 #include "text_int.h"
9 static CFX_GEModule* g_pGEModule = NULL; 9 static CFX_GEModule* g_pGEModule = NULL;
10 CFX_GEModule::CFX_GEModule() 10 CFX_GEModule::CFX_GEModule()
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 m_pFontMgr = NULL; 27 m_pFontMgr = NULL;
28 DestroyPlatform(); 28 DestroyPlatform();
29 } 29 }
30 CFX_GEModule* CFX_GEModule::Get() 30 CFX_GEModule* CFX_GEModule::Get()
31 { 31 {
32 return g_pGEModule; 32 return g_pGEModule;
33 } 33 }
34 void CFX_GEModule::Create() 34 void CFX_GEModule::Create()
35 { 35 {
36 g_pGEModule = FX_NEW CFX_GEModule; 36 g_pGEModule = new CFX_GEModule;
37 if (!g_pGEModule) { 37 g_pGEModule->m_pFontMgr = new CFX_FontMgr;
38 return;
39 }
40 g_pGEModule->m_pFontMgr = FX_NEW CFX_FontMgr;
41 g_pGEModule->InitPlatform(); 38 g_pGEModule->InitPlatform();
42 g_pGEModule->SetTextGamma(2.2f); 39 g_pGEModule->SetTextGamma(2.2f);
43 } 40 }
44 void CFX_GEModule::Use(CFX_GEModule* pModule) 41 void CFX_GEModule::Use(CFX_GEModule* pModule)
45 { 42 {
46 g_pGEModule = pModule; 43 g_pGEModule = pModule;
47 } 44 }
48 void CFX_GEModule::Destroy() 45 void CFX_GEModule::Destroy()
49 { 46 {
50 if (g_pGEModule) { 47 if (g_pGEModule) {
51 delete g_pGEModule; 48 delete g_pGEModule;
52 } 49 }
53 g_pGEModule = NULL; 50 g_pGEModule = NULL;
54 } 51 }
55 CFX_FontCache* CFX_GEModule::GetFontCache() 52 CFX_FontCache* CFX_GEModule::GetFontCache()
56 { 53 {
57 if (m_pFontCache == NULL) { 54 if (m_pFontCache == NULL) {
58 m_pFontCache = FX_NEW CFX_FontCache(); 55 m_pFontCache = new CFX_FontCache();
59 } 56 }
60 return m_pFontCache; 57 return m_pFontCache;
61 } 58 }
62 void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) 59 void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue)
63 { 60 {
64 gammaValue /= 2.2f; 61 gammaValue /= 2.2f;
65 int i = 0; 62 int i = 0;
66 while (i < 256) { 63 while (i < 256) {
67 m_GammaValue[i] = (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 2 55.0f + 0.5f); 64 m_GammaValue[i] = (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 2 55.0f + 0.5f);
68 i++; 65 i++;
69 } 66 }
70 } 67 }
71 FX_LPCBYTE CFX_GEModule::GetTextGammaTable() 68 FX_LPCBYTE CFX_GEModule::GetTextGammaTable()
72 { 69 {
73 return m_GammaValue; 70 return m_GammaValue;
74 } 71 }
75 void CFX_GEModule::SetExtFontMapper(IFX_FontMapper* pFontMapper) 72 void CFX_GEModule::SetExtFontMapper(IFX_FontMapper* pFontMapper)
76 { 73 {
77 GetFontMgr()->m_pExtMapper = pFontMapper; 74 GetFontMgr()->m_pExtMapper = pFontMapper;
78 pFontMapper->m_pFontMgr = m_pFontMgr; 75 pFontMapper->m_pFontMgr = m_pFontMgr;
79 } 76 }
OLDNEW
« no previous file with comments | « no previous file | core/src/fxge/ge/fx_ge_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698