summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-25 21:39:46 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-25 21:39:46 -0700
commit25fa42f398d1f8007aa36531e0436dc769817ad3 (patch)
treeb2c8d396fe70c324774ed5dce5f9c9fe204f9534
parent818e1900a3811e1bde1e594e4966db612f845966 (diff)
downloadpdfium-25fa42f398d1f8007aa36531e0436dc769817ad3.tar.xz
Clean up fx_ge.h and IWYU.
Review-Url: https://codereview.chromium.org/2009253003
-rw-r--r--core/fxge/include/fx_ge.h120
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp1
-rw-r--r--fpdfsdk/formfiller/cffl_iformfiller.cpp77
-rw-r--r--fpdfsdk/fpdf_progressive.cpp1
-rw-r--r--fpdfsdk/fpdf_sysfontinfo.cpp2
-rw-r--r--fpdfsdk/fpdfformfill.cpp1
-rw-r--r--fpdfsdk/fpdfview.cpp5
-rw-r--r--fpdfsdk/fsdk_baseform.cpp1
-rw-r--r--fpdfsdk/fsdk_rendercontext.cpp1
-rw-r--r--fpdfsdk/include/fsdk_define.h35
-rw-r--r--xfa/fde/fde_gedevice.h1
-rw-r--r--xfa/fde/fde_visualset.h1
-rw-r--r--xfa/fde/ifde_txtedtpage.h1
-rw-r--r--xfa/fde/tto/fde_textout.h1
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp50
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h155
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h3
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.cpp1
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.h2
19 files changed, 209 insertions, 250 deletions
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index 5e9e841587..8f6b10debc 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -10,26 +10,23 @@
#include "core/fxge/include/fx_dib.h"
#include "core/fxge/include/fx_font.h"
+class CCodec_ModuleMgr;
+class CFX_FaceCache;
class CFX_Font;
-class CFX_FontMgr;
class CFX_FontCache;
-class CFX_FaceCache;
+class CFX_FontMgr;
class CPDF_ShadingPattern;
+class CPSFont;
class IFX_RenderDeviceDriver;
-class CCodec_ModuleMgr;
class SkPictureRecorder;
class CFX_GEModule {
public:
static void Create(const char** pUserFontPaths);
-
static void Use(CFX_GEModule* pMgr);
-
static CFX_GEModule* Get();
-
static void Destroy();
- public:
CFX_FontCache* GetFontCache();
CFX_FontMgr* GetFontMgr() { return m_pFontMgr; }
void SetTextGamma(FX_FLOAT gammaValue);
@@ -44,8 +41,8 @@ class CFX_GEModule {
protected:
explicit CFX_GEModule(const char** pUserFontPaths);
-
~CFX_GEModule();
+
void InitPlatform();
void DestroyPlatform();
@@ -57,13 +54,13 @@ class CFX_GEModule {
void* m_pPlatformData;
const char** m_pUserFontPaths;
};
-typedef struct {
- FX_FLOAT m_PointX;
+struct FX_PATHPOINT {
+ FX_FLOAT m_PointX;
FX_FLOAT m_PointY;
-
int m_Flag;
-} FX_PATHPOINT;
+};
+
#define FXPT_CLOSEFIGURE 0x01
#define FXPT_LINETO 0x02
#define FXPT_BEZIERTO 0x04
@@ -71,95 +68,67 @@ typedef struct {
#define FXPT_TYPE 0x06
#define FXFILL_ALTERNATE 1
#define FXFILL_WINDING 2
+
class CFX_ClipRgn {
public:
CFX_ClipRgn(int device_width, int device_height);
-
- CFX_ClipRgn(const FX_RECT& rect);
-
+ explicit CFX_ClipRgn(const FX_RECT& rect);
CFX_ClipRgn(const CFX_ClipRgn& src);
-
~CFX_ClipRgn();
- typedef enum { RectI, MaskF } ClipType;
-
+ enum ClipType { RectI, MaskF };
void Reset(const FX_RECT& rect);
-
ClipType GetType() const { return m_Type; }
-
const FX_RECT& GetBox() const { return m_Box; }
-
CFX_DIBitmapRef GetMask() const { return m_Mask; }
-
void IntersectRect(const FX_RECT& rect);
-
void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask);
protected:
- ClipType m_Type;
+ void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask);
+ ClipType m_Type;
FX_RECT m_Box;
-
CFX_DIBitmapRef m_Mask;
-
- void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask);
};
class CFX_PathData {
public:
CFX_PathData();
-
CFX_PathData(const CFX_PathData& src);
-
~CFX_PathData();
int GetPointCount() const { return m_PointCount; }
-
int GetFlag(int index) const { return m_pPoints[index].m_Flag; }
-
FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; }
-
FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; }
-
FX_PATHPOINT* GetPoints() const { return m_pPoints; }
-
void SetPointCount(int nPoints);
void AllocPointCount(int nPoints);
void AddPointCount(int addPoints);
-
CFX_FloatRect GetBoundingBox() const;
-
CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
-
void Transform(const CFX_Matrix* pMatrix);
-
FX_BOOL IsRect() const;
-
FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath,
CFX_Matrix* pMatrix,
FX_BOOL& bThin,
FX_BOOL bAdjust) const;
-
FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const;
-
void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix);
void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top);
-
void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag);
-
void TrimPoints(int nPoints);
-
void Copy(const CFX_PathData& src);
protected:
friend class CPDF_Path;
int m_PointCount;
-
FX_PATHPOINT* m_pPoints;
-
int m_AllocCount;
};
+
class CFX_GraphStateData {
public:
CFX_GraphStateData();
@@ -169,21 +138,22 @@ class CFX_GraphStateData {
void Copy(const CFX_GraphStateData& src);
void SetDashCount(int count);
- typedef enum { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 } LineCap;
+ enum LineCap { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 };
LineCap m_LineCap;
int m_DashCount;
FX_FLOAT* m_DashArray;
FX_FLOAT m_DashPhase;
- typedef enum {
+ enum LineJoin {
LineJoinMiter = 0,
LineJoinRound = 1,
LineJoinBevel = 2,
- } LineJoin;
+ };
LineJoin m_LineJoin;
FX_FLOAT m_MiterLimit;
FX_FLOAT m_LineWidth;
};
+
#define FXDC_DEVICE_CLASS 1
#define FXDC_PIXEL_WIDTH 2
#define FXDC_PIXEL_HEIGHT 3
@@ -224,7 +194,8 @@ class CFX_GraphStateData {
#define FXTEXT_NO_NATIVETEXT 0x08
#define FXTEXT_PRINTIMAGETEXT 0x10
#define FXTEXT_NOSMOOTH 0x20
-typedef struct {
+
+struct FXTEXT_CHARPOS {
uint32_t m_GlyphIndex;
FX_FLOAT m_OriginX, m_OriginY;
int m_FontCharWidth;
@@ -232,7 +203,7 @@ typedef struct {
FX_FLOAT m_AdjustMatrix[4];
uint32_t m_ExtGID;
FX_BOOL m_bFontStyle;
-} FXTEXT_CHARPOS;
+};
class CFX_RenderDevice {
public:
@@ -591,11 +562,9 @@ class IFX_PSOutput {
virtual ~IFX_PSOutput() {}
};
-class CPSFont;
class CFX_PSRenderer {
public:
CFX_PSRenderer();
-
~CFX_PSRenderer();
void Init(IFX_PSOutput* pOutput,
@@ -605,21 +574,15 @@ class CFX_PSRenderer {
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,
@@ -628,14 +591,12 @@ class CFX_PSRenderer {
int fill_mode,
int alpha_flag = 0,
void* pIccTransform = NULL);
-
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
int dest_top,
int alpha_flag = 0,
void* pIccTransform = NULL);
-
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -645,14 +606,12 @@ class CFX_PSRenderer {
uint32_t flags,
int alpha_flag = 0,
void* pIccTransform = NULL);
-
FX_BOOL DrawDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
int alpha_flag = 0,
void* pIccTransform = NULL);
-
FX_BOOL DrawText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
@@ -664,41 +623,28 @@ class CFX_PSRenderer {
void* pIccTransform = NULL);
private:
- IFX_PSOutput* m_pOutput;
+ void OutputPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device);
+ void SetGraphState(const CFX_GraphStateData* pGraphState);
+ void SetColor(uint32_t 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);
+ IFX_PSOutput* m_pOutput;
int m_PSLevel;
-
CFX_GraphStateData m_CurGraphState;
-
FX_BOOL m_bGraphStateSet;
-
FX_BOOL m_bCmykOutput;
-
FX_BOOL m_bColorSet;
-
uint32_t 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(uint32_t 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_FXGE_INCLUDE_FX_GE_H_
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index c5f53341e1..c0fd140c9b 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -6,6 +6,7 @@
#include "fpdfsdk/cfx_systemhandler.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/formfiller/cffl_formfiller.h"
#include "fpdfsdk/include/fsdk_mgr.h"
diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp
index 75e57512df..06f24182ce 100644
--- a/fpdfsdk/formfiller/cffl_iformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp
@@ -8,6 +8,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/formfiller/cffl_checkbox.h"
#include "fpdfsdk/formfiller/cffl_combobox.h"
#include "fpdfsdk/formfiller/cffl_formfiller.h"
@@ -33,9 +34,7 @@ FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_FloatPoint point) {
CFX_FloatRect rc = pAnnot->GetRect();
- if (rc.Contains(point.x, point.y))
- return TRUE;
- return FALSE;
+ return rc.Contains(point.x, point.y);
}
FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
@@ -61,46 +60,48 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
ASSERT(pPageView);
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (IsVisible(pWidget)) {
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
- if (pFormFiller->IsValid()) {
- pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
- pAnnot->GetPDFPage();
-
- CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
- if (pDocument->GetFocusAnnot() == pAnnot) {
- CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView);
- if (!rcFocus.IsEmpty()) {
- CFX_PathData path;
- path.SetPointCount(5);
- path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO);
- path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO);
- path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO);
- path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO);
- path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO);
-
- CFX_GraphStateData gsd;
- gsd.SetDashCount(1);
- gsd.m_DashArray[0] = 1.0f;
- gsd.m_DashPhase = 0;
- gsd.m_LineWidth = 1.0f;
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
- ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE);
- }
+ if (!IsVisible(pWidget))
+ return;
+
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ if (pFormFiller->IsValid()) {
+ pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
+ pAnnot->GetPDFPage();
+
+ CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
+ if (pDocument->GetFocusAnnot() == pAnnot) {
+ CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView);
+ if (!rcFocus.IsEmpty()) {
+ CFX_PathData path;
+ path.SetPointCount(5);
+ path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO);
+ path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO);
+ path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO);
+ path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO);
+ path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO);
+
+ CFX_GraphStateData gsd;
+ gsd.SetDashCount(1);
+ gsd.m_DashArray[0] = 1.0f;
+ gsd.m_DashPhase = 0;
+ gsd.m_LineWidth = 1.0f;
+ pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
+ ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE);
}
- return;
}
+ return;
}
+ }
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device,
- dwFlags);
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
-
- if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
- pWidget->DrawShadow(pDevice, pPageView);
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device,
+ dwFlags);
+ } else {
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
}
+
+ if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
+ pWidget->DrawShadow(pDevice, pPageView);
}
void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {
diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp
index 90e8402bf8..411ae17af4 100644
--- a/fpdfsdk/fpdf_progressive.cpp
+++ b/fpdfsdk/fpdf_progressive.cpp
@@ -8,6 +8,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_rendercontext.h"
#include "public/fpdfview.h"
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index d5ee7d186f..18b01341ee 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -6,6 +6,8 @@
#include "public/fpdf_sysfontinfo.h"
+#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 81c5dd7a12..b1c729b8dc 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -12,6 +12,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "public/fpdfview.h"
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index f483f7e4d5..0040c090f4 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -15,6 +15,7 @@
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fxcodec/include/fx_codec.h"
#include "core/fxcrt/include/fx_safe_types.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "fpdfsdk/include/fsdk_rendercontext.h"
@@ -31,6 +32,10 @@
#include "public/fpdf_formfill.h"
#endif // PDF_ENABLE_XFA
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+#include "core/fxge/include/fx_ge_win32.h"
+#endif
+
UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc) {
return static_cast<UnderlyingDocumentType*>(doc);
}
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 6461221552..ea21511b8e 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
+#include "core/fxge/include/fx_ge.h"
#include "fpdfsdk/formfiller/cffl_formfiller.h"
#include "fpdfsdk/include/fsdk_actionhandler.h"
#include "fpdfsdk/include/fsdk_baseannot.h"
diff --git a/fpdfsdk/fsdk_rendercontext.cpp b/fpdfsdk/fsdk_rendercontext.cpp
index 9232d83edd..eb630dd60f 100644
--- a/fpdfsdk/fsdk_rendercontext.cpp
+++ b/fpdfsdk/fsdk_rendercontext.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/include/fsdk_rendercontext.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
+#include "core/fxge/include/fx_ge.h"
void CRenderContext::Clear() {
m_pDevice = NULL;
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index 536e35886f..a8a02d665e 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -9,8 +9,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h"
#include "core/fpdfdoc/include/fpdf_doc.h"
-#include "core/fxge/include/fx_ge.h"
-#include "core/fxge/include/fx_ge_win32.h"
#include "public/fpdfview.h"
#ifdef PDF_ENABLE_XFA
@@ -63,22 +61,23 @@ class CPDF_CustomAccess final : public IFX_FileRead {
#ifdef PDF_ENABLE_XFA
class CFPDF_FileStream : public IFX_FileStream {
public:
- CFPDF_FileStream(FPDF_FILEHANDLER* pFS);
- virtual ~CFPDF_FileStream() {}
-
- virtual IFX_FileStream* Retain();
- virtual void Release();
-
- virtual FX_FILESIZE GetSize();
- virtual FX_BOOL IsEOF();
- virtual FX_FILESIZE GetPosition() { return m_nCurPos; }
- virtual void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; }
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
- virtual size_t ReadBlock(void* buffer, size_t size);
- virtual FX_BOOL WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size);
- virtual FX_BOOL Flush();
+ explicit CFPDF_FileStream(FPDF_FILEHANDLER* pFS);
+ ~CFPDF_FileStream() override {}
+
+ // IFX_FileStream:
+ IFX_FileStream* Retain() override;
+ void Release() override;
+ FX_FILESIZE GetSize() override;
+ FX_BOOL IsEOF() override;
+ FX_FILESIZE GetPosition() override { return m_nCurPos; }
+ FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
+ size_t ReadBlock(void* buffer, size_t size) override;
+ FX_BOOL WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) override;
+ FX_BOOL Flush() override;
+
+ void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; }
protected:
FPDF_FILEHANDLER* m_pFS;
diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h
index f69e4d106c..fb0d8c117a 100644
--- a/xfa/fde/fde_gedevice.h
+++ b/xfa/fde/fde_gedevice.h
@@ -15,7 +15,6 @@ typedef struct FDE_HDEVICESTATE_ { void* pData; } * FDE_HDEVICESTATE;
class CFDE_Brush;
class CFDE_Path;
class CFDE_Pen;
-class CFX_RenderDevice;
class IFX_Font;
class CFDE_RenderDevice : public CFX_Target {
diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h
index 64f98b9b23..c6b7f92584 100644
--- a/xfa/fde/fde_visualset.h
+++ b/xfa/fde/fde_visualset.h
@@ -10,7 +10,6 @@
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_system.h"
#include "core/fxge/include/fx_dib.h"
-#include "core/fxge/include/fx_ge.h"
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/fde_object.h"
#include "xfa/fgas/crt/fgas_memory.h"
diff --git a/xfa/fde/ifde_txtedtpage.h b/xfa/fde/ifde_txtedtpage.h
index 9db2da77d1..3132727c5b 100644
--- a/xfa/fde/ifde_txtedtpage.h
+++ b/xfa/fde/ifde_txtedtpage.h
@@ -7,7 +7,6 @@
#ifndef XFA_FDE_IFDE_TXTEDTPAGE_H_
#define XFA_FDE_IFDE_TXTEDTPAGE_H_
-#include "core/fxge/include/fx_ge.h"
#include "xfa/fde/fde_visualset.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h
index 91f03e8d9b..2b00fee88d 100644
--- a/xfa/fde/tto/fde_textout.h
+++ b/xfa/fde/tto/fde_textout.h
@@ -10,7 +10,6 @@
#include <memory>
#include "core/fxge/include/fx_dib.h"
-#include "core/fxge/include/fx_ge.h"
#include "xfa/fde/fde_object.h"
#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/font/fgas_font.h"
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index e840cb2bdd..3506aa2df9 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -7,6 +7,7 @@
#include "xfa/fgas/font/fgas_stdfontmgr.h"
#include "core/fxcrt/include/fx_stream.h"
+#include "core/fxge/include/fx_ge.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/fgas_fontutils.h"
@@ -24,7 +25,7 @@ CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator)
m_FileFonts(4),
m_StreamFonts(4),
m_DeriveFonts(4) {
- if (m_pEnumerator != NULL) {
+ if (m_pEnumerator) {
m_pEnumerator(m_FontFaces, NULL, 0xFEFF);
}
}
@@ -58,7 +59,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage(
return NULL;
}
}
- ASSERT(pFD != NULL);
+ ASSERT(pFD);
pFont = IFX_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
if (pFont) {
m_Fonts.Add(pFont);
@@ -139,7 +140,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily,
return NULL;
}
}
- ASSERT(pFD != NULL);
+ ASSERT(pFD);
if (wCodePage == 0xFFFF) {
wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet);
}
@@ -154,10 +155,10 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily,
return NULL;
}
IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) {
- ASSERT(pBuffer != NULL && iLength > 0);
+ ASSERT(pBuffer && iLength > 0);
IFX_Font* pFont = NULL;
if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) {
- if (pFont != NULL) {
+ if (pFont) {
return pFont->Retain();
}
}
@@ -170,11 +171,11 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) {
return NULL;
}
IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) {
- ASSERT(pszFileName != NULL);
+ ASSERT(pszFileName);
uint32_t dwHash = FX_HashCode_GetW(pszFileName, false);
IFX_Font* pFont = NULL;
if (m_FileFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
- if (pFont != NULL) {
+ if (pFont) {
return pFont->Retain();
}
}
@@ -191,11 +192,11 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
uint32_t dwFontStyles,
uint16_t wCodePage,
FX_BOOL bSaveStream) {
- ASSERT(pFontStream != NULL && pFontStream->GetLength() > 0);
+ ASSERT(pFontStream && pFontStream->GetLength() > 0);
IFX_Font* pFont = NULL;
if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) {
- if (pFont != NULL) {
- if (pszFontAlias != NULL) {
+ if (pFont) {
+ if (pszFontAlias) {
uint32_t dwHash =
FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage);
m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
@@ -207,7 +208,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
if (pFont) {
m_Fonts.Add(pFont);
m_StreamFonts.SetAt((void*)pFontStream, (void*)pFont);
- if (pszFontAlias != NULL) {
+ if (pszFontAlias) {
uint32_t dwHash =
FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage);
m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
@@ -219,7 +220,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont,
uint32_t dwFontStyles,
uint16_t wCodePage) {
- ASSERT(pSrcFont != NULL);
+ ASSERT(pSrcFont);
if (pSrcFont->GetFontStyles() == dwFontStyles) {
return pSrcFont->Retain();
}
@@ -230,7 +231,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont,
IFX_Font* pFont = NULL;
if (m_DeriveFonts.GetCount() > 0) {
m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont);
- if (pFont != NULL) {
+ if (pFont) {
return pFont->Retain();
}
}
@@ -256,7 +257,7 @@ void CFX_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont) {
FX_POSITION pos = fontMap.GetStartPosition();
void* pKey;
void* pFind;
- while (pos != NULL) {
+ while (pos) {
pFind = NULL;
fontMap.GetNextAssoc(pos, pKey, pFind);
if (pFind != (void*)pFont) {
@@ -355,13 +356,11 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams,
}
}
if (bMatchStyle) {
- if ((pFont->dwFontStyles & 0x0F) == (pParams->dwFontStyles & 0x0F)) {
+ if ((pFont->dwFontStyles & 0x0F) == (pParams->dwFontStyles & 0x0F))
return pFont;
- } else {
- continue;
- }
+ continue;
}
- if (pParams->pwsFamily != NULL) {
+ if (pParams->pwsFamily) {
if (FXSYS_wcsicmp(pParams->pwsFamily, pFont->wsFontFace) == 0) {
return pFont;
}
@@ -552,16 +551,17 @@ IFX_FontMgr* IFX_FontMgr::Create(CFX_FontSourceEnum_File* pFontEnum) {
if (!pFontEnum)
return nullptr;
- CFX_FontMgrImp* pFontMgr = new CFX_FontMgrImp(pFontEnum);
- if (pFontMgr->EnumFonts())
- return pFontMgr;
-
- delete pFontMgr;
- return nullptr;
+ std::unique_ptr<CFX_FontMgrImp> pFontMgr(new CFX_FontMgrImp(pFontEnum));
+ if (!pFontMgr->EnumFonts())
+ return nullptr;
+ return pFontMgr.release();
}
+
CFX_FontMgrImp::CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum)
: m_pFontSource(pFontEnum) {}
+CFX_FontMgrImp::~CFX_FontMgrImp() {}
+
FX_BOOL CFX_FontMgrImp::EnumFontsFromFontMapper() {
CFX_FontMapper* pFontMapper =
CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper();
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index bbfa875e5e..a455ee2596 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -9,7 +9,6 @@
#include "core/fxcrt/include/fx_ext.h"
#include "core/fxge/include/fx_freetype.h"
-#include "core/fxge/include/fx_ge.h"
#include "third_party/freetype/include/freetype/fttypes.h"
#include "xfa/fgas/font/fgas_font.h"
@@ -21,36 +20,39 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams,
class CFX_StdFontMgrImp : public IFX_FontMgr {
public:
- CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator);
- ~CFX_StdFontMgrImp();
- virtual void Release() { delete this; }
- virtual IFX_Font* GetDefFontByCodePage(uint16_t wCodePage,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetDefFontByLanguage(uint16_t wLanguage,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF);
- virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength);
- virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName);
- virtual IFX_Font* LoadFont(IFX_Stream* pFontStream,
- const FX_WCHAR* pszFontAlias = NULL,
- uint32_t dwFontStyles = 0,
- uint16_t wCodePage = 0,
- FX_BOOL bSaveStream = FALSE);
- virtual IFX_Font* LoadFont(IFX_Font* pSrcFont,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF);
- virtual void ClearFontCache();
- virtual void RemoveFont(IFX_Font* pFont);
+ explicit CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator);
+ ~CFX_StdFontMgrImp() override;
+
+ // IFX_FontMgr:
+ void Release() override { delete this; }
+ IFX_Font* GetDefFontByCodePage(uint16_t wCodePage,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetDefFontByCharset(uint8_t nCharset,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetDefFontByLanguage(uint16_t wLanguage,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF) override;
+ IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) override;
+ IFX_Font* LoadFont(const FX_WCHAR* pszFileName) override;
+ IFX_Font* LoadFont(IFX_Stream* pFontStream,
+ const FX_WCHAR* pszFontAlias = NULL,
+ uint32_t dwFontStyles = 0,
+ uint16_t wCodePage = 0,
+ FX_BOOL bSaveStream = FALSE) override;
+ IFX_Font* LoadFont(IFX_Font* pSrcFont,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF) override;
+
+ void ClearFontCache();
+ void RemoveFont(IFX_Font* pFont);
protected:
void RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont);
@@ -144,49 +146,52 @@ class CFX_FontSourceEnum_File {
class CFX_FontMgrImp : public IFX_FontMgr {
public:
- CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum);
-
- virtual void Release();
- virtual IFX_Font* GetDefFontByCodePage(uint16_t wCodePage,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetDefFontByLanguage(uint16_t wLanguage,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetFontByCodePage(uint16_t wCodePage,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetFontByCharset(uint8_t nCharset,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* GetFontByLanguage(uint16_t wLanguage,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL);
- virtual IFX_Font* LoadFont(const uint8_t* pBuffer,
- int32_t iLength,
- int32_t iFaceIndex,
- int32_t* pFaceCount);
- virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName,
- int32_t iFaceIndex,
- int32_t* pFaceCount);
- virtual IFX_Font* LoadFont(IFX_Stream* pFontStream,
- int32_t iFaceIndex,
- int32_t* pFaceCount,
- FX_BOOL bSaveStream = FALSE);
- virtual IFX_Font* LoadFont(const CFX_WideString& wsFaceName,
- int32_t iFaceIndex,
- int32_t* pFaceCount);
- virtual void ClearFontCache();
- virtual void RemoveFont(IFX_Font* pFont);
+ explicit CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum);
+ ~CFX_FontMgrImp() override;
+
+ // IFX_FontMgr:
+ void Release() override;
+ IFX_Font* GetDefFontByCodePage(uint16_t wCodePage,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetDefFontByCharset(uint8_t nCharset,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetDefFontByLanguage(uint16_t wLanguage,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetFontByCodePage(uint16_t wCodePage,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetFontByCharset(uint8_t nCharset,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* GetFontByLanguage(uint16_t wLanguage,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = NULL) override;
+ IFX_Font* LoadFont(const uint8_t* pBuffer,
+ int32_t iLength,
+ int32_t iFaceIndex,
+ int32_t* pFaceCount) override;
+ IFX_Font* LoadFont(const FX_WCHAR* pszFileName,
+ int32_t iFaceIndex,
+ int32_t* pFaceCount) override;
+ IFX_Font* LoadFont(IFX_Stream* pFontStream,
+ int32_t iFaceIndex,
+ int32_t* pFaceCount,
+ FX_BOOL bSaveStream = FALSE) override;
+ void ClearFontCache() override;
+ void RemoveFont(IFX_Font* pFont) override;
+
+ IFX_Font* LoadFont(const CFX_WideString& wsFaceName,
+ int32_t iFaceIndex,
+ int32_t* pFaceCount);
FX_BOOL EnumFonts();
FX_BOOL EnumFontsFromFontMapper();
FX_BOOL EnumFontsFromFiles();
@@ -232,7 +237,7 @@ class CFX_FontMgrImp : public IFX_FontMgr {
CFX_MapPtrTemplate<uint32_t, IFX_Font*> m_FileAccess2IFXFont;
CFX_MapPtrTemplate<IFX_Font*, IFX_FileRead*> m_IFXFont2FileRead;
CFX_MapPtrTemplate<FX_WCHAR, IFX_Font*> m_FailedUnicodes2NULL;
- CFX_FontSourceEnum_File* m_pFontSource;
+ CFX_FontSourceEnum_File* const m_pFontSource;
};
#endif
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index c090a0dd5d..2979acb951 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -9,7 +9,6 @@
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_ucd.h"
-#include "core/fxge/include/fx_ge.h"
#include "xfa/fgas/crt/fgas_memory.h"
#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
@@ -244,7 +243,7 @@ class CFX_RTFLine {
class CFX_RTFBreak {
public:
- CFX_RTFBreak(uint32_t dwPolicies);
+ explicit CFX_RTFBreak(uint32_t dwPolicies);
~CFX_RTFBreak();
void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd);
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp
index a844bf1c42..efab589ddc 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "core/fxge/include/fx_ge.h"
#include "third_party/base/numerics/safe_math.h"
#include "xfa/fxbarcode/BC_TwoDimWriter.h"
#include "xfa/fxbarcode/BC_Writer.h"
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.h b/xfa/fxbarcode/BC_TwoDimWriter.h
index ba94c3269f..625680413d 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.h
+++ b/xfa/fxbarcode/BC_TwoDimWriter.h
@@ -7,10 +7,10 @@
#ifndef XFA_FXBARCODE_BC_TWODIMWRITER_H_
#define XFA_FXBARCODE_BC_TWODIMWRITER_H_
-#include "core/fxge/include/fx_ge.h"
#include "xfa/fxbarcode/BC_Writer.h"
class CBC_CommonBitMatrix;
+class CFX_RenderDevice;
class CBC_TwoDimWriter : public CBC_Writer {
public: