summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-12 11:21:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-12 11:21:23 -0700
commitd55e11eeb8ebf1e226a1166f395ba77248ce84c3 (patch)
treec28b1c1d6ac1597e569618cdeb02e3e0009bf8ed /core/fpdfapi
parentea98238666e33cd16b69cb23dcaca047c21c9998 (diff)
downloadpdfium-d55e11eeb8ebf1e226a1166f395ba77248ce84c3.tar.xz
Remove ICodec_* Interfaces.
All of the ICodec_* interfaces had a single implementation. This CL removes the interfaces and uses the concrete classes in their place. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1876023003
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_basic_module.cpp31
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp10
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp8
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp4
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp16
-rw-r--r--core/fpdfapi/fpdf_render/render_int.h4
-rw-r--r--core/fpdfapi/include/cpdf_modulemgr.h24
8 files changed, 54 insertions, 45 deletions
diff --git a/core/fpdfapi/fpdf_basic_module.cpp b/core/fpdfapi/fpdf_basic_module.cpp
index 2dfc9fb1f6..efa93d6f76 100644
--- a/core/fpdfapi/fpdf_basic_module.cpp
+++ b/core/fpdfapi/fpdf_basic_module.cpp
@@ -41,24 +41,31 @@ void CPDF_ModuleMgr::SetPrivateData(void* module_id,
PD_CALLBACK_FREEDATA callback) {
m_privateData.SetPrivateData(module_id, pData, callback);
}
+
void* CPDF_ModuleMgr::GetPrivateData(void* module_id) {
return m_privateData.GetPrivateData(module_id);
}
-ICodec_FaxModule* CPDF_ModuleMgr::GetFaxModule() {
- return m_pCodecModule ? m_pCodecModule->GetFaxModule() : NULL;
+
+CCodec_FaxModule* CPDF_ModuleMgr::GetFaxModule() {
+ return m_pCodecModule ? m_pCodecModule->GetFaxModule() : nullptr;
}
-ICodec_JpegModule* CPDF_ModuleMgr::GetJpegModule() {
- return m_pCodecModule ? m_pCodecModule->GetJpegModule() : NULL;
+
+CCodec_JpegModule* CPDF_ModuleMgr::GetJpegModule() {
+ return m_pCodecModule ? m_pCodecModule->GetJpegModule() : nullptr;
}
-ICodec_JpxModule* CPDF_ModuleMgr::GetJpxModule() {
- return m_pCodecModule ? m_pCodecModule->GetJpxModule() : NULL;
+
+CCodec_JpxModule* CPDF_ModuleMgr::GetJpxModule() {
+ return m_pCodecModule ? m_pCodecModule->GetJpxModule() : nullptr;
}
-ICodec_Jbig2Module* CPDF_ModuleMgr::GetJbig2Module() {
- return m_pCodecModule ? m_pCodecModule->GetJbig2Module() : NULL;
+
+CCodec_Jbig2Module* CPDF_ModuleMgr::GetJbig2Module() {
+ return m_pCodecModule ? m_pCodecModule->GetJbig2Module() : nullptr;
}
-ICodec_IccModule* CPDF_ModuleMgr::GetIccModule() {
- return m_pCodecModule ? m_pCodecModule->GetIccModule() : NULL;
+
+CCodec_IccModule* CPDF_ModuleMgr::GetIccModule() {
+ return m_pCodecModule ? m_pCodecModule->GetIccModule() : nullptr;
}
-ICodec_FlateModule* CPDF_ModuleMgr::GetFlateModule() {
- return m_pCodecModule ? m_pCodecModule->GetFlateModule() : NULL;
+
+CCodec_FlateModule* CPDF_ModuleMgr::GetFlateModule() {
+ return m_pCodecModule ? m_pCodecModule->GetFlateModule() : nullptr;
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index 79faebafc9..aa31f9cbac 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -863,12 +863,14 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
B = pBuf[2];
return TRUE;
}
- ICodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
+ CCodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
if (!m_pProfile->m_pTransform || !pIccModule) {
- if (m_pAlterCS) {
+ if (m_pAlterCS)
return m_pAlterCS->GetRGB(pBuf, R, G, B);
- }
- R = G = B = 0.0f;
+
+ R = 0.0f;
+ G = 0.0f;
+ B = 0.0f;
return TRUE;
}
FX_FLOAT rgb[3];
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 5ec25d9fde..48bb667ec7 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -44,7 +44,7 @@ CPDF_StreamParser::~CPDF_StreamParser() {
}
}
-uint32_t DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
+uint32_t DecodeAllScanlines(CCodec_ScanlineDecoder* pDecoder,
uint8_t*& dest_buf,
uint32_t& dest_size) {
if (!pDecoder) {
@@ -73,7 +73,7 @@ uint32_t DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
return srcoff;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
+CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
@@ -89,7 +89,7 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
uint8_t*& dest_buf,
uint32_t& dest_size) {
if (decoder == "CCITTFaxDecode" || decoder == "CCF") {
- ICodec_ScanlineDecoder* pDecoder =
+ CCodec_ScanlineDecoder* pDecoder =
FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam);
return DecodeAllScanlines(pDecoder, dest_buf, dest_size);
}
@@ -108,7 +108,7 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
dest_size);
}
if (decoder == "DCTDecode" || decoder == "DCT") {
- ICodec_ScanlineDecoder* pDecoder =
+ CCodec_ScanlineDecoder* pDecoder =
CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
src_buf, limit, width, height, 0,
pParam ? pParam->GetIntegerBy("ColorTransform", 1) : 1);
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index f81f41c89f..5e71002d4d 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -225,7 +225,7 @@ uint32_t RunLengthDecode(const uint8_t* src_buf,
return ret;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
+CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
@@ -278,7 +278,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors,
return TRUE;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
+CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 55e97a9d81..ec8a784623 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -866,7 +866,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
}
return FALSE;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
+CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 7b88e84399..350c8b85d6 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -70,7 +70,7 @@ T ClampValue(T value, T max_value) {
// Wrapper class to use with std::unique_ptr for CJPX_Decoder.
class JpxBitMapContext {
public:
- explicit JpxBitMapContext(ICodec_JpxModule* jpx_module)
+ explicit JpxBitMapContext(CCodec_JpxModule* jpx_module)
: jpx_module_(jpx_module), decoder_(nullptr) {}
~JpxBitMapContext() { jpx_module_->DestroyDecoder(decoder_); }
@@ -81,7 +81,7 @@ class JpxBitMapContext {
CJPX_Decoder* decoder() { return decoder_; }
private:
- ICodec_JpxModule* const jpx_module_; // Weak pointer.
+ CCodec_JpxModule* const jpx_module_; // Weak pointer.
CJPX_Decoder* decoder_; // Decoder, owned.
// Disallow evil constructors
@@ -129,7 +129,7 @@ CPDF_DIBSource::~CPDF_DIBSource() {
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
}
if (m_pJbig2Context) {
- ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
+ CCodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
pJbig2Module->DestroyJbig2Context(m_pJbig2Context);
}
}
@@ -344,7 +344,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
if (decoder == "JPXDecode") {
return 0;
}
- ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
+ CCodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
if (!m_pJbig2Context) {
m_pJbig2Context = pJbig2Module->CreateJbig2Context();
if (m_pStreamAcc->GetImageParam()) {
@@ -527,14 +527,14 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
return pCompData;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
+CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
int height,
const CPDF_Dictionary* pParams);
-ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
+CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
@@ -565,7 +565,7 @@ int CPDF_DIBSource::CreateDecoder() {
FX_BOOL bTransform = FALSE;
int comps;
int bpc;
- ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule();
+ CCodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule();
if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps,
bpc, bTransform)) {
if (m_nComponents != static_cast<uint32_t>(comps)) {
@@ -628,7 +628,7 @@ int CPDF_DIBSource::CreateDecoder() {
}
void CPDF_DIBSource::LoadJpxBitmap() {
- ICodec_JpxModule* pJpxModule = CPDF_ModuleMgr::Get()->GetJpxModule();
+ CCodec_JpxModule* pJpxModule = CPDF_ModuleMgr::Get()->GetJpxModule();
if (!pJpxModule)
return;
diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h
index eab6c9ff21..a94820ab8e 100644
--- a/core/fpdfapi/fpdf_render/render_int.h
+++ b/core/fpdfapi/fpdf_render/render_int.h
@@ -23,7 +23,7 @@ class CFX_GlyphBitmap;
class CFX_ImageTransformer;
class CPDF_ImageCacheEntry;
class CPDF_ImageLoaderHandle;
-class ICodec_ScanlineDecoder;
+class CCodec_ScanlineDecoder;
class CPDF_Type3Font;
class CPDF_Type3Cache;
class CPDF_Type3Char;
@@ -605,7 +605,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
uint8_t* m_pLineBuf;
uint8_t* m_pMaskedLine;
std::unique_ptr<CFX_DIBitmap> m_pCachedBitmap;
- std::unique_ptr<ICodec_ScanlineDecoder> m_pDecoder;
+ std::unique_ptr<CCodec_ScanlineDecoder> m_pDecoder;
void* m_pJbig2Context;
CPDF_DIBSource* m_pMask;
std::unique_ptr<CPDF_StreamAcc> m_pGlobalStream;
diff --git a/core/fpdfapi/include/cpdf_modulemgr.h b/core/fpdfapi/include/cpdf_modulemgr.h
index a8be5af7dd..16a6e7bd4f 100644
--- a/core/fpdfapi/include/cpdf_modulemgr.h
+++ b/core/fpdfapi/include/cpdf_modulemgr.h
@@ -13,12 +13,12 @@
#include "core/fxcrt/include/fx_basic.h"
class CCodec_ModuleMgr;
-class ICodec_FaxModule;
-class ICodec_FlateModule;
-class ICodec_IccModule;
-class ICodec_Jbig2Module;
-class ICodec_JpegModule;
-class ICodec_JpxModule;
+class CCodec_FaxModule;
+class CCodec_FlateModule;
+class CCodec_IccModule;
+class CCodec_Jbig2Module;
+class CCodec_JpegModule;
+class CCodec_JpxModule;
class IPDF_PageModule;
class IPDF_RenderModule;
@@ -44,12 +44,12 @@ class CPDF_ModuleMgr {
void LoadEmbeddedJapan1CMaps();
void LoadEmbeddedKorea1CMaps();
- ICodec_FaxModule* GetFaxModule();
- ICodec_JpegModule* GetJpegModule();
- ICodec_JpxModule* GetJpxModule();
- ICodec_Jbig2Module* GetJbig2Module();
- ICodec_IccModule* GetIccModule();
- ICodec_FlateModule* GetFlateModule();
+ CCodec_FaxModule* GetFaxModule();
+ CCodec_JpegModule* GetJpegModule();
+ CCodec_JpxModule* GetJpxModule();
+ CCodec_Jbig2Module* GetJbig2Module();
+ CCodec_IccModule* GetIccModule();
+ CCodec_FlateModule* GetFlateModule();
void SetPrivateData(void* module_id,
void* pData,