summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/codec
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 14:07:43 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 14:07:43 -0700
commitc2c3f7b5f0396409451a9d344f35ec1929a76e9f (patch)
treeb1c696afdca13e8087e18014b19a6c82415f72d5 /core/src/fxcodec/codec
parentc6540e037ed1a9546d5a90455bf440a24b181ab4 (diff)
downloadpdfium-c2c3f7b5f0396409451a9d344f35ec1929a76e9f.tar.xz
Use override in more classes in core/
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1292613003 .
Diffstat (limited to 'core/src/fxcodec/codec')
-rw-r--r--core/src/fxcodec/codec/codec_int.h67
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp13
-rw-r--r--core/src/fxcodec/codec/fx_codec_fax.cpp16
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp18
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp26
5 files changed, 83 insertions, 57 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h
index e9449693dd..9fe77a44f7 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -31,36 +31,29 @@ class CCodec_BasicModule : public ICodec_BasicModule {
int nComps,
int bpc);
};
+
struct CCodec_ImageDataCache {
int m_Width, m_Height;
int m_nCachedLines;
uint8_t m_Data;
};
+
class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
public:
CCodec_ScanlineDecoder();
-
- virtual ~CCodec_ScanlineDecoder();
-
- virtual FX_DWORD GetSrcOffset() { return -1; }
-
- virtual void DownScale(int dest_width, int dest_height);
-
- uint8_t* GetScanline(int line);
-
- FX_BOOL SkipToScanline(int line, IFX_Pause* pPause);
-
- int GetWidth() { return m_OutputWidth; }
-
- int GetHeight() { return m_OutputHeight; }
-
- int CountComps() { return m_nComps; }
-
- int GetBPC() { return m_bpc; }
-
- FX_BOOL IsColorTransformed() { return m_bColorTransformed; }
-
- void ClearImageData() {
+ ~CCodec_ScanlineDecoder() override;
+
+ // ICodec_ScanlineDecoder
+ FX_DWORD GetSrcOffset() override { return -1; }
+ void DownScale(int dest_width, int dest_height) override;
+ uint8_t* GetScanline(int line) override;
+ FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) override;
+ int GetWidth() override { return m_OutputWidth; }
+ int GetHeight() override { return m_OutputHeight; }
+ int CountComps() override { return m_nComps; }
+ int GetBPC() override { return m_bpc; }
+ FX_BOOL IsColorTransformed() override { return m_bColorTransformed; }
+ void ClearImageData() override {
if (m_pDataCache) {
FX_Free(m_pDataCache);
}
@@ -100,6 +93,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
CCodec_ImageDataCache* m_pDataCache;
};
+
class CCodec_FaxModule : public ICodec_FaxModule {
public:
virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
@@ -119,6 +113,7 @@ class CCodec_FaxModule : public ICodec_FaxModule {
uint8_t*& dest_buf,
FX_DWORD& dest_size);
};
+
class CCodec_FlateModule : public ICodec_FlateModule {
public:
virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
@@ -155,6 +150,7 @@ class CCodec_FlateModule : public ICodec_FlateModule {
uint8_t*& dest_buf,
FX_DWORD& dest_size);
};
+
class CCodec_JpegModule : public ICodec_JpegModule {
public:
CCodec_JpegModule() : m_pExtProvider(NULL) {}
@@ -244,6 +240,7 @@ class CCodec_IccModule : public ICodec_IccModule {
Icc_CLASS ic,
CFX_BinaryBuf* pTransformKey);
};
+
class CCodec_JpxModule : public ICodec_JpxModule {
public:
CCodec_JpxModule();
@@ -262,6 +259,7 @@ class CCodec_JpxModule : public ICodec_JpxModule {
uint8_t* offsets);
void DestroyDecoder(void* ctx);
};
+
class CPDF_Jbig2Interface : public CJBig2_Module {
public:
virtual void* JBig2_Malloc(FX_DWORD dwSize) {
@@ -288,6 +286,7 @@ class CPDF_Jbig2Interface : public CJBig2_Module {
}
virtual void JBig2_Free(void* pMem) { FX_Free(pMem); }
};
+
class CCodec_Jbig2Context {
public:
CCodec_Jbig2Context();
@@ -309,7 +308,9 @@ class CCodec_Jbig2Context {
class CCodec_Jbig2Module : public ICodec_Jbig2Module {
public:
CCodec_Jbig2Module(){};
- ~CCodec_Jbig2Module();
+ ~CCodec_Jbig2Module() override;
+
+ // ICodec_Jbig2Module
FX_BOOL Decode(FX_DWORD width,
FX_DWORD height,
const uint8_t* src_buf,
@@ -317,13 +318,13 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module {
const uint8_t* global_data,
FX_DWORD global_size,
uint8_t* dest_buf,
- FX_DWORD dest_pitch);
+ FX_DWORD dest_pitch) override;
FX_BOOL Decode(IFX_FileRead* file_ptr,
FX_DWORD& width,
FX_DWORD& height,
FX_DWORD& pitch,
- uint8_t*& dest_buf);
- void* CreateJbig2Context();
+ uint8_t*& dest_buf) override;
+ void* CreateJbig2Context() override;
FXCODEC_STATUS StartDecode(void* pJbig2Context,
FX_DWORD width,
FX_DWORD height,
@@ -333,21 +334,21 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module {
FX_DWORD global_size,
uint8_t* dest_buf,
FX_DWORD dest_pitch,
- IFX_Pause* pPause);
-
+ IFX_Pause* pPause) override;
FXCODEC_STATUS StartDecode(void* pJbig2Context,
IFX_FileRead* file_ptr,
FX_DWORD& width,
FX_DWORD& height,
FX_DWORD& pitch,
uint8_t*& dest_buf,
- IFX_Pause* pPause);
- FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause);
- void DestroyJbig2Context(void* pJbig2Context);
- CPDF_Jbig2Interface m_Module;
- std::list<CJBig2_CachePair> m_SymbolDictCache;
+ IFX_Pause* pPause) override;
+ FXCODEC_STATUS ContinueDecode(void* pJbig2Context,
+ IFX_Pause* pPause) override;
+ void DestroyJbig2Context(void* pJbig2Context) override;
private:
+ CPDF_Jbig2Interface m_Module;
+ std::list<CJBig2_CachePair> m_SymbolDictCache;
};
struct DecodeData {
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp
index 806cac1bc3..4ed02dc2c0 100644
--- a/core/src/fxcodec/codec/fx_codec.cpp
+++ b/core/src/fxcodec/codec/fx_codec.cpp
@@ -217,17 +217,20 @@ FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf,
class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
public:
CCodec_RLScanlineDecoder();
- virtual ~CCodec_RLScanlineDecoder();
+ ~CCodec_RLScanlineDecoder() override;
+
FX_BOOL Create(const uint8_t* src_buf,
FX_DWORD src_size,
int width,
int height,
int nComps,
int bpc);
- virtual void v_DownScale(int dest_width, int dest_height) {}
- virtual FX_BOOL v_Rewind();
- virtual uint8_t* v_GetNextLine();
- virtual FX_DWORD GetSrcOffset() { return m_SrcOffset; }
+
+ // CCodec_ScanlineDecoder
+ void v_DownScale(int dest_width, int dest_height) override {}
+ FX_BOOL v_Rewind() override;
+ uint8_t* v_GetNextLine() override;
+ FX_DWORD GetSrcOffset() override { return m_SrcOffset; }
protected:
FX_BOOL CheckDestSize();
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp
index 4260309380..34c07ac484 100644
--- a/core/src/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/src/fxcodec/codec/fx_codec_fax.cpp
@@ -455,10 +455,12 @@ FX_BOOL _FaxGet1DLine(const uint8_t* src_buf,
}
return TRUE;
}
+
class CCodec_FaxDecoder : public CCodec_ScanlineDecoder {
public:
CCodec_FaxDecoder();
- virtual ~CCodec_FaxDecoder();
+ ~CCodec_FaxDecoder() override;
+
FX_BOOL Create(const uint8_t* src_buf,
FX_DWORD src_size,
int width,
@@ -469,10 +471,13 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder {
FX_BOOL BlackIs1,
int Columns,
int Rows);
- virtual void v_DownScale(int dest_width, int dest_height) {}
- virtual FX_BOOL v_Rewind();
- virtual uint8_t* v_GetNextLine();
- virtual FX_DWORD GetSrcOffset();
+
+ // CCodec_ScanlineDecoder
+ void v_DownScale(int dest_width, int dest_height) override {}
+ FX_BOOL v_Rewind() override;
+ uint8_t* v_GetNextLine() override;
+ FX_DWORD GetSrcOffset() override;
+
int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack;
int bitpos;
const uint8_t* m_pSrcBuf;
@@ -480,6 +485,7 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder {
uint8_t* m_pScanlineBuf;
uint8_t* m_pRefBuf;
};
+
CCodec_FaxDecoder::CCodec_FaxDecoder() {
m_pScanlineBuf = NULL;
m_pRefBuf = NULL;
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index 91d28b0553..a4b37c1ca3 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -603,10 +603,12 @@ static FX_BOOL TIFF_Predictor(uint8_t*& data_buf,
}
return TRUE;
}
+
class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
public:
CCodec_FlateScanlineDecoder();
- ~CCodec_FlateScanlineDecoder();
+ ~CCodec_FlateScanlineDecoder() override;
+
void Create(const uint8_t* src_buf,
FX_DWORD src_size,
int width,
@@ -617,11 +619,14 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
int Colors,
int BitsPerComponent,
int Columns);
- virtual void Destroy() { delete this; }
- virtual void v_DownScale(int dest_width, int dest_height) {}
- virtual FX_BOOL v_Rewind();
- virtual uint8_t* v_GetNextLine();
- virtual FX_DWORD GetSrcOffset();
+ void Destroy() { delete this; }
+
+ // CCodec_ScanlineDecoder
+ void v_DownScale(int dest_width, int dest_height) override {}
+ FX_BOOL v_Rewind() override;
+ uint8_t* v_GetNextLine() override;
+ FX_DWORD GetSrcOffset() override;
+
void* m_pFlate;
const uint8_t* m_SrcBuf;
FX_DWORD m_SrcSize;
@@ -632,6 +637,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
int m_Predictor;
int m_Colors, m_BitsPerComponent, m_Columns, m_PredictPitch, m_LeftOver;
};
+
CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() {
m_pFlate = NULL;
m_pScanline = NULL;
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index 681678c264..779e7f6b37 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -287,10 +287,12 @@ static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf,
jpeg_destroy_decompress(&cinfo);
return TRUE;
}
+
class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
public:
CCodec_JpegDecoder();
- ~CCodec_JpegDecoder();
+ ~CCodec_JpegDecoder() override;
+
FX_BOOL Create(const uint8_t* src_buf,
FX_DWORD src_size,
int width,
@@ -298,11 +300,16 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
int nComps,
FX_BOOL ColorTransform,
IFX_JpegProvider* pJP);
- virtual void Destroy() { delete this; }
- virtual void v_DownScale(int dest_width, int dest_height);
- virtual FX_BOOL v_Rewind();
- virtual uint8_t* v_GetNextLine();
- virtual FX_DWORD GetSrcOffset();
+ void Destroy() { delete this; }
+
+ // CCodec_ScanlineDecoder
+ void v_DownScale(int dest_width, int dest_height) override;
+ FX_BOOL v_Rewind() override;
+ uint8_t* v_GetNextLine() override;
+ FX_DWORD GetSrcOffset() override;
+
+ FX_BOOL InitDecode();
+
jmp_buf m_JmpBuf;
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
@@ -310,14 +317,17 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
const uint8_t* m_SrcBuf;
FX_DWORD m_SrcSize;
uint8_t* m_pScanlineBuf;
- FX_BOOL InitDecode();
- FX_BOOL m_bInited, m_bStarted, m_bJpegTransform;
+
+ FX_BOOL m_bInited;
+ FX_BOOL m_bStarted;
+ FX_BOOL m_bJpegTransform;
protected:
IFX_JpegProvider* m_pExtProvider;
void* m_pExtContext;
FX_DWORD m_nDefaultScaleDenom;
};
+
CCodec_JpegDecoder::CCodec_JpegDecoder() {
m_pScanlineBuf = NULL;
m_DownScale = 1;