From 0c7f94f7f36d0bd8b0bbd0d3d440a8953499d47a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 11 May 2017 16:10:16 -0400 Subject: Remove gamma code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gamma value is always 2.2, which means the table entries all point to themselves. Remove the usage of the gamma table. Change-Id: Idbb06015e8acd9f106f4bd1da5ef06563fb26296 Reviewed-on: https://pdfium-review.googlesource.com/5352 Reviewed-by: Lei Zhang Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxge/cfx_gemodule.h | 3 --- core/fxge/ge/cfx_facecache.cpp | 11 ----------- core/fxge/ge/cfx_gemodule.cpp | 13 ------------- 3 files changed, 27 deletions(-) diff --git a/core/fxge/cfx_gemodule.h b/core/fxge/cfx_gemodule.h index e51ddde967..429f7d9a39 100644 --- a/core/fxge/cfx_gemodule.h +++ b/core/fxge/cfx_gemodule.h @@ -24,8 +24,6 @@ class CFX_GEModule { void Init(const char** pUserFontPaths); CFX_FontCache* GetFontCache(); CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); } - void SetTextGamma(float gammaValue); - const uint8_t* GetTextGammaTable() const; CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule.get(); } void* GetPlatformData() { return m_pPlatformData; } @@ -37,7 +35,6 @@ class CFX_GEModule { void InitPlatform(); void DestroyPlatform(); - uint8_t m_GammaValue[256]; std::unique_ptr m_pFontCache; std::unique_ptr m_pFontMgr; std::unique_ptr m_pCodecModule; diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 5ad7bdd99a..6d5e3d4355 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -35,15 +35,6 @@ namespace { constexpr uint32_t kInvalidGlyphIndex = static_cast(-1); -void GammaAdjust(uint8_t* pData, - int nHeight, - int src_pitch, - const uint8_t* gammaTable) { - int count = nHeight * src_pitch; - for (int i = 0; i < count; i++) - pData[i] = gammaTable[pData[i]]; -} - void ContrastAdjust(uint8_t* pDataIn, uint8_t* pDataOut, int nWidth, @@ -227,8 +218,6 @@ std::unique_ptr CFX_FaceCache::RenderGlyph( } else { ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch, dest_pitch); - GammaAdjust(pDestBuf, bmheight, dest_pitch, - CFX_GEModule::Get()->GetTextGammaTable()); } } return pGlyphBitmap; diff --git a/core/fxge/ge/cfx_gemodule.cpp b/core/fxge/ge/cfx_gemodule.cpp index 2cd1e31144..d7ae098f31 100644 --- a/core/fxge/ge/cfx_gemodule.cpp +++ b/core/fxge/ge/cfx_gemodule.cpp @@ -47,7 +47,6 @@ void CFX_GEModule::Init(const char** userFontPaths) { ASSERT(g_pGEModule); m_pUserFontPaths = userFontPaths; InitPlatform(); - SetTextGamma(2.2f); } CFX_FontCache* CFX_GEModule::GetFontCache() { @@ -55,15 +54,3 @@ CFX_FontCache* CFX_GEModule::GetFontCache() { m_pFontCache = pdfium::MakeUnique(); return m_pFontCache.get(); } - -void CFX_GEModule::SetTextGamma(float gammaValue) { - gammaValue /= 2.2f; - for (int i = 0; i < 256; ++i) { - m_GammaValue[i] = static_cast( - FXSYS_pow(static_cast(i) / 255, gammaValue) * 255.0f + 0.5f); - } -} - -const uint8_t* CFX_GEModule::GetTextGammaTable() const { - return m_GammaValue; -} -- cgit v1.2.3