Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: core/include/fxcodec/fx_codec.h

Issue 1398383002: core/ difference with XFA (for information only). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: After bidi Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/include/fxcodec/fx_codec.h
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h
index f283e64cd8a549e3a0d8464760da023ec7b705b1..a272c775b7044166f4831879f6319f9c63fa9c55 100644
--- a/core/include/fxcodec/fx_codec.h
+++ b/core/include/fxcodec/fx_codec.h
@@ -7,10 +7,16 @@
#ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_
#define CORE_INCLUDE_FXCODEC_FX_CODEC_H_
+#ifdef PDF_ENABLE_XFA
+#include <map>
+#endif
#include <vector>
#include "../../../third_party/base/nonstd_unique_ptr.h"
#include "../fxcrt/fx_basic.h"
+#ifdef PDF_ENABLE_XFA
+#include "../fxcrt/fx_coordinates.h"
+#endif
#include "fx_codec_def.h"
#include "fx_codec_provider.h"
@@ -19,6 +25,9 @@ class CJPX_Decoder;
class CPDF_PrivateData;
class CPDF_StreamAcc;
class ICodec_ScanlineDecoder;
+#ifdef PDF_ENABLE_XFA
+class ICodec_ProgressiveDecoder;
+#endif
class ICodec_BasicModule;
class ICodec_FaxModule;
class ICodec_JpegModule;
@@ -27,11 +36,21 @@ class ICodec_Jbig2Module;
class ICodec_IccModule;
class ICodec_FlateModule;
class ICodec_Jbig2Encoder;
+#ifdef PDF_ENABLE_XFA
+class ICodec_PngModule;
+class ICodec_GifModule;
+class ICodec_BmpModule;
+class ICodec_TiffModule;
+class CFX_DIBAttribute;
+#endif
class ICodec_ScanlineDecoder;
class CCodec_ModuleMgr {
public:
CCodec_ModuleMgr();
+#ifdef PDF_ENABLE_XFA
+ ICodec_ProgressiveDecoder* CreateProgressiveDecoder();
+#endif
ICodec_Jbig2Encoder* CreateJbig2Encoder();
ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); }
ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); }
@@ -40,6 +59,12 @@ class CCodec_ModuleMgr {
ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); }
ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); }
ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); }
+#ifdef PDF_ENABLE_XFA
+ ICodec_PngModule* GetPngModule() const { return m_pPngModule.get(); }
+ ICodec_GifModule* GetGifModule() const { return m_pGifModule.get(); }
+ ICodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
+ ICodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); }
+#endif
protected:
nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule;
@@ -49,6 +74,12 @@ class CCodec_ModuleMgr {
nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module;
nonstd::unique_ptr<ICodec_IccModule> m_pIccModule;
nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule;
+#ifdef PDF_ENABLE_XFA
+ nonstd::unique_ptr<ICodec_PngModule> m_pPngModule;
+ nonstd::unique_ptr<ICodec_GifModule> m_pGifModule;
+ nonstd::unique_ptr<ICodec_BmpModule> m_pBmpModule;
+ nonstd::unique_ptr<ICodec_TiffModule> m_pTiffModule;
+#endif
};
class ICodec_BasicModule {
public:
@@ -194,7 +225,12 @@ class ICodec_JpegModule {
virtual int ReadHeader(void* pContext,
int* width,
int* height,
+#ifndef PDF_ENABLE_XFA
int* nComps) = 0;
+#else
+ int* nComps,
+ CFX_DIBAttribute* pAttribute = NULL) = 0;
+#endif
virtual int StartScanline(void* pContext, int down_scale) = 0;
@@ -224,6 +260,123 @@ class ICodec_JpxModule {
virtual void DestroyDecoder(CJPX_Decoder* pDecoder) = 0;
};
+#ifdef PDF_ENABLE_XFA
+class ICodec_PngModule {
+ public:
+ virtual ~ICodec_PngModule() {}
+
+ virtual void* Start(void* pModule) = 0;
+
+ virtual void Finish(void* pContext) = 0;
+
+ virtual FX_BOOL Input(void* pContext,
+ const uint8_t* src_buf,
+ FX_DWORD src_size,
+ CFX_DIBAttribute* pAttribute = NULL) = 0;
+
+ FX_BOOL (*ReadHeaderCallback)(void* pModule, int width, int height, int bpc, int pass, int* color_type, double* gamma);
+
+ FX_BOOL (*AskScanlineBufCallback)(void* pModule, int line, uint8_t*& src_buf);
+
+ void (*FillScanlineBufCompletedCallback)(void* pModule, int pass, int line);
+};
+class ICodec_GifModule {
+ public:
+ virtual ~ICodec_GifModule() {}
+
+ virtual void* Start(void* pModule) = 0;
+
+ virtual void Finish(void* pContext) = 0;
+
+ virtual FX_DWORD GetAvailInput(void* pContext,
+ uint8_t** avail_buf_ptr = NULL) = 0;
+
+ virtual void Input(void* pContext,
+ const uint8_t* src_buf,
+ FX_DWORD src_size) = 0;
+
+ virtual int32_t ReadHeader(void* pContext,
+ int* width,
+ int* height,
+ int* pal_num,
+ void** pal_pp,
+ int* bg_index,
+ CFX_DIBAttribute* pAttribute = NULL) = 0;
+
+ virtual int32_t LoadFrameInfo(void* pContext, int* frame_num) = 0;
+
+ void (*RecordCurrentPositionCallback)(void* pModule, FX_DWORD& cur_pos);
+
+ uint8_t* (*AskLocalPaletteBufCallback)(void* pModule,
+ int32_t frame_num,
+ int32_t pal_size);
+
+ virtual int32_t LoadFrame(void* pContext,
+ int frame_num,
+ CFX_DIBAttribute* pAttribute = NULL) = 0;
+
+ FX_BOOL (*InputRecordPositionBufCallback)(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
+
+ void (*ReadScanlineCallback)(void* pModule,
+ int32_t row_num,
+ uint8_t* row_buf);
+};
+class ICodec_BmpModule {
+ public:
+ virtual ~ICodec_BmpModule() {}
+
+ virtual void* Start(void* pModule) = 0;
+
+ virtual void Finish(void* pContext) = 0;
+
+ virtual FX_DWORD GetAvailInput(void* pContext,
+ uint8_t** avail_buf_ptr = NULL) = 0;
+
+ virtual void Input(void* pContext,
+ const uint8_t* src_buf,
+ FX_DWORD src_size) = 0;
+
+ virtual int32_t ReadHeader(void* pContext,
+ int32_t* width,
+ int32_t* height,
+ FX_BOOL* tb_flag,
+ int32_t* components,
+ int* pal_num,
+ FX_DWORD** pal_pp,
+ CFX_DIBAttribute* pAttribute = NULL) = 0;
+
+ virtual int32_t LoadImage(void* pContext) = 0;
+
+ FX_BOOL (*InputImagePositionBufCallback)(void* pModule, FX_DWORD rcd_pos);
+
+ void (*ReadScanlineCallback)(void* pModule,
+ int32_t row_num,
+ uint8_t* row_buf);
+};
+class ICodec_TiffModule {
+ public:
+ virtual ~ICodec_TiffModule() {}
+
+ virtual void* CreateDecoder(IFX_FileRead* file_ptr) = 0;
+
+ virtual void GetFrames(void* ctx, int32_t& frames) = 0;
+
+ 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) = 0;
+
+ virtual FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) = 0;
+
+ virtual void DestroyDecoder(void* ctx) = 0;
+};
+#endif
class ICodec_Jbig2Module {
public:
@@ -245,6 +398,42 @@ class ICodec_Jbig2Module {
IFX_Pause* pPause) = 0;
virtual void DestroyJbig2Context(void* pJbig2Content) = 0;
};
+#ifdef PDF_ENABLE_XFA
+class ICodec_ProgressiveDecoder {
+ public:
+ virtual ~ICodec_ProgressiveDecoder() {}
+
+ virtual FXCODEC_STATUS LoadImageInfo(
+ IFX_FileRead* pFile,
+ FXCODEC_IMAGE_TYPE imageType = FXCODEC_IMAGE_UNKNOWN,
+ CFX_DIBAttribute* pAttribute = NULL) = 0;
+
+ virtual FXCODEC_IMAGE_TYPE GetType() = 0;
+
+ virtual int32_t GetWidth() = 0;
+
+ virtual int32_t GetHeight() = 0;
+
+ virtual int32_t GetNumComponents() = 0;
+
+ virtual int32_t GetBPC() = 0;
+
+ virtual void SetClipBox(FX_RECT* clip) = 0;
+
+ virtual FXCODEC_STATUS GetFrames(int32_t& frames,
+ IFX_Pause* pPause = NULL) = 0;
+
+ virtual FXCODEC_STATUS StartDecode(class CFX_DIBitmap* pDIBitmap,
+ int32_t start_x,
+ int32_t start_y,
+ int32_t size_x,
+ int32_t size_y,
+ int32_t frames = 0,
+ FX_BOOL bInterpol = TRUE) = 0;
+
+ virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = NULL) = 0;
+};
+#endif
class ICodec_Jbig2Encoder {
public:
virtual ~ICodec_Jbig2Encoder() {}
@@ -320,6 +509,9 @@ class ICodec_IccModule {
int pixels) = 0;
virtual void SetComponents(FX_DWORD nComponents) = 0;
};
+#ifdef PDF_ENABLE_XFA
+
+#endif
void AdobeCMYK_to_sRGB(FX_FLOAT c,
FX_FLOAT m,
FX_FLOAT y,
@@ -336,6 +528,39 @@ void AdobeCMYK_to_sRGB1(uint8_t c,
uint8_t& B);
FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]);
+#ifdef PDF_ENABLE_XFA
+class CFX_DIBAttribute {
+ public:
+ CFX_DIBAttribute();
+ ~CFX_DIBAttribute();
+
+ int32_t m_nXDPI;
+ int32_t m_nYDPI;
+ FX_FLOAT m_fAspectRatio;
+ FX_WORD m_wDPIUnit;
+ CFX_ByteString m_strAuthor;
+ uint8_t m_strTime[20];
+ int32_t m_nGifLeft;
+ int32_t m_nGifTop;
+ FX_DWORD* m_pGifLocalPalette;
+ FX_DWORD m_nGifLocalPalNum;
+ int32_t m_nBmpCompressType;
+ std::map<FX_DWORD, void*> m_Exif;
+};
+
+FX_BOOL FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos);
Tom Sepez 2015/10/29 23:07:37 note: getting fixed.
+FX_BOOL FaxGet1DLine(const uint8_t* src_buf,
+ int bitsize,
+ int& bitpos,
+ uint8_t* dest_buf,
+ int columns);
+FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
+ int bitsize,
+ int& bitpos,
+ uint8_t* dest_buf,
+ const uint8_t* ref_buf,
+ int columns);
+#endif
void FaxG4Decode(const uint8_t* src_buf,
FX_DWORD src_size,
int* pbitpos,

Powered by Google App Engine
This is Rietveld 408576698