| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FDE_FDE_GEDEVICE_H_ | 7 #ifndef XFA_FDE_FDE_GEDEVICE_H_ |
| 8 #define XFA_FDE_FDE_GEDEVICE_H_ | 8 #define XFA_FDE_FDE_GEDEVICE_H_ |
| 9 | 9 |
| 10 #include "xfa/fde/fde_renderdevice.h" | 10 #include "core/fxge/include/fx_ge.h" |
| 11 #include "xfa/fgas/crt/fgas_memory.h" | 11 #include "xfa/fgas/crt/fgas_memory.h" |
| 12 | 12 |
| 13 class CFDE_FxgeDevice : public IFDE_RenderDevice, public CFX_Target { | 13 typedef struct FDE_HDEVICESTATE_ { void* pData; } * FDE_HDEVICESTATE; |
| 14 |
| 15 class CFDE_Brush; |
| 16 class CFDE_Path; |
| 17 class CFDE_Pen; |
| 18 class CFX_RenderDevice; |
| 19 class IFX_Font; |
| 20 |
| 21 class CFDE_RenderDevice : public CFX_Target { |
| 14 public: | 22 public: |
| 15 CFDE_FxgeDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice); | 23 CFDE_RenderDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice); |
| 16 ~CFDE_FxgeDevice(); | 24 ~CFDE_RenderDevice(); |
| 17 virtual void Release() { delete this; } | |
| 18 | 25 |
| 19 virtual int32_t GetWidth() const; | 26 void Release() { delete this; } |
| 20 virtual int32_t GetHeight() const; | |
| 21 virtual FDE_HDEVICESTATE SaveState(); | |
| 22 virtual void RestoreState(FDE_HDEVICESTATE hState); | |
| 23 virtual FX_BOOL SetClipPath(const IFDE_Path* pClip); | |
| 24 virtual IFDE_Path* GetClipPath() const; | |
| 25 virtual FX_BOOL SetClipRect(const CFX_RectF& rtClip); | |
| 26 virtual const CFX_RectF& GetClipRect(); | |
| 27 | 27 |
| 28 virtual FX_FLOAT GetDpiX() const; | 28 int32_t GetWidth() const; |
| 29 virtual FX_FLOAT GetDpiY() const; | 29 int32_t GetHeight() const; |
| 30 FDE_HDEVICESTATE SaveState(); |
| 31 void RestoreState(FDE_HDEVICESTATE hState); |
| 32 FX_BOOL SetClipPath(const CFDE_Path* pClip); |
| 33 CFDE_Path* GetClipPath() const; |
| 34 FX_BOOL SetClipRect(const CFX_RectF& rtClip); |
| 35 const CFX_RectF& GetClipRect(); |
| 30 | 36 |
| 31 virtual FX_BOOL DrawImage(CFX_DIBSource* pDib, | 37 FX_FLOAT GetDpiX() const; |
| 32 const CFX_RectF* pSrcRect, | 38 FX_FLOAT GetDpiY() const; |
| 33 const CFX_RectF& dstRect, | 39 |
| 34 const CFX_Matrix* pImgMatrix = NULL, | 40 FX_BOOL DrawImage(CFX_DIBSource* pDib, |
| 35 const CFX_Matrix* pDevMatrix = NULL); | 41 const CFX_RectF* pSrcRect, |
| 36 virtual FX_BOOL DrawString(CFDE_Brush* pBrush, | 42 const CFX_RectF& dstRect, |
| 37 IFX_Font* pFont, | 43 const CFX_Matrix* pImgMatrix = NULL, |
| 38 const FXTEXT_CHARPOS* pCharPos, | 44 const CFX_Matrix* pDevMatrix = NULL); |
| 39 int32_t iCount, | 45 FX_BOOL DrawString(CFDE_Brush* pBrush, |
| 40 FX_FLOAT fFontSize, | 46 IFX_Font* pFont, |
| 41 const CFX_Matrix* pMatrix = NULL); | 47 const FXTEXT_CHARPOS* pCharPos, |
| 42 virtual FX_BOOL DrawBezier(CFDE_Pen* pPen, | 48 int32_t iCount, |
| 43 FX_FLOAT fPenWidth, | 49 FX_FLOAT fFontSize, |
| 44 const CFX_PointF& pt1, | 50 const CFX_Matrix* pMatrix = NULL); |
| 45 const CFX_PointF& pt2, | 51 FX_BOOL DrawBezier(CFDE_Pen* pPen, |
| 46 const CFX_PointF& pt3, | 52 FX_FLOAT fPenWidth, |
| 47 const CFX_PointF& pt4, | 53 const CFX_PointF& pt1, |
| 48 const CFX_Matrix* pMatrix = NULL); | 54 const CFX_PointF& pt2, |
| 49 virtual FX_BOOL DrawCurve(CFDE_Pen* pPen, | 55 const CFX_PointF& pt3, |
| 50 FX_FLOAT fPenWidth, | 56 const CFX_PointF& pt4, |
| 51 const CFX_PointsF& points, | 57 const CFX_Matrix* pMatrix = NULL); |
| 52 FX_BOOL bClosed, | 58 FX_BOOL DrawCurve(CFDE_Pen* pPen, |
| 53 FX_FLOAT fTension = 0.5f, | 59 FX_FLOAT fPenWidth, |
| 54 const CFX_Matrix* pMatrix = NULL); | 60 const CFX_PointsF& points, |
| 55 virtual FX_BOOL DrawEllipse(CFDE_Pen* pPen, | 61 FX_BOOL bClosed, |
| 56 FX_FLOAT fPenWidth, | 62 FX_FLOAT fTension = 0.5f, |
| 57 const CFX_RectF& rect, | 63 const CFX_Matrix* pMatrix = NULL); |
| 58 const CFX_Matrix* pMatrix = NULL); | 64 FX_BOOL DrawEllipse(CFDE_Pen* pPen, |
| 59 virtual FX_BOOL DrawLines(CFDE_Pen* pPen, | 65 FX_FLOAT fPenWidth, |
| 60 FX_FLOAT fPenWidth, | 66 const CFX_RectF& rect, |
| 61 const CFX_PointsF& points, | 67 const CFX_Matrix* pMatrix = NULL); |
| 62 const CFX_Matrix* pMatrix = NULL); | 68 FX_BOOL DrawLines(CFDE_Pen* pPen, |
| 63 virtual FX_BOOL DrawLine(CFDE_Pen* pPen, | 69 FX_FLOAT fPenWidth, |
| 64 FX_FLOAT fPenWidth, | 70 const CFX_PointsF& points, |
| 65 const CFX_PointF& pt1, | 71 const CFX_Matrix* pMatrix = NULL); |
| 66 const CFX_PointF& pt2, | 72 FX_BOOL DrawLine(CFDE_Pen* pPen, |
| 67 const CFX_Matrix* pMatrix = NULL); | 73 FX_FLOAT fPenWidth, |
| 68 virtual FX_BOOL DrawPath(CFDE_Pen* pPen, | 74 const CFX_PointF& pt1, |
| 69 FX_FLOAT fPenWidth, | 75 const CFX_PointF& pt2, |
| 70 const IFDE_Path* pPath, | 76 const CFX_Matrix* pMatrix = NULL); |
| 71 const CFX_Matrix* pMatrix = NULL); | 77 FX_BOOL DrawPath(CFDE_Pen* pPen, |
| 72 virtual FX_BOOL DrawPolygon(CFDE_Pen* pPen, | 78 FX_FLOAT fPenWidth, |
| 73 FX_FLOAT fPenWidth, | 79 const CFDE_Path* pPath, |
| 74 const CFX_PointsF& points, | 80 const CFX_Matrix* pMatrix = NULL); |
| 75 const CFX_Matrix* pMatrix = NULL); | 81 FX_BOOL DrawPolygon(CFDE_Pen* pPen, |
| 76 virtual FX_BOOL DrawRectangle(CFDE_Pen* pPen, | 82 FX_FLOAT fPenWidth, |
| 77 FX_FLOAT fPenWidth, | 83 const CFX_PointsF& points, |
| 78 const CFX_RectF& rect, | 84 const CFX_Matrix* pMatrix = NULL); |
| 79 const CFX_Matrix* pMatrix = NULL); | 85 FX_BOOL DrawRectangle(CFDE_Pen* pPen, |
| 80 virtual FX_BOOL FillClosedCurve(CFDE_Brush* pBrush, | 86 FX_FLOAT fPenWidth, |
| 81 const CFX_PointsF& points, | 87 const CFX_RectF& rect, |
| 82 FX_FLOAT fTension = 0.5f, | 88 const CFX_Matrix* pMatrix = NULL); |
| 83 const CFX_Matrix* pMatrix = NULL); | 89 FX_BOOL FillClosedCurve(CFDE_Brush* pBrush, |
| 84 virtual FX_BOOL FillEllipse(CFDE_Brush* pBrush, | 90 const CFX_PointsF& points, |
| 85 const CFX_RectF& rect, | 91 FX_FLOAT fTension = 0.5f, |
| 86 const CFX_Matrix* pMatrix = NULL); | 92 const CFX_Matrix* pMatrix = NULL); |
| 87 virtual FX_BOOL FillPath(CFDE_Brush* pBrush, | 93 FX_BOOL FillEllipse(CFDE_Brush* pBrush, |
| 88 const IFDE_Path* pPath, | 94 const CFX_RectF& rect, |
| 89 const CFX_Matrix* pMatrix = NULL); | 95 const CFX_Matrix* pMatrix = NULL); |
| 90 virtual FX_BOOL FillPolygon(CFDE_Brush* pBrush, | 96 FX_BOOL FillPath(CFDE_Brush* pBrush, |
| 91 const CFX_PointsF& points, | 97 const CFDE_Path* pPath, |
| 92 const CFX_Matrix* pMatrix = NULL); | 98 const CFX_Matrix* pMatrix = NULL); |
| 93 virtual FX_BOOL FillRectangle(CFDE_Brush* pBrush, | 99 FX_BOOL FillPolygon(CFDE_Brush* pBrush, |
| 94 const CFX_RectF& rect, | 100 const CFX_PointsF& points, |
| 95 const CFX_Matrix* pMatrix = NULL); | 101 const CFX_Matrix* pMatrix = NULL); |
| 102 FX_BOOL FillRectangle(CFDE_Brush* pBrush, |
| 103 const CFX_RectF& rect, |
| 104 const CFX_Matrix* pMatrix = NULL); |
| 96 | 105 |
| 97 FX_BOOL DrawSolidString(CFDE_Brush* pBrush, | 106 FX_BOOL DrawSolidString(CFDE_Brush* pBrush, |
| 98 IFX_Font* pFont, | 107 IFX_Font* pFont, |
| 99 const FXTEXT_CHARPOS* pCharPos, | 108 const FXTEXT_CHARPOS* pCharPos, |
| 100 int32_t iCount, | 109 int32_t iCount, |
| 101 FX_FLOAT fFontSize, | 110 FX_FLOAT fFontSize, |
| 102 const CFX_Matrix* pMatrix); | 111 const CFX_Matrix* pMatrix); |
| 103 FX_BOOL DrawStringPath(CFDE_Brush* pBrush, | 112 FX_BOOL DrawStringPath(CFDE_Brush* pBrush, |
| 104 IFX_Font* pFont, | 113 IFX_Font* pFont, |
| 105 const FXTEXT_CHARPOS* pCharPos, | 114 const FXTEXT_CHARPOS* pCharPos, |
| 106 int32_t iCount, | 115 int32_t iCount, |
| 107 FX_FLOAT fFontSize, | 116 FX_FLOAT fFontSize, |
| 108 const CFX_Matrix* pMatrix); | 117 const CFX_Matrix* pMatrix); |
| 109 | 118 |
| 110 protected: | 119 protected: |
| 111 FX_BOOL CreatePen(CFDE_Pen* pPen, | 120 FX_BOOL CreatePen(CFDE_Pen* pPen, |
| 112 FX_FLOAT fPenWidth, | 121 FX_FLOAT fPenWidth, |
| 113 CFX_GraphStateData& graphState); | 122 CFX_GraphStateData& graphState); |
| 114 | 123 |
| 115 CFX_RenderDevice* m_pDevice; | 124 CFX_RenderDevice* m_pDevice; |
| 116 CFX_RectF m_rtClip; | 125 CFX_RectF m_rtClip; |
| 117 FX_BOOL m_bOwnerDevice; | 126 FX_BOOL m_bOwnerDevice; |
| 118 FXTEXT_CHARPOS* m_pCharPos; | 127 FXTEXT_CHARPOS* m_pCharPos; |
| 119 int32_t m_iCharCount; | 128 int32_t m_iCharCount; |
| 120 }; | 129 }; |
| 121 | 130 |
| 122 #endif // XFA_FDE_FDE_GEDEVICE_H_ | 131 #endif // XFA_FDE_FDE_GEDEVICE_H_ |
| OLD | NEW |