diff options
Diffstat (limited to 'core/src/fxge')
-rw-r--r-- | core/src/fxge/agg/include/fx_agg_driver.h | 189 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiafont.h | 49 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiafontmgr.h | 49 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiamodule.h | 14 | ||||
-rw-r--r-- | core/src/fxge/apple/apple_int.h | 198 | ||||
-rw-r--r-- | core/src/fxge/skia/fx_skia_device.h | 2 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_device.cpp | 38 | ||||
-rw-r--r-- | core/src/fxge/win32/win32_int.h | 205 |
8 files changed, 393 insertions, 351 deletions
diff --git a/core/src/fxge/agg/include/fx_agg_driver.h b/core/src/fxge/agg/include/fx_agg_driver.h index 2954526cd5..c3de76d369 100644 --- a/core/src/fxge/agg/include/fx_agg_driver.h +++ b/core/src/fxge/agg/include/fx_agg_driver.h @@ -26,119 +26,110 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); - virtual ~CFX_AggDeviceDriver(); + ~CFX_AggDeviceDriver() override; + void InitPlatform(); void DestroyPlatform(); - virtual int GetDeviceCaps(int caps_id); - - virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); - - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - int fill_mode); - - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState); - - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + // IFX_RenderDeviceDriver + int GetDeviceCaps(int caps_id) override; + void SaveState() override; + void RestoreState(FX_BOOL bKeepSaved) override; + FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, - int fill_mode, - int alpha_flag, - void* pIccTransform, - int blend_type); - - virtual FX_BOOL SetPixel(int x, - int y, + int fill_mode) override; + FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState) override; + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + FX_DWORD fill_color, + FX_DWORD stroke_color, + int fill_mode, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL SetPixel(int x, + int y, + FX_DWORD color, + int alpha_flag, + void* pIccTransform) override; + FX_BOOL FillRect(const FX_RECT* pRect, + FX_DWORD fill_color, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, FX_DWORD color, int alpha_flag, - void* pIccTransform); - - virtual FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, - int alpha_flag, void* pIccTransform, - int blend_type); - - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_DWORD color, - int alpha_flag, - void* pIccTransform, - int blend_type) { + int blend_type) override { return FALSE; } - - virtual FX_BOOL GetClipBox(FX_RECT* pRect); - - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top, - void* pIccTransform = NULL, - FX_BOOL bDEdge = FALSE); - virtual CFX_DIBitmap* GetBackDrop() { return m_pOriDevice; } - - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type, - int alpha_flag, - void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - FX_DWORD flags, - int alpha_flag, - void* pIccTransform, - int blend_type); - - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - FX_DWORD color, - const CFX_AffineMatrix* pMatrix, - FX_DWORD flags, - void*& handle, - int alpha_flag, - void* pIccTransform, - int blend_type); - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); - virtual void CancelDIBits(void* handle); - - virtual FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_AffineMatrix* pObject2Device, - FX_FLOAT font_size, - FX_DWORD color, - int alpha_flag, - void* pIccTransform); - virtual FX_BOOL RenderRasterizer( - FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & rasterizer, - FX_DWORD color, - FX_BOOL bFullCover, - FX_BOOL bGroupKnockout, - int alpha_flag, - void* pIccTransform); + FX_BOOL GetClipBox(FX_RECT* pRect) override; + FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, + int left, + int top, + void* pIccTransform = NULL, + FX_BOOL bDEdge = FALSE) override; + CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; } + FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type, + int alpha_flag, + void* pIccTransform) override; + FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + FX_DWORD flags, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + FX_DWORD color, + const CFX_AffineMatrix* pMatrix, + FX_DWORD flags, + void*& handle, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override; + void CancelDIBits(void* handle) override; + FX_BOOL DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + const CFX_AffineMatrix* pObject2Device, + FX_FLOAT font_size, + FX_DWORD color, + int alpha_flag, + void* pIccTransform) override; + int GetDriverType() override { return 1; } + + FX_BOOL RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & + rasterizer, + FX_DWORD color, + FX_BOOL bFullCover, + FX_BOOL bGroupKnockout, + int alpha_flag, + void* pIccTransform); void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & rasterizer); virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } - virtual int GetDriverType() { return 1; } CFX_DIBitmap* m_pBitmap; CFX_ClipRgn* m_pClipRgn; diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index 4a841940df..6ee2f258e4 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -8,38 +8,37 @@ #define CORE_SRC_FXGE_ANDROID_FPF_SKIAFONT_H_ #if _FX_OS_ == _FX_ANDROID_ + +#include "../../../include/fxge/fpf.h" + class CFPF_SkiaFontDescriptor; class CFPF_SkiaFontMgr; class SkTypeface; class CFPF_SkiaFont : public IFPF_Font { public: CFPF_SkiaFont(); - virtual ~CFPF_SkiaFont(); - virtual void Release(); - virtual IFPF_Font* Retain(); - - virtual FPF_HFONT GetHandle(); - - virtual CFX_ByteString GetFamilyName(); - virtual CFX_WideString GetPsName(); - - virtual FX_DWORD GetFontStyle() const { return m_dwStyle; } - virtual uint8_t GetCharset() const { return m_uCharset; } - - virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode); - virtual int32_t GetGlyphWidth(int32_t iGlyphIndex); - - virtual int32_t GetAscent() const; - virtual int32_t GetDescent() const; - - virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox); - virtual FX_BOOL GetBBox(FX_RECT& rtBBox); + ~CFPF_SkiaFont() override; + + // IFPF_Font + void Release() override; + IFPF_Font* Retain() override; + FPF_HFONT GetHandle() override; + CFX_ByteString GetFamilyName() override; + CFX_WideString GetPsName() override; + FX_DWORD GetFontStyle() const override { return m_dwStyle; } + uint8_t GetCharset() const override { return m_uCharset; } + int32_t GetGlyphIndex(FX_WCHAR wUnicode) override; + int32_t GetGlyphWidth(int32_t iGlyphIndex) override; + int32_t GetAscent() const override; + int32_t GetDescent() const override; + FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) override; + FX_BOOL GetBBox(FX_RECT& rtBBox) override; + int32_t GetHeight() const override; + int32_t GetItalicAngle() const override; + FX_DWORD GetFontData(FX_DWORD dwTable, + uint8_t* pBuffer, + FX_DWORD dwSize) override; - virtual int32_t GetHeight() const; - virtual int32_t GetItalicAngle() const; - virtual FX_DWORD GetFontData(FX_DWORD dwTable, - uint8_t* pBuffer, - FX_DWORD dwSize); FX_BOOL InitFont(CFPF_SkiaFontMgr* pFontMgr, CFPF_SkiaFontDescriptor* pFontDes, const CFX_ByteStringC& bsFamily, diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index c5dd8fd1b2..17bcb48ca1 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -8,10 +8,14 @@ #define CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ #if _FX_OS_ == _FX_ANDROID_ + +#include "../../../include/fxge/fpf.h" + #define FPF_SKIAFONTTYPE_Unknown 0 #define FPF_SKIAFONTTYPE_Path 1 #define FPF_SKIAFONTTYPE_File 2 #define FPF_SKIAFONTTYPE_Buffer 3 + class CFPF_SkiaFontDescriptor { public: CFPF_SkiaFontDescriptor() @@ -25,7 +29,9 @@ class CFPF_SkiaFontDescriptor { FX_Free(m_pFamily); } } + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; } + void SetFamily(const FX_CHAR* pFamily) { if (m_pFamily) { FX_Free(m_pFamily); @@ -41,15 +47,19 @@ class CFPF_SkiaFontDescriptor { FX_DWORD m_dwCharsets; int32_t m_iGlyphNum; }; + class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaPathFont() : m_pPath(NULL) {} - virtual ~CFPF_SkiaPathFont() { + ~CFPF_SkiaPathFont() override { if (m_pPath) { FX_Free(m_pPath); } } - virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Path; } + + // CFPF_SkiaFontDescriptor + int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; } + void SetPath(const FX_CHAR* pPath) { if (m_pPath) { FX_Free(m_pPath); @@ -61,33 +71,43 @@ class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { } FX_CHAR* m_pPath; }; + class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaFileFont() : m_pFile(NULL) {} - virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_File; } + + // CFPF_SkiaFontDescriptor + int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; } IFX_FileRead* m_pFile; }; + class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {} - virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Buffer; } + + // CFPF_SkiaFontDescriptor + int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; } + void* m_pBuffer; size_t m_szBuffer; }; + class CFPF_SkiaFontMgr : public IFPF_FontMgr { public: CFPF_SkiaFontMgr(); - virtual ~CFPF_SkiaFontMgr(); + ~CFPF_SkiaFontMgr() override; + + // IFPF_FontMgr + void LoadSystemFonts() override; + void LoadPrivateFont(IFX_FileRead* pFontFile) override; + void LoadPrivateFont(const CFX_ByteStringC& bsFileName) override; + void LoadPrivateFont(void* pBuffer, size_t szBuffer) override; + IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, + uint8_t uCharset, + FX_DWORD dwStyle, + FX_DWORD dwMatch = 0) override; + FX_BOOL InitFTLibrary(); - virtual void LoadSystemFonts(); - virtual void LoadPrivateFont(IFX_FileRead* pFontFile); - virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName); - virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer); - - virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, - uint8_t uCharset, - FX_DWORD dwStyle, - FX_DWORD dwMatch = 0); FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const uint8_t* pBuffer, @@ -104,6 +124,7 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr { FXFT_Library m_FTLibrary; CFX_MapPtrToPtr m_FamilyFonts; }; + #endif #endif // CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ diff --git a/core/src/fxge/android/fpf_skiamodule.h b/core/src/fxge/android/fpf_skiamodule.h index 4f1c1193d8..5d1da7be32 100644 --- a/core/src/fxge/android/fpf_skiamodule.h +++ b/core/src/fxge/android/fpf_skiamodule.h @@ -8,13 +8,19 @@ #define CORE_SRC_FXGE_ANDROID_FPF_SKIAMODULE_H_ #if _FX_OS_ == _FX_ANDROID_ + +#include "../../../include/fxge/fpf.h" + class CFPF_SkiaFontMgr; + class CFPF_SkiaDeviceModule : public IFPF_DeviceModule { public: - CFPF_SkiaDeviceModule() : m_pFontMgr(NULL) {} - virtual ~CFPF_SkiaDeviceModule(); - virtual void Destroy(); - virtual IFPF_FontMgr* GetFontMgr(); + CFPF_SkiaDeviceModule() : m_pFontMgr(nullptr) {} + ~CFPF_SkiaDeviceModule() override; + + // IFPF_DeviceModule + void Destroy() override; + IFPF_FontMgr* GetFontMgr() override; protected: CFPF_SkiaFontMgr* m_pFontMgr; diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h index ba3d0a83e8..9bff4ebcbc 100644 --- a/core/src/fxge/apple/apple_int.h +++ b/core/src/fxge/apple/apple_int.h @@ -8,9 +8,13 @@ #define CORE_SRC_FXGE_APPLE_APPLE_INT_H_ #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ + +#include "../../../include/fxge/fx_ge.h" + #if _FX_OS_ == _FX_MACOSX_ #include <Carbon/Carbon.h> #endif + typedef enum eFXIOSFONTCHARSET { eFXFontCharsetDEFAULT = 0, eFXFontCharsetANSI = 1, @@ -68,105 +72,107 @@ class CApplePlatform { CQuartz2D _quartz2d; }; + class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { public: CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); - virtual ~CFX_QuartzDeviceDriver(); + ~CFX_QuartzDeviceDriver() override; - virtual int GetDeviceCaps(int caps_id); - virtual CFX_Matrix GetCTM() const; - virtual CFX_DIBitmap* GetBackDrop() { return NULL; } - virtual void* GetPlatformSurface() { return NULL; } - virtual FX_BOOL IsPSPrintDriver() { return FALSE; } - virtual FX_BOOL StartRendering() { return TRUE; } - virtual void EndRendering() {} - virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - int fill_mode); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + // IFX_RenderDeviceDriver + int GetDeviceCaps(int caps_id) override; + CFX_Matrix GetCTM() const override; + FX_BOOL IsPSPrintDriver() override { return FALSE; } + FX_BOOL StartRendering() override { return TRUE; } + void EndRendering() override {} + void SaveState() override; + void RestoreState(FX_BOOL bKeepSaved) override; + FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, - int fill_mode, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL SetPixel(int x, - int y, - FX_DWORD color, - int alpha_flag = 0, - void* pIccTransform = NULL) { + int fill_mode) override; + FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState) override; + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + FX_DWORD fill_color, + FX_DWORD stroke_color, + int fill_mode, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; + FX_BOOL SetPixel(int x, + int y, + FX_DWORD color, + int alpha_flag = 0, + void* pIccTransform = NULL) override { return FALSE; } - virtual FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + FX_BOOL FillRect(const FX_RECT* pRect, + FX_DWORD fill_color, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; + FX_BOOL DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_DWORD color, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top, - void* pIccTransform = NULL, - FX_BOOL bDEdge = FALSE); - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - const FX_RECT* pSrcRect, - int dest_left, - int dest_top, - int blend_type, - int alpha_flag = 0, - void* pIccTransform = NULL); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - FX_DWORD flags, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - FX_DWORD color, - const CFX_AffineMatrix* pMatrix, - FX_DWORD flags, - void*& handle, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) { + int blend_type = FXDIB_BLEND_NORMAL) override; + FX_BOOL GetClipBox(FX_RECT* pRect) override; + FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, + int left, + int top, + void* pIccTransform = NULL, + FX_BOOL bDEdge = FALSE) override; + CFX_DIBitmap* GetBackDrop() override { return NULL; } + FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + const FX_RECT* pSrcRect, + int dest_left, + int dest_top, + int blend_type, + int alpha_flag = 0, + void* pIccTransform = NULL) override; + FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + FX_DWORD flags, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override; + FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + FX_DWORD color, + const CFX_AffineMatrix* pMatrix, + FX_DWORD flags, + void*& handle, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) override { return FALSE; } - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { + FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override { return FALSE; } - virtual void CancelDIBits(void* handle) {} - virtual FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_AffineMatrix* pObject2Device, - FX_FLOAT font_size, - FX_DWORD color, - int alpha_flag = 0, - void* pIccTransform = NULL); - virtual void ClearDriver(); + void CancelDIBits(void* handle) override {} + FX_BOOL DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + const CFX_AffineMatrix* pObject2Device, + FX_FLOAT font_size, + FX_DWORD color, + int alpha_flag = 0, + void* pIccTransform = NULL) override; + void* GetPlatformSurface() override { return NULL; } + void ClearDriver() override; protected: void setStrokeInfo(const CFX_GraphStateData* graphState, @@ -206,21 +212,20 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { int32_t _horzSize; int32_t _vertSize; }; + class CFX_FontProvider final : public IFX_FileRead { public: - virtual void Release() override { delete this; } - virtual FX_FILESIZE GetSize() override { return (FX_FILESIZE)_totalSize; } - virtual FX_BOOL ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) override; - - virtual FX_BOOL IsEOF() override { return _offSet == _totalSize; } - virtual FX_FILESIZE GetPosition() override { return (FX_FILESIZE)_offSet; } - virtual size_t ReadBlock(void* buffer, size_t size) override; + // IFX_FileRead + void Release() override { delete this; } + FX_FILESIZE GetSize() override { return (FX_FILESIZE)_totalSize; } + FX_BOOL IsEOF() override { return _offSet == _totalSize; } + FX_FILESIZE GetPosition() override { return (FX_FILESIZE)_offSet; } + FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; + size_t ReadBlock(void* buffer, size_t size) override; public: CFX_FontProvider(CGFontRef cgFont); - ~CFX_FontProvider(); + ~CFX_FontProvider() override; void InitTableOffset(); unsigned long Read(unsigned long offset, unsigned char* buffer, @@ -254,6 +259,7 @@ class CFX_FontProvider final : public IFX_FileRead { int _tableCount; int _totalSize; }; + uint32_t FX_GetHashCode(const FX_CHAR* pStr); FX_DWORD FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); uint32_t FX_IOSGetFamilyNamesCount(); diff --git a/core/src/fxge/skia/fx_skia_device.h b/core/src/fxge/skia/fx_skia_device.h index 1de829b783..a2cfc355b3 100644 --- a/core/src/fxge/skia/fx_skia_device.h +++ b/core/src/fxge/skia/fx_skia_device.h @@ -13,7 +13,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); - virtual ~CFX_SkiaDeviceDriver(); + ~CFX_SkiaDeviceDriver() override; /** Options */ virtual int GetDeviceCaps(int caps_id); diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 295a6e94ca..eca2b0440b 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -21,23 +21,26 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { public: CFX_Win32FontInfo(); - ~CFX_Win32FontInfo(); - virtual void Release(); - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* face, - int& iExact); - virtual void* GetFont(const FX_CHAR* face) { return NULL; } - virtual FX_DWORD GetFontData(void* hFont, - FX_DWORD table, - uint8_t* buffer, - FX_DWORD size); - virtual void DeleteFont(void* hFont); - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); - virtual FX_BOOL GetFontCharset(void* hFont, int& charset); + ~CFX_Win32FontInfo() override; + + // IFX_SystemFontInfo + void Release() override; + FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; + void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* face, + int& iExact) override; + void* GetFont(const FX_CHAR* face) override { return NULL; } + FX_DWORD GetFontData(void* hFont, + FX_DWORD table, + uint8_t* buffer, + FX_DWORD size) override; + FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; + FX_BOOL GetFontCharset(void* hFont, int& charset) override; + void DeleteFont(void* hFont) override; + FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf); FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); void AddInstalledFont(const LOGFONTA* plf, FX_DWORD FontType); @@ -51,6 +54,7 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { CFX_ByteString m_LastFamily; CFX_ByteString m_KaiTi, m_FangSong; }; + CFX_Win32FontInfo::CFX_Win32FontInfo() { m_hDC = CreateCompatibleDC(NULL); } diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index cb3b017ad8..7f73fdbb1a 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -6,6 +6,8 @@ #ifndef CORE_SRC_FXGE_WIN32_WIN32_INT_H_ #define CORE_SRC_FXGE_WIN32_WIN32_INT_H_ +#include "../../../include/fxge/fx_ge.h" + struct WINDIB_Open_Args_; class CGdiplusExt { public: @@ -101,50 +103,54 @@ class CWin32Platform { CGdiplusExt m_GdiplusExt; CDWriteExt m_DWriteExt; }; + class CGdiDeviceDriver : public IFX_RenderDeviceDriver { protected: - virtual int GetDeviceCaps(int caps_id); - virtual void SaveState() { SaveDC(m_hDC); } - virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) { + // IFX_RenderDeviceDriver + int GetDeviceCaps(int caps_id) override; + void SaveState() override { SaveDC(m_hDC); } + void RestoreState(FX_BOOL bKeepSaved = FALSE) override { RestoreDC(m_hDC, -1); if (bKeepSaved) { SaveDC(m_hDC); } } - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - int fill_mode); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, - int fill_mode, - int alpha_flag, - void* pIccTransform, - int blend_type); - virtual FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + int fill_mode) override; + FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState) override; + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + FX_DWORD fill_color, + FX_DWORD stroke_color, + int fill_mode, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL FillRect(const FX_RECT* pRect, + FX_DWORD fill_color, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + FX_DWORD color, int alpha_flag, void* pIccTransform, - int blend_type); - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_DWORD color, - int alpha_flag, - void* pIccTransform, - int blend_type); + int blend_type) override; + FX_BOOL GetClipBox(FX_RECT* pRect) override; + void* GetPlatformSurface() override { return (void*)m_hDC; } + virtual void* GetClipRgn(); virtual FX_BOOL SetClipRgn(void* pRgn); - virtual FX_BOOL GetClipBox(FX_RECT* pRect); virtual FX_BOOL DeleteDeviceRgn(void* pRgn); virtual void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); - virtual void* GetPlatformSurface() { return (void*)m_hDC; } + FX_BOOL GDI_SetDIBits(const CFX_DIBitmap* pBitmap, const FX_RECT* pSrcRect, int left, @@ -170,8 +176,9 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { int m_Width, m_Height, m_nBitsPerPixel; int m_DeviceClass, m_RenderCaps; CGdiDeviceDriver(HDC hDC, int device_class); - ~CGdiDeviceDriver() {} + ~CGdiDeviceDriver() override {} }; + class CGdiDisplayDriver : public CGdiDeviceDriver { public: CGdiDisplayDriver(HDC hDC); @@ -261,83 +268,91 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { int m_HorzSize, m_VertSize; FX_BOOL m_bSupportROP; }; + class CPSOutput : public IFX_PSOutput { public: - CPSOutput(HDC hDC); - virtual ~CPSOutput(); - virtual void Release() { delete this; } + explicit CPSOutput(HDC hDC); + ~CPSOutput() override; + + // IFX_PSOutput + void Release() override { delete this; } + void OutputPS(const FX_CHAR* string, int len) override; + void Init(); - virtual void OutputPS(const FX_CHAR* string, int len); + HDC m_hDC; FX_CHAR* m_pBuf; }; + class CPSPrinterDriver : public IFX_RenderDeviceDriver { public: CPSPrinterDriver(); FX_BOOL Init(HDC hDC, int ps_level, FX_BOOL bCmykOutput); - ~CPSPrinterDriver(); + ~CPSPrinterDriver() override; protected: - virtual FX_BOOL IsPSPrintDriver() { return TRUE; } - virtual int GetDeviceCaps(int caps_id); - virtual FX_BOOL StartRendering(); - virtual void EndRendering(); - virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved = FALSE); - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - int fill_mode); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + // IFX_RenderDeviceDriver + int GetDeviceCaps(int caps_id); + FX_BOOL IsPSPrintDriver() override { return TRUE; } + FX_BOOL StartRendering() override; + void EndRendering() override; + void SaveState() override; + void RestoreState(FX_BOOL bKeepSaved = FALSE) override; + FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, - int fill_mode, - int alpha_flag, - void* pIccTransform, - int blend_type); - virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type, - int alpha_flag, - void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - FX_DWORD flags, - int alpha_flag, - void* pIccTransform, - int blend_type); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - FX_DWORD color, - const CFX_AffineMatrix* pMatrix, - FX_DWORD render_flags, - void*& handle, - int alpha_flag, - void* pIccTransform, - int blend_type); - virtual FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_AffineMatrix* pObject2Device, - FX_FLOAT font_size, - FX_DWORD color, - int alpha_flag, - void* pIccTransform); - virtual void* GetPlatformSurface() { return (void*)m_hDC; } + int fill_mode) override; + FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState) override; + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_AffineMatrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + FX_DWORD fill_color, + FX_DWORD stroke_color, + int fill_mode, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL GetClipBox(FX_RECT* pRect) override; + FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type, + int alpha_flag, + void* pIccTransform) override; + FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + FX_DWORD color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + FX_DWORD flags, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + FX_DWORD color, + const CFX_AffineMatrix* pMatrix, + FX_DWORD render_flags, + void*& handle, + int alpha_flag, + void* pIccTransform, + int blend_type) override; + FX_BOOL DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + const CFX_AffineMatrix* pObject2Device, + FX_FLOAT font_size, + FX_DWORD color, + int alpha_flag, + void* pIccTransform) override; + void* GetPlatformSurface() override { return (void*)m_hDC; } + HDC m_hDC; FX_BOOL m_bCmykOutput; int m_Width, m_Height, m_nBitsPerPixel; |