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