summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 14:07:43 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 14:07:43 -0700
commitc2c3f7b5f0396409451a9d344f35ec1929a76e9f (patch)
treeb1c696afdca13e8087e18014b19a6c82415f72d5 /core/src/fpdfapi
parentc6540e037ed1a9546d5a90455bf440a24b181ab4 (diff)
downloadpdfium-c2c3f7b5f0396409451a9d344f35ec1929a76e9f.tar.xz
Use override in more classes in core/
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1292613003 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h10
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp41
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_render/render_int.h65
5 files changed, 82 insertions, 40 deletions
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index b717c7af8b..78de3f0a28 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -166,7 +166,7 @@ class CFX_CTTGSUBTable {
TT_uint16_t GlyphCount;
TT_uint16_t* GlyphArray;
TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; }
- ~TCoverageFormat1() {
+ ~TCoverageFormat1() override {
if (GlyphArray) {
delete[] GlyphArray;
}
@@ -194,7 +194,7 @@ class CFX_CTTGSUBTable {
TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) {
CoverageFormat = 2;
}
- ~TCoverageFormat2() {
+ ~TCoverageFormat2() override {
if (RangeRecord) {
delete[] RangeRecord;
}
@@ -220,7 +220,7 @@ class CFX_CTTGSUBTable {
TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) {
ClassFormat = 1;
}
- ~TClassDefFormat1() {
+ ~TClassDefFormat1() override {
if (ClassValueArray) {
delete[] ClassValueArray;
}
@@ -246,7 +246,7 @@ class CFX_CTTGSUBTable {
TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) {
ClassFormat = 2;
}
- ~TClassDefFormat2() {
+ ~TClassDefFormat2() override {
if (ClassRangeRecord) {
delete[] ClassRangeRecord;
}
@@ -279,7 +279,7 @@ class CFX_CTTGSUBTable {
TCoverageFormatBase* Coverage;
TT_int16_t DeltaGlyphID;
TSingleSubstFormat1() : Coverage(NULL), DeltaGlyphID(0) { SubstFormat = 1; }
- ~TSingleSubstFormat1() { delete Coverage; }
+ ~TSingleSubstFormat1() override { delete Coverage; }
private:
TSingleSubstFormat1(const TSingleSubstFormat1&);
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 87ff0a3b63..1ee062ee7c 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -463,18 +463,23 @@ typedef struct {
int sizes;
} SampleEncodeInfo;
typedef struct { FX_FLOAT decode_max, decode_min; } SampleDecodeInfo;
+
class CPDF_SampledFunc : public CPDF_Function {
public:
CPDF_SampledFunc();
- virtual ~CPDF_SampledFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ ~CPDF_SampledFunc() override;
+
+ // CPDF_Function
+ FX_BOOL v_Init(CPDF_Object* pObj) override;
+ FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+
SampleEncodeInfo* m_pEncodeInfo;
SampleDecodeInfo* m_pDecodeInfo;
FX_DWORD m_nBitsPerSample;
FX_DWORD m_SampleMax;
CPDF_StreamAcc* m_pSampleStream;
};
+
CPDF_SampledFunc::CPDF_SampledFunc() {
m_pSampleStream = NULL;
m_pEncodeInfo = NULL;
@@ -620,12 +625,16 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
}
return TRUE;
}
+
class CPDF_PSFunc : public CPDF_Function {
public:
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ // CPDF_Function
+ FX_BOOL v_Init(CPDF_Object* pObj) override;
+ FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+
CPDF_PSEngine m_PS;
};
+
FX_BOOL CPDF_PSFunc::v_Init(CPDF_Object* pObj) {
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_StreamAcc acc;
@@ -648,17 +657,22 @@ FX_BOOL CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
}
return TRUE;
}
+
class CPDF_ExpIntFunc : public CPDF_Function {
public:
CPDF_ExpIntFunc();
- virtual ~CPDF_ExpIntFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ ~CPDF_ExpIntFunc() override;
+
+ // CPDF_Function
+ FX_BOOL v_Init(CPDF_Object* pObj) override;
+ FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+
FX_FLOAT m_Exponent;
FX_FLOAT* m_pBeginValues;
FX_FLOAT* m_pEndValues;
int m_nOrigOutputs;
};
+
CPDF_ExpIntFunc::CPDF_ExpIntFunc() {
m_pBeginValues = NULL;
m_pEndValues = NULL;
@@ -708,17 +722,22 @@ FX_BOOL CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
}
return TRUE;
}
+
class CPDF_StitchFunc : public CPDF_Function {
public:
CPDF_StitchFunc();
- virtual ~CPDF_StitchFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ ~CPDF_StitchFunc() override;
+
+ // CPDF_Function
+ FX_BOOL v_Init(CPDF_Object* pObj) override;
+ FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+
int m_nSubs;
CPDF_Function** m_pSubFunctions;
FX_FLOAT* m_pBounds;
FX_FLOAT* m_pEncode;
};
+
CPDF_StitchFunc::CPDF_StitchFunc() {
m_nSubs = 0;
m_pSubFunctions = NULL;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 21b2fbae8a..74eabe1396 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2815,7 +2815,7 @@ void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size) {
class CPDF_DataAvail final : public IPDF_DataAvail {
public:
CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead);
- ~CPDF_DataAvail();
+ ~CPDF_DataAvail() override;
virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) override;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 987ffd88d4..222f58c088 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -139,6 +139,10 @@ CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc,
pDest->LoadSrc(pSrc, bAutoDropSrc);
return pDest;
}
+
+CPDF_DIBTransferFunc::~CPDF_DIBTransferFunc() {
+}
+
FXDIB_Format CPDF_DIBTransferFunc::GetDestFormat() {
if (m_pSrc->IsAlphaMask()) {
return FXDIB_8bppMask;
diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h
index d6b314d853..733e24cbcf 100644
--- a/core/src/fpdfapi/fpdf_render/render_int.h
+++ b/core/src/fpdfapi/fpdf_render/render_int.h
@@ -87,7 +87,9 @@ struct _PDF_RenderItem {
CPDF_PageObjects* m_pObjectList;
CFX_AffineMatrix m_Matrix;
};
+
typedef CFX_ArrayTemplate<_PDF_RenderItem> CPDF_RenderLayer;
+
class IPDF_ObjectRenderer {
public:
static IPDF_ObjectRenderer* Create(int type);
@@ -100,6 +102,7 @@ class IPDF_ObjectRenderer {
virtual FX_BOOL Continue(IFX_Pause* pPause) = 0;
FX_BOOL m_Result;
};
+
class CPDF_RenderStatus {
public:
CPDF_RenderStatus();
@@ -319,15 +322,20 @@ class CPDF_ProgressiveImageLoaderHandle {
int32_t m_nDownsampleHeight;
};
class CFX_ImageTransformer;
+
class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
public:
CPDF_ImageRenderer();
- ~CPDF_ImageRenderer();
+ ~CPDF_ImageRenderer() override;
+
+ // IPDF_ObjectRenderer
FX_BOOL Start(CPDF_RenderStatus* pStatus,
const CPDF_PageObject* pObj,
const CFX_AffineMatrix* pObj2Device,
FX_BOOL bStdCS,
- int blendType = FXDIB_BLEND_NORMAL);
+ int blendType = FXDIB_BLEND_NORMAL) override;
+ FX_BOOL Continue(IFX_Pause* pPause) override;
+
FX_BOOL Start(CPDF_RenderStatus* pStatus,
const CFX_DIBSource* pDIBSource,
FX_ARGB bitmap_argb,
@@ -336,7 +344,6 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
FX_DWORD flags,
FX_BOOL bStdCS,
int blendType = FXDIB_BLEND_NORMAL);
- FX_BOOL Continue(IFX_Pause* pPause);
protected:
CPDF_RenderStatus* m_pRenderStatus;
@@ -365,6 +372,7 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
FX_BOOL DrawMaskedImage();
FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device);
};
+
class CPDF_ScaledRenderBuffer {
public:
CPDF_ScaledRenderBuffer();
@@ -483,10 +491,12 @@ typedef struct {
int m_ColorKeyMin;
int m_ColorKeyMax;
} DIB_COMP_DATA;
+
class CPDF_DIBSource : public CFX_DIBSource {
public:
CPDF_DIBSource();
- virtual ~CPDF_DIBSource();
+ ~CPDF_DIBSource() override;
+
FX_BOOL Load(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
CPDF_DIBSource** ppMask,
@@ -496,17 +506,20 @@ class CPDF_DIBSource : public CFX_DIBSource {
FX_BOOL bStdCS = FALSE,
FX_DWORD GroupFamily = 0,
FX_BOOL bLoadMask = FALSE);
- virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const;
- virtual uint8_t* GetBuffer() const;
- virtual const uint8_t* GetScanline(int line) const;
- virtual void DownSampleScanline(int line,
- uint8_t* dest_scan,
- int dest_bpp,
- int dest_width,
- FX_BOOL bFlipX,
- int clip_left,
- int clip_width) const;
- virtual void SetDownSampleSize(int dest_width, int dest_height) const;
+
+ // CFX_DIBSource
+ FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const override;
+ uint8_t* GetBuffer() const override;
+ const uint8_t* GetScanline(int line) const override;
+ void DownSampleScanline(int line,
+ uint8_t* dest_scan,
+ int dest_bpp,
+ int dest_width,
+ FX_BOOL bFlipX,
+ int clip_left,
+ int clip_width) const override;
+ void SetDownSampleSize(int dest_width, int dest_height) const override;
+
CFX_DIBitmap* GetBitmap() const;
void ReleaseBitmap(CFX_DIBitmap*) const;
void ClearImageData();
@@ -569,22 +582,28 @@ class CPDF_DIBSource : public CFX_DIBSource {
nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap;
ICodec_ScanlineDecoder* m_pDecoder;
};
+
#define FPDF_HUGE_IMAGE_SIZE 60000000
class CPDF_DIBTransferFunc : public CFX_FilteredDIB {
public:
CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc);
- virtual FXDIB_Format GetDestFormat();
- virtual FX_ARGB* GetDestPalette() { return NULL; }
- virtual void TranslateScanline(uint8_t* dest_buf,
- const uint8_t* src_buf) const;
- virtual void TranslateDownSamples(uint8_t* dest_buf,
- const uint8_t* src_buf,
- int pixels,
- int Bpp) const;
+ ~CPDF_DIBTransferFunc() override;
+
+ // CFX_FilteredDIB
+ FXDIB_Format GetDestFormat() override;
+ FX_ARGB* GetDestPalette() override { return NULL; }
+ void TranslateScanline(uint8_t* dest_buf,
+ const uint8_t* src_buf) const override;
+ void TranslateDownSamples(uint8_t* dest_buf,
+ const uint8_t* src_buf,
+ int pixels,
+ int Bpp) const override;
+
const uint8_t* m_RampR;
const uint8_t* m_RampG;
const uint8_t* m_RampB;
};
+
struct _CPDF_UniqueKeyGen {
void Generate(int count, ...);
FX_CHAR m_Key[128];