| OLD | NEW | 
|   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(const char** pUserFontPaths) { | 
|  11   m_pFontCache = NULL; |  11   m_pFontCache = NULL; | 
|  12   m_pFontMgr = NULL; |  12   m_pFontMgr = NULL; | 
|  13   m_FTLibrary = NULL; |  13   m_FTLibrary = NULL; | 
|  14   m_pCodecModule = NULL; |  14   m_pCodecModule = NULL; | 
|  15   m_pPlatformData = NULL; |  15   m_pPlatformData = NULL; | 
 |  16   m_pUserFontPaths = pUserFontPaths; | 
|  16 } |  17 } | 
|  17 CFX_GEModule::~CFX_GEModule() { |  18 CFX_GEModule::~CFX_GEModule() { | 
|  18   delete m_pFontCache; |  19   delete m_pFontCache; | 
|  19   m_pFontCache = NULL; |  20   m_pFontCache = NULL; | 
|  20   delete m_pFontMgr; |  21   delete m_pFontMgr; | 
|  21   m_pFontMgr = NULL; |  22   m_pFontMgr = NULL; | 
|  22   DestroyPlatform(); |  23   DestroyPlatform(); | 
|  23 } |  24 } | 
|  24 CFX_GEModule* CFX_GEModule::Get() { |  25 CFX_GEModule* CFX_GEModule::Get() { | 
|  25   return g_pGEModule; |  26   return g_pGEModule; | 
|  26 } |  27 } | 
|  27 void CFX_GEModule::Create() { |  28 void CFX_GEModule::Create(const char** userFontPaths) { | 
|  28   g_pGEModule = new CFX_GEModule; |  29   g_pGEModule = new CFX_GEModule(userFontPaths); | 
|  29   g_pGEModule->m_pFontMgr = new CFX_FontMgr; |  30   g_pGEModule->m_pFontMgr = new CFX_FontMgr; | 
|  30   g_pGEModule->InitPlatform(); |  31   g_pGEModule->InitPlatform(); | 
|  31   g_pGEModule->SetTextGamma(2.2f); |  32   g_pGEModule->SetTextGamma(2.2f); | 
|  32 } |  33 } | 
|  33 void CFX_GEModule::Use(CFX_GEModule* pModule) { |  34 void CFX_GEModule::Use(CFX_GEModule* pModule) { | 
|  34   g_pGEModule = pModule; |  35   g_pGEModule = pModule; | 
|  35 } |  36 } | 
|  36 void CFX_GEModule::Destroy() { |  37 void CFX_GEModule::Destroy() { | 
|  37   delete g_pGEModule; |  38   delete g_pGEModule; | 
|  38   g_pGEModule = NULL; |  39   g_pGEModule = NULL; | 
|  39 } |  40 } | 
|  40 CFX_FontCache* CFX_GEModule::GetFontCache() { |  41 CFX_FontCache* CFX_GEModule::GetFontCache() { | 
|  41   if (m_pFontCache == NULL) { |  42   if (m_pFontCache == NULL) { | 
|  42     m_pFontCache = new CFX_FontCache(); |  43     m_pFontCache = new CFX_FontCache(); | 
|  43   } |  44   } | 
|  44   return m_pFontCache; |  45   return m_pFontCache; | 
|  45 } |  46 } | 
|  46 void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) { |  47 void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) { | 
|  47   gammaValue /= 2.2f; |  48   gammaValue /= 2.2f; | 
|  48   int i = 0; |  49   int i = 0; | 
|  49   while (i < 256) { |  50   while (i < 256) { | 
|  50     m_GammaValue[i] = |  51     m_GammaValue[i] = | 
|  51         (uint8_t)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); |  52         (uint8_t)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); | 
|  52     i++; |  53     i++; | 
|  53   } |  54   } | 
|  54 } |  55 } | 
|  55 const uint8_t* CFX_GEModule::GetTextGammaTable() { |  56 const uint8_t* CFX_GEModule::GetTextGammaTable() { | 
|  56   return m_GammaValue; |  57   return m_GammaValue; | 
|  57 } |  58 } | 
| OLD | NEW |