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

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

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 "../../../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() {
11 { 11 m_pFontCache = NULL;
12 m_pFontCache = NULL; 12 m_pFontMgr = NULL;
13 m_pFontMgr = NULL; 13 m_FTLibrary = NULL;
14 m_FTLibrary = NULL; 14 m_pCodecModule = NULL;
15 m_pCodecModule = NULL; 15 m_pPlatformData = NULL;
16 m_pPlatformData = NULL;
17 } 16 }
18 CFX_GEModule::~CFX_GEModule() 17 CFX_GEModule::~CFX_GEModule() {
19 { 18 if (m_pFontCache) {
20 if (m_pFontCache) { 19 delete m_pFontCache;
21 delete m_pFontCache; 20 }
22 } 21 m_pFontCache = NULL;
23 m_pFontCache = NULL; 22 if (m_pFontMgr) {
24 if (m_pFontMgr) { 23 delete m_pFontMgr;
25 delete m_pFontMgr; 24 }
26 } 25 m_pFontMgr = NULL;
27 m_pFontMgr = NULL; 26 DestroyPlatform();
28 DestroyPlatform();
29 } 27 }
30 CFX_GEModule* CFX_GEModule::Get() 28 CFX_GEModule* CFX_GEModule::Get() {
31 { 29 return g_pGEModule;
32 return g_pGEModule;
33 } 30 }
34 void CFX_GEModule::Create() 31 void CFX_GEModule::Create() {
35 { 32 g_pGEModule = FX_NEW CFX_GEModule;
36 g_pGEModule = FX_NEW CFX_GEModule; 33 if (!g_pGEModule) {
37 if (!g_pGEModule) { 34 return;
38 return; 35 }
39 } 36 g_pGEModule->m_pFontMgr = FX_NEW CFX_FontMgr;
40 g_pGEModule->m_pFontMgr = FX_NEW CFX_FontMgr; 37 g_pGEModule->InitPlatform();
41 g_pGEModule->InitPlatform(); 38 g_pGEModule->SetTextGamma(2.2f);
42 g_pGEModule->SetTextGamma(2.2f);
43 } 39 }
44 void CFX_GEModule::Use(CFX_GEModule* pModule) 40 void CFX_GEModule::Use(CFX_GEModule* pModule) {
45 { 41 g_pGEModule = pModule;
46 g_pGEModule = pModule;
47 } 42 }
48 void CFX_GEModule::Destroy() 43 void CFX_GEModule::Destroy() {
49 { 44 if (g_pGEModule) {
50 if (g_pGEModule) { 45 delete g_pGEModule;
51 delete g_pGEModule; 46 }
52 } 47 g_pGEModule = NULL;
53 g_pGEModule = NULL;
54 } 48 }
55 CFX_FontCache* CFX_GEModule::GetFontCache() 49 CFX_FontCache* CFX_GEModule::GetFontCache() {
56 { 50 if (m_pFontCache == NULL) {
57 if (m_pFontCache == NULL) { 51 m_pFontCache = FX_NEW CFX_FontCache();
58 m_pFontCache = FX_NEW CFX_FontCache(); 52 }
59 } 53 return m_pFontCache;
60 return m_pFontCache;
61 } 54 }
62 void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) 55 void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) {
63 { 56 gammaValue /= 2.2f;
64 gammaValue /= 2.2f; 57 int i = 0;
65 int i = 0; 58 while (i < 256) {
66 while (i < 256) { 59 m_GammaValue[i] =
67 m_GammaValue[i] = (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 2 55.0f + 0.5f); 60 (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f);
68 i++; 61 i++;
69 } 62 }
70 } 63 }
71 FX_LPCBYTE CFX_GEModule::GetTextGammaTable() 64 FX_LPCBYTE CFX_GEModule::GetTextGammaTable() {
72 { 65 return m_GammaValue;
73 return m_GammaValue;
74 } 66 }
75 void CFX_GEModule::SetExtFontMapper(IFX_FontMapper* pFontMapper) 67 void CFX_GEModule::SetExtFontMapper(IFX_FontMapper* pFontMapper) {
76 { 68 GetFontMgr()->m_pExtMapper = pFontMapper;
77 GetFontMgr()->m_pExtMapper = pFontMapper; 69 pFontMapper->m_pFontMgr = m_pFontMgr;
78 pFontMapper->m_pFontMgr = m_pFontMgr;
79 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698