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

Unified Diff: core/fxcodec/codec/include/ccodec_progressivedecoder.h

Issue 1876023003: Remove ICodec_* Interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « core/fxcodec/codec/fx_codec_tiff.cpp ('k') | core/fxcodec/include/fx_codec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/codec/include/ccodec_progressivedecoder.h
diff --git a/core/fxcodec/codec/fx_codec_progress.h b/core/fxcodec/codec/include/ccodec_progressivedecoder.h
similarity index 61%
rename from core/fxcodec/codec/fx_codec_progress.h
rename to core/fxcodec/codec/include/ccodec_progressivedecoder.h
index e8e885b3b57d5a1099235cb42fe6ed75df335ec4..83b73e1ba7cc9c34b791dee69aa0a893ad08e146 100644
--- a/core/fxcodec/codec/fx_codec_progress.h
+++ b/core/fxcodec/codec/include/ccodec_progressivedecoder.h
@@ -4,108 +4,161 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
-#define CORE_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
+#ifndef CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_
+#define CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_
-#include "core/fxcodec/include/fx_codec.h"
-#include "core/fxcrt/include/fx_memory.h"
+#include "core/fxcodec/include/fx_codec_def.h"
#include "core/fxcrt/include/fx_system.h"
#include "core/fxge/include/fx_dib.h"
-#define FXCODEC_BLOCK_SIZE 4096
-#define FXCODEC_PNG_GAMMA 2.2
-
-#if _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
-#undef FXCODEC_PNG_GAMMA
-#define FXCODEC_PNG_GAMMA 1.7
-#endif
-
-struct PixelWeight {
- int m_SrcStart;
- int m_SrcEnd;
- int m_Weights[1];
-};
-
-class CFXCODEC_WeightTable {
- public:
- CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
- ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
-
- void Calc(int dest_len,
- int dest_min,
- int dest_max,
- int src_len,
- int src_min,
- int src_max,
- FX_BOOL bInterpol);
- PixelWeight* GetPixelWeight(int pixel) {
- return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
- }
-
- int m_DestMin, m_ItemSize;
- uint8_t* m_pWeightTables;
-};
-class CFXCODEC_HorzTable {
+class CCodec_BmpModule;
+class CCodec_GifContext;
+class CCodec_GifModule;
+class CCodec_JpegModule;
+class CCodec_ModuleMgr;
+class CCodec_PngContext;
+class CCodec_TiffContext;
+class CFX_DIBAttribute;
+class IFX_FileRead;
+class IFX_Pause;
+struct FXBMP_Context;
+struct FXGIF_Context;
+struct FXJPEG_Context;
+struct FXPNG_Context;
+
+class CCodec_ProgressiveDecoder {
public:
- CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
- ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
+ enum FXCodec_Format {
+ FXCodec_Invalid = 0,
+ FXCodec_1bppGray = 0x101,
+ FXCodec_1bppRgb = 0x001,
+ FXCodec_8bppGray = 0x108,
+ FXCodec_8bppRgb = 0x008,
+ FXCodec_Rgb = 0x018,
+ FXCodec_Rgb32 = 0x020,
+ FXCodec_Argb = 0x220,
+ FXCodec_Cmyk = 0x120
+ };
- void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
- PixelWeight* GetPixelWeight(int pixel) {
- return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
- }
-
- int m_ItemSize;
- uint8_t* m_pWeightTables;
-};
-class CFXCODEC_VertTable {
- public:
- CFXCODEC_VertTable() { m_pWeightTables = NULL; }
- ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
- void Calc(int dest_len, int src_len);
- PixelWeight* GetPixelWeight(int pixel) {
- return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
- }
- int m_ItemSize;
- uint8_t* m_pWeightTables;
-};
-enum FXCodec_Format {
- FXCodec_Invalid = 0,
- FXCodec_1bppGray = 0x101,
- FXCodec_1bppRgb = 0x001,
- FXCodec_8bppGray = 0x108,
- FXCodec_8bppRgb = 0x008,
- FXCodec_Rgb = 0x018,
- FXCodec_Rgb32 = 0x020,
- FXCodec_Argb = 0x220,
- FXCodec_Cmyk = 0x120
-};
-class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
- public:
CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr);
- ~CCodec_ProgressiveDecoder() override;
+ ~CCodec_ProgressiveDecoder();
FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile,
FXCODEC_IMAGE_TYPE imageType,
- CFX_DIBAttribute* pAttribute) override;
+ CFX_DIBAttribute* pAttribute);
- FXCODEC_IMAGE_TYPE GetType() const override { return m_imagType; }
- int32_t GetWidth() const override { return m_SrcWidth; }
- int32_t GetHeight() const override { return m_SrcHeight; }
- int32_t GetNumComponents() const override { return m_SrcComponents; }
- int32_t GetBPC() const override { return m_SrcBPC; }
- void SetClipBox(FX_RECT* clip) override;
+ FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; }
+ int32_t GetWidth() const { return m_SrcWidth; }
+ int32_t GetHeight() const { return m_SrcHeight; }
+ int32_t GetNumComponents() const { return m_SrcComponents; }
+ int32_t GetBPC() const { return m_SrcBPC; }
+ void SetClipBox(FX_RECT* clip);
- FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause) override;
+ FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause = nullptr);
FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap,
int start_x,
int start_y,
int size_x,
int size_y,
- int32_t frames,
- FX_BOOL bInterpol) override;
+ int32_t frames = 0,
+ FX_BOOL bInterpol = TRUE);
+
+ FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = nullptr);
+
+ struct PixelWeight {
+ int m_SrcStart;
+ int m_SrcEnd;
+ int m_Weights[1];
+ };
+
+ class CFXCODEC_WeightTable {
+ public:
+ CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
+ ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
+
+ void Calc(int dest_len,
+ int dest_min,
+ int dest_max,
+ int src_len,
+ int src_min,
+ int src_max,
+ FX_BOOL bInterpol);
+ PixelWeight* GetPixelWeight(int pixel) {
+ return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
+ }
+
+ int m_DestMin, m_ItemSize;
+ uint8_t* m_pWeightTables;
+ };
+
+ class CFXCODEC_HorzTable {
+ public:
+ CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
+ ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
+
+ void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
+ PixelWeight* GetPixelWeight(int pixel) {
+ return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
+ }
+
+ int m_ItemSize;
+ uint8_t* m_pWeightTables;
+ };
+
+ class CFXCODEC_VertTable {
+ public:
+ CFXCODEC_VertTable() { m_pWeightTables = NULL; }
+ ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
+ void Calc(int dest_len, int src_len);
+ PixelWeight* GetPixelWeight(int pixel) {
+ return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
+ }
+ int m_ItemSize;
+ uint8_t* m_pWeightTables;
+ };
- FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause) override;
+ IFX_FileRead* m_pFile;
+ CCodec_ModuleMgr* m_pCodecMgr;
+ FXJPEG_Context* m_pJpegContext;
+ FXPNG_Context* m_pPngContext;
+ FXGIF_Context* m_pGifContext;
+ FXBMP_Context* m_pBmpContext;
+ CCodec_TiffContext* m_pTiffContext;
+ FXCODEC_IMAGE_TYPE m_imagType;
+ uint32_t m_offSet;
+ uint8_t* m_pSrcBuf;
+ uint32_t m_SrcSize;
+ uint8_t* m_pDecodeBuf;
+ int m_ScanlineSize;
+ CFX_DIBitmap* m_pDeviceBitmap;
+ FX_BOOL m_bInterpol;
+ CFXCODEC_WeightTable m_WeightHorz;
+ CFXCODEC_VertTable m_WeightVert;
+ CFXCODEC_HorzTable m_WeightHorzOO;
+ int m_SrcWidth;
+ int m_SrcHeight;
+ int m_SrcComponents;
+ int m_SrcBPC;
+ FX_RECT m_clipBox;
+ int m_startX;
+ int m_startY;
+ int m_sizeX;
+ int m_sizeY;
+ int m_TransMethod;
+ FX_ARGB* m_pSrcPalette;
+ int m_SrcPaletteNumber;
+ int m_SrcRow;
+ FXCodec_Format m_SrcFormat;
+ int m_SrcPassNumber;
+ int m_FrameNumber;
+ int m_FrameCur;
+ int m_GifBgIndex;
+ uint8_t* m_pGifPalette;
+ int32_t m_GifPltNumber;
+ int m_GifTransIndex;
+ FX_RECT m_GifFrameRect;
+ FX_BOOL m_BmpIsTopBottom;
+ FXCODEC_STATUS m_status;
protected:
static FX_BOOL PngReadHeaderFunc(void* pModule,
@@ -158,64 +211,20 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
uint8_t* src_scan,
FXCodec_Format src_format);
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
- FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule,
+ FX_BOOL JpegReadMoreData(CCodec_JpegModule* pJpegModule,
FXCODEC_STATUS& err_status);
void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
int32_t des_line,
uint8_t* src_scan,
FXCodec_Format src_format);
- FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule,
+ FX_BOOL GifReadMoreData(CCodec_GifModule* pGifModule,
FXCODEC_STATUS& err_status);
void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
double scale_y,
int des_row);
- FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule,
+ FX_BOOL BmpReadMoreData(CCodec_BmpModule* pBmpModule,
FXCODEC_STATUS& err_status);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
-
- public:
- IFX_FileRead* m_pFile;
- CCodec_ModuleMgr* m_pCodecMgr;
- void* m_pJpegContext;
- void* m_pPngContext;
- void* m_pGifContext;
- void* m_pBmpContext;
- void* m_pTiffContext;
- FXCODEC_IMAGE_TYPE m_imagType;
- uint32_t m_offSet;
- uint8_t* m_pSrcBuf;
- uint32_t m_SrcSize;
- uint8_t* m_pDecodeBuf;
- int m_ScanlineSize;
- CFX_DIBitmap* m_pDeviceBitmap;
- FX_BOOL m_bInterpol;
- CFXCODEC_WeightTable m_WeightHorz;
- CFXCODEC_VertTable m_WeightVert;
- CFXCODEC_HorzTable m_WeightHorzOO;
- int m_SrcWidth;
- int m_SrcHeight;
- int m_SrcComponents;
- int m_SrcBPC;
- FX_RECT m_clipBox;
- int m_startX;
- int m_startY;
- int m_sizeX;
- int m_sizeY;
- int m_TransMethod;
- FX_ARGB* m_pSrcPalette;
- int m_SrcPaletteNumber;
- int m_SrcRow;
- FXCodec_Format m_SrcFormat;
- int m_SrcPassNumber;
- int m_FrameNumber;
- int m_FrameCur;
- int m_GifBgIndex;
- uint8_t* m_pGifPalette;
- int32_t m_GifPltNumber;
- int m_GifTransIndex;
- FX_RECT m_GifFrameRect;
- FX_BOOL m_BmpIsTopBottom;
- FXCODEC_STATUS m_status;
};
-#endif // CORE_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
+#endif // CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_
« no previous file with comments | « core/fxcodec/codec/fx_codec_tiff.cpp ('k') | core/fxcodec/include/fx_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698