summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-22 14:37:03 -0800
committerLei Zhang <thestig@chromium.org>2015-12-22 14:37:03 -0800
commitbe9095d0b2819cdc88785b0b4fdfccf837eb96a9 (patch)
tree8c81760b66d1e8da186bddc52d38f350f4e85bf1 /core/include
parent2d63eaaa39bb3d402c658b2a6e0eae50a30f1d89 (diff)
downloadpdfium-be9095d0b2819cdc88785b0b4fdfccf837eb96a9.tar.xz
Revert "Cleanup: Remove unused CFX_PSRenderer and various encoders it used."
This reverts commit 2d63eaaa39bb3d402c658b2a6e0eae50a30f1d89. Broke the Windows build, though it is likely the code is unused on Windows too. Review URL: https://codereview.chromium.org/1540993004 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h23
-rw-r--r--core/include/fxcodec/fx_codec.h63
-rw-r--r--core/include/fxge/fx_ge.h119
3 files changed, 177 insertions, 28 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 1e2706ddcf..752df789da 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -826,19 +826,18 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec);
void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec,
const CFX_WideString& fullpath);
-bool FlateEncode(const uint8_t* src_buf,
+void FlateEncode(const uint8_t* src_buf,
FX_DWORD src_size,
- uint8_t** dest_buf,
- FX_DWORD* dest_size);
-
-// This used to have more parameters like the predictor and bpc, but there was
-// only one callers, so the interface has been simplified, the values are hard
-// coded, and dead code has been removed.
-bool PngEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
- uint8_t** dest_buf,
- FX_DWORD* dest_size);
-
+ uint8_t*& dest_buf,
+ FX_DWORD& dest_size);
+void FlateEncode(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);
FX_DWORD FlateDecode(const uint8_t* src_buf,
FX_DWORD src_size,
uint8_t*& dest_buf,
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h
index 593940df84..c068a08025 100644
--- a/core/include/fxcodec/fx_codec.h
+++ b/core/include/fxcodec/fx_codec.h
@@ -25,6 +25,7 @@ class ICodec_JpxModule;
class ICodec_Jbig2Module;
class ICodec_IccModule;
class ICodec_FlateModule;
+class ICodec_Jbig2Encoder;
class ICodec_ScanlineDecoder;
class CCodec_ModuleMgr {
@@ -51,6 +52,14 @@ class CCodec_ModuleMgr {
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,
@@ -108,14 +117,18 @@ class ICodec_FlateModule {
FX_DWORD estimated_size,
uint8_t*& dest_buf,
FX_DWORD& dest_size) = 0;
- virtual bool Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
- uint8_t** dest_buf,
- FX_DWORD* dest_size) = 0;
- virtual bool PngEncode(const uint8_t* src_buf,
+ virtual FX_BOOL Encode(const uint8_t* src_buf,
FX_DWORD src_size,
- uint8_t** dest_buf,
- FX_DWORD* dest_size) = 0;
+ 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:
@@ -131,8 +144,14 @@ class ICodec_FaxModule {
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() {}
@@ -144,13 +163,22 @@ class ICodec_JpegModule {
int nComps,
FX_BOOL ColorTransform) = 0;
- virtual bool LoadInfo(const uint8_t* src_buf,
- FX_DWORD src_size,
- int* width,
- int* height,
- int* num_components,
- int* bits_per_components,
- bool* color_transform) = 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;
@@ -214,7 +242,10 @@ class ICodec_Jbig2Module {
IFX_Pause* pPause) = 0;
virtual void DestroyJbig2Context(void* pJbig2Content) = 0;
};
-
+class ICodec_Jbig2Encoder {
+ public:
+ virtual ~ICodec_Jbig2Encoder() {}
+};
class ICodec_IccModule {
public:
typedef enum {
diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h
index e2a400e83d..01a1c72a8f 100644
--- a/core/include/fxge/fx_ge.h
+++ b/core/include/fxge/fx_ge.h
@@ -608,4 +608,123 @@ class IFX_RenderDeviceDriver {
virtual void ClearDriver() {}
};
+class IFX_PSOutput {
+ public:
+ virtual void Release() = 0;
+ virtual void OutputPS(const FX_CHAR* string, int len) = 0;
+
+ protected:
+ virtual ~IFX_PSOutput() {}
+};
+
+class CPSFont;
+class CFX_PSRenderer {
+ public:
+ CFX_PSRenderer();
+
+ ~CFX_PSRenderer();
+
+ void Init(IFX_PSOutput* pOutput,
+ int ps_level,
+ int width,
+ int height,
+ FX_BOOL bCmykOutput);
+ FX_BOOL StartRendering();
+ void EndRendering();
+
+ void SaveState();
+
+ void RestoreState(FX_BOOL bKeepSaved = FALSE);
+
+ void SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode);
+
+ void SetClip_PathStroke(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState);
+
+ FX_RECT GetClipBox() { return m_ClipBox; }
+
+ FX_BOOL DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ FX_DWORD fill_color,
+ FX_DWORD stroke_color,
+ int fill_mode,
+ int alpha_flag = 0,
+ void* pIccTransform = NULL);
+
+ FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
+ FX_DWORD color,
+ int dest_left,
+ int dest_top,
+ int alpha_flag = 0,
+ void* pIccTransform = NULL);
+
+ FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
+ FX_DWORD color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ FX_DWORD flags,
+ int alpha_flag = 0,
+ void* pIccTransform = NULL);
+
+ FX_BOOL DrawDIBits(const CFX_DIBSource* pBitmap,
+ FX_DWORD color,
+ const CFX_Matrix* pMatrix,
+ FX_DWORD flags,
+ int alpha_flag = 0,
+ void* pIccTransform = NULL);
+
+ FX_BOOL DrawText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ CFX_FontCache* pCache,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ FX_DWORD color,
+ int alpha_flag = 0,
+ void* pIccTransform = NULL);
+
+ private:
+ IFX_PSOutput* m_pOutput;
+
+ int m_PSLevel;
+
+ CFX_GraphStateData m_CurGraphState;
+
+ FX_BOOL m_bGraphStateSet;
+
+ FX_BOOL m_bCmykOutput;
+
+ FX_BOOL m_bColorSet;
+
+ FX_DWORD m_LastColor;
+
+ FX_RECT m_ClipBox;
+
+ CFX_ArrayTemplate<CPSFont*> m_PSFontList;
+
+ CFX_ArrayTemplate<FX_RECT> m_ClipBoxStack;
+ FX_BOOL m_bInited;
+
+ void OutputPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device);
+
+ void SetGraphState(const CFX_GraphStateData* pGraphState);
+
+ void SetColor(FX_DWORD color, int alpha_flag, void* pIccTransform);
+
+ void FindPSFontGlyph(CFX_FaceCache* pFaceCache,
+ CFX_Font* pFont,
+ const FXTEXT_CHARPOS& charpos,
+ int& ps_fontnum,
+ int& ps_glyphindex);
+
+ void WritePSBinary(const uint8_t* data, int len);
+};
+
#endif // CORE_INCLUDE_FXGE_FX_GE_H_