diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
commit | b048f791a15f2da781a01eba5b09eb9d389f9c11 (patch) | |
tree | 6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /core/include/fxcodec/fx_codec.h | |
parent | c8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff) | |
download | pdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz |
clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163' | \
xargs ../../buildtools/mac/clang-format -i
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'core/include/fxcodec/fx_codec.h')
-rw-r--r-- | core/include/fxcodec/fx_codec.h | 512 |
1 files changed, 305 insertions, 207 deletions
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index e3d69e5dc9..39fd764ea9 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -24,233 +24,331 @@ class ICodec_FlateModule; class ICodec_Jbig2Encoder; class ICodec_ScanlineDecoder; -class CCodec_ModuleMgr -{ -public: - CCodec_ModuleMgr(); - ICodec_Jbig2Encoder* CreateJbig2Encoder(); - ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } - ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } - ICodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } - ICodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } - ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } - ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } - ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } - -protected: - nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule; - nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule; - nonstd::unique_ptr<ICodec_JpegModule> m_pJpegModule; - nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule; - nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module; - nonstd::unique_ptr<ICodec_IccModule> m_pIccModule; - nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule; +class CCodec_ModuleMgr { + public: + CCodec_ModuleMgr(); + ICodec_Jbig2Encoder* CreateJbig2Encoder(); + ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } + ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } + ICodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } + ICodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } + ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } + ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } + ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } + + protected: + nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule; + nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule; + nonstd::unique_ptr<ICodec_JpegModule> m_pJpegModule; + nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule; + nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module; + nonstd::unique_ptr<ICodec_IccModule> m_pIccModule; + nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule; }; -class ICodec_BasicModule -{ -public: - - virtual ~ICodec_BasicModule() {} - virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; - virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; - virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int nComps, int bpc) = 0; +class ICodec_BasicModule { + public: + virtual ~ICodec_BasicModule() {} + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size) = 0; + virtual FX_BOOL A85Encode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size) = 0; + virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + int width, + int height, + int nComps, + int bpc) = 0; }; -class ICodec_ScanlineDecoder -{ -public: - - virtual ~ICodec_ScanlineDecoder() {} +class ICodec_ScanlineDecoder { + public: + virtual ~ICodec_ScanlineDecoder() {} - virtual FX_DWORD GetSrcOffset() = 0; + virtual FX_DWORD GetSrcOffset() = 0; - virtual void DownScale(int dest_width, int dest_height) = 0; + virtual void DownScale(int dest_width, int dest_height) = 0; - virtual uint8_t* GetScanline(int line) = 0; + virtual uint8_t* GetScanline(int line) = 0; - virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; + virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; - virtual int GetWidth() = 0; + virtual int GetWidth() = 0; - virtual int GetHeight() = 0; + virtual int GetHeight() = 0; - virtual int CountComps() = 0; + virtual int CountComps() = 0; - virtual int GetBPC() = 0; + virtual int GetBPC() = 0; - virtual FX_BOOL IsColorTransformed() = 0; + virtual FX_BOOL IsColorTransformed() = 0; - virtual void ClearImageData() = 0; + virtual void ClearImageData() = 0; }; -class ICodec_FlateModule -{ -public: - - virtual ~ICodec_FlateModule() {} - virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) = 0; - virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, - int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, - int predictor, int Colors, int BitsPerComponent, int Columns, - uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; +class ICodec_FlateModule { + public: + virtual ~ICodec_FlateModule() {} + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + int width, + int height, + int nComps, + int bpc, + int predictor, + int Colors, + int BitsPerComponent, + int Columns) = 0; + virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, + const uint8_t* src_buf, + FX_DWORD src_size, + FX_BOOL bEarlyChange, + int predictor, + int Colors, + int BitsPerComponent, + int Columns, + FX_DWORD estimated_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size) = 0; + virtual FX_BOOL Encode(const uint8_t* src_buf, + FX_DWORD src_size, + int predictor, + int Colors, + int BitsPerComponent, + int Columns, + uint8_t*& dest_buf, + FX_DWORD& dest_size) = 0; + virtual FX_BOOL Encode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size) = 0; }; -class ICodec_FaxModule -{ -public: - - virtual ~ICodec_FaxModule() {} - - virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) = 0; - - - virtual FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, - uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; +class ICodec_FaxModule { + public: + virtual ~ICodec_FaxModule() {} + + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + int width, + int height, + int K, + FX_BOOL EndOfLine, + FX_BOOL EncodedByteAlign, + FX_BOOL BlackIs1, + int Columns, + int Rows) = 0; + + virtual FX_BOOL Encode(const uint8_t* src_buf, + int width, + int height, + int pitch, + uint8_t*& dest_buf, + FX_DWORD& dest_size) = 0; }; -class ICodec_JpegModule -{ -public: - - virtual ~ICodec_JpegModule() {} - - virtual void SetPovider(IFX_JpegProvider* pJP) = 0; - - virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, - int width, int height, int nComps, FX_BOOL ColorTransform) = 0; - - virtual FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, - int& num_components, int& bits_per_components, FX_BOOL& color_transform, - uint8_t** icc_buf_ptr = NULL, FX_DWORD* icc_length = NULL) = 0; - - virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality = 75, - const uint8_t* icc_buf = NULL, FX_DWORD icc_length = 0) = 0; - - virtual void* Start() = 0; - - virtual void Finish(void* pContext) = 0; - - virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size) = 0; - - virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps) = 0; - - - virtual int StartScanline(void* pContext, int down_scale) = 0; - - - virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; - - - virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr = NULL) = 0; +class ICodec_JpegModule { + public: + virtual ~ICodec_JpegModule() {} + + virtual void SetPovider(IFX_JpegProvider* pJP) = 0; + + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + int width, + int height, + int nComps, + FX_BOOL ColorTransform) = 0; + + virtual FX_BOOL LoadInfo(const uint8_t* src_buf, + FX_DWORD src_size, + int& width, + int& height, + int& num_components, + int& bits_per_components, + FX_BOOL& color_transform, + uint8_t** icc_buf_ptr = NULL, + FX_DWORD* icc_length = NULL) = 0; + + virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, + uint8_t*& dest_buf, + FX_STRSIZE& dest_size, + int quality = 75, + const uint8_t* icc_buf = NULL, + FX_DWORD icc_length = 0) = 0; + + virtual void* Start() = 0; + + virtual void Finish(void* pContext) = 0; + + virtual void Input(void* pContext, + const uint8_t* src_buf, + FX_DWORD src_size) = 0; + + virtual int ReadHeader(void* pContext, + int* width, + int* height, + int* nComps) = 0; + + virtual int StartScanline(void* pContext, int down_scale) = 0; + + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; + + virtual FX_DWORD GetAvailInput(void* pContext, + uint8_t** avail_buf_ptr = NULL) = 0; }; -class ICodec_JpxModule -{ -public: - - virtual ~ICodec_JpxModule() {} - - virtual void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE) = 0; - - virtual void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, - FX_DWORD& codestream_nComps, FX_DWORD& output_nComps) = 0; - - virtual FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, - FX_BOOL bTranslateColor, uint8_t* offsets) = 0; - - virtual void DestroyDecoder(void* ctx) = 0; +class ICodec_JpxModule { + public: + virtual ~ICodec_JpxModule() {} + + virtual void* CreateDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + FX_BOOL useColorSpace = FALSE) = 0; + + virtual void GetImageInfo(void* ctx, + FX_DWORD& width, + FX_DWORD& height, + FX_DWORD& codestream_nComps, + FX_DWORD& output_nComps) = 0; + + virtual FX_BOOL Decode(void* ctx, + uint8_t* dest_data, + int pitch, + FX_BOOL bTranslateColor, + uint8_t* offsets) = 0; + + virtual void DestroyDecoder(void* ctx) = 0; }; -class ICodec_Jbig2Module -{ -public: - - virtual ~ICodec_Jbig2Module() {} - - virtual FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, - const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) = 0; - - virtual FX_BOOL Decode(IFX_FileRead* file_ptr, FX_DWORD& width, FX_DWORD& height, - FX_DWORD& pitch, uint8_t*& dest_buf) = 0; - virtual void* CreateJbig2Context() = 0; - - virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, - const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) = 0; - - virtual 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) = 0; - virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, IFX_Pause* pPause) = 0; - virtual void DestroyJbig2Context(void* pJbig2Content) = 0; +class ICodec_Jbig2Module { + public: + virtual ~ICodec_Jbig2Module() {} + + virtual FX_BOOL Decode(FX_DWORD width, + FX_DWORD height, + const uint8_t* src_buf, + FX_DWORD src_size, + const uint8_t* global_data, + FX_DWORD global_size, + uint8_t* dest_buf, + FX_DWORD dest_pitch) = 0; + + virtual FX_BOOL Decode(IFX_FileRead* file_ptr, + FX_DWORD& width, + FX_DWORD& height, + FX_DWORD& pitch, + uint8_t*& dest_buf) = 0; + virtual void* CreateJbig2Context() = 0; + + virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, + FX_DWORD width, + FX_DWORD height, + const uint8_t* src_buf, + FX_DWORD src_size, + const uint8_t* global_data, + FX_DWORD global_size, + uint8_t* dest_buf, + FX_DWORD dest_pitch, + IFX_Pause* pPause) = 0; + + virtual 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) = 0; + virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, + IFX_Pause* pPause) = 0; + virtual void DestroyJbig2Context(void* pJbig2Content) = 0; }; -class ICodec_Jbig2Encoder -{ -public: - - virtual ~ICodec_Jbig2Encoder() {} +class ICodec_Jbig2Encoder { + public: + virtual ~ICodec_Jbig2Encoder() {} }; -class ICodec_IccModule -{ -public: - typedef enum { - IccCS_Unknown = 0, - IccCS_XYZ, - IccCS_Lab, - IccCS_Luv, - IccCS_YCbCr, - IccCS_Yxy, - IccCS_Hsv, - IccCS_Hls, - IccCS_Gray, - IccCS_Rgb, - IccCS_Cmyk, - IccCS_Cmy - } IccCS; - typedef struct _IccParam { - FX_DWORD Version; - IccCS ColorSpace; - FX_DWORD dwProfileType; - FX_DWORD dwFormat; - uint8_t* pProfileData; - FX_DWORD dwProfileSize; - double Gamma; - } IccParam; - - virtual ~ICodec_IccModule() {} - - virtual IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize) = 0; - - virtual IccCS GetProfileCS(IFX_FileRead* pFile) = 0; - - virtual void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, - ICodec_IccModule::IccParam* pOutputParam, - ICodec_IccModule::IccParam* pProofParam = NULL, - FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, - FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, - FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, - FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING - ) = 0; - - - virtual void* CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; - - virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, - const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT - ) = 0; - - virtual void DestroyTransform(void* pTransform) = 0; - - virtual void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues) = 0; - - virtual void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels) = 0; - virtual void SetComponents(FX_DWORD nComponents) = 0; +class ICodec_IccModule { + public: + typedef enum { + IccCS_Unknown = 0, + IccCS_XYZ, + IccCS_Lab, + IccCS_Luv, + IccCS_YCbCr, + IccCS_Yxy, + IccCS_Hsv, + IccCS_Hls, + IccCS_Gray, + IccCS_Rgb, + IccCS_Cmyk, + IccCS_Cmy + } IccCS; + typedef struct _IccParam { + FX_DWORD Version; + IccCS ColorSpace; + FX_DWORD dwProfileType; + FX_DWORD dwFormat; + uint8_t* pProfileData; + FX_DWORD dwProfileSize; + double Gamma; + } IccParam; + + virtual ~ICodec_IccModule() {} + + virtual IccCS GetProfileCS(const uint8_t* pProfileData, + unsigned int dwProfileSize) = 0; + + virtual IccCS GetProfileCS(IFX_FileRead* pFile) = 0; + + virtual void* CreateTransform( + ICodec_IccModule::IccParam* pInputParam, + ICodec_IccModule::IccParam* pOutputParam, + ICodec_IccModule::IccParam* pProofParam = NULL, + FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, + FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, + FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, + FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) = 0; + + virtual void* CreateTransform_sRGB( + const uint8_t* pProfileData, + FX_DWORD dwProfileSize, + int32_t& nComponents, + int32_t intent = 0, + FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; + + virtual void* CreateTransform_CMYK( + const uint8_t* pSrcProfileData, + FX_DWORD dwSrcProfileSize, + int32_t& nSrcComponents, + const uint8_t* pDstProfileData, + FX_DWORD dwDstProfileSize, + int32_t intent = 0, + FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, + FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) = 0; + + virtual void DestroyTransform(void* pTransform) = 0; + + virtual void Translate(void* pTransform, + FX_FLOAT* pSrcValues, + FX_FLOAT* pDestValues) = 0; + + virtual void TranslateScanline(void* pTransform, + uint8_t* pDest, + const uint8_t* pSrc, + int pixels) = 0; + virtual void SetComponents(FX_DWORD nComponents) = 0; }; -void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B); -void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R, uint8_t& G, uint8_t& B); +void AdobeCMYK_to_sRGB(FX_FLOAT c, + FX_FLOAT m, + FX_FLOAT y, + FX_FLOAT k, + FX_FLOAT& R, + FX_FLOAT& G, + FX_FLOAT& B); +void AdobeCMYK_to_sRGB1(uint8_t c, + uint8_t m, + uint8_t y, + uint8_t k, + uint8_t& R, + uint8_t& G, + uint8_t& B); FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]); #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |