From 62b2e912dc2a508972fbf01b25f7449c39ff1543 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 14 Aug 2015 21:49:19 -0700 Subject: Merge to XFA: Use override in more classes in core/ R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1292613003 . (cherry picked from commit c2c3f7b5f0396409451a9d344f35ec1929a76e9f) Review URL: https://codereview.chromium.org/1296043002 . --- core/src/fxcodec/codec/codec_int.h | 94 ++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 44 deletions(-) (limited to 'core/src/fxcodec/codec/codec_int.h') diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index aed24d8791..be59655b4e 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) {} @@ -308,6 +304,7 @@ class CCodec_IccModule : public ICodec_IccModule { Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); }; + class CCodec_JpxModule : public ICodec_JpxModule { public: CCodec_JpxModule(); @@ -326,20 +323,26 @@ class CCodec_JpxModule : public ICodec_JpxModule { uint8_t* offsets); void DestroyDecoder(void* ctx); }; + class CCodec_TiffModule : public ICodec_TiffModule { public: - virtual void* CreateDecoder(IFX_FileRead* file_ptr); - virtual void GetFrames(void* ctx, int32_t& frames); - virtual FX_BOOL LoadFrameInfo(void* ctx, - int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, - CFX_DIBAttribute* pAttribute = NULL); - virtual FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap); - virtual void DestroyDecoder(void* ctx); + // ICodec_TiffModule + void* CreateDecoder(IFX_FileRead* file_ptr) override; + void GetFrames(void* ctx, int32_t& frames) override; + FX_BOOL LoadFrameInfo(void* ctx, + int32_t frame, + FX_DWORD& width, + FX_DWORD& height, + FX_DWORD& comps, + FX_DWORD& bpc, + CFX_DIBAttribute* pAttribute = NULL) override; + FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) override; + void DestroyDecoder(void* ctx) override; + + protected: + ~CCodec_TiffModule() override {} }; + class CPDF_Jbig2Interface : public CJBig2_Module { public: virtual void* JBig2_Malloc(FX_DWORD dwSize) { @@ -366,6 +369,7 @@ class CPDF_Jbig2Interface : public CJBig2_Module { } virtual void JBig2_Free(void* pMem) { FX_Free(pMem); } }; + class CCodec_Jbig2Context { public: CCodec_Jbig2Context(); @@ -387,7 +391,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, @@ -395,13 +401,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, @@ -411,21 +417,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 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 m_SymbolDictCache; }; class CFX_DIBAttributeExif : public IFX_DIBAttributeExif { public: -- cgit v1.2.3