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 | class CFDE_Brush; |
| 14 | class CFDE_Path; |
| 15 | class CFDE_Pen; |
thestig | a4fdfc5 | 2016-06-07 17:33:37 -0700 | [diff] [blame] | 16 | class CFGAS_GEFont; |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 17 | |
| 18 | class CFDE_RenderDevice : public CFX_Target { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 19 | public: |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 20 | CFDE_RenderDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice); |
tsepez | f74ad99 | 2016-05-11 10:26:05 -0700 | [diff] [blame] | 21 | ~CFDE_RenderDevice() override; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 22 | |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 23 | int32_t GetWidth() const; |
| 24 | int32_t GetHeight() const; |
dsinclair | fe433f1 | 2016-06-06 12:03:31 -0700 | [diff] [blame] | 25 | void SaveState(); |
| 26 | void RestoreState(); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 27 | FX_BOOL SetClipPath(const CFDE_Path* pClip); |
| 28 | CFDE_Path* GetClipPath() const; |
| 29 | FX_BOOL SetClipRect(const CFX_RectF& rtClip); |
| 30 | const CFX_RectF& GetClipRect(); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 31 | |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 32 | FX_FLOAT GetDpiX() const; |
| 33 | FX_FLOAT GetDpiY() const; |
| 34 | |
| 35 | FX_BOOL DrawImage(CFX_DIBSource* pDib, |
| 36 | const CFX_RectF* pSrcRect, |
| 37 | const CFX_RectF& dstRect, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 38 | const CFX_Matrix* pImgMatrix = nullptr, |
| 39 | const CFX_Matrix* pDevMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 40 | FX_BOOL DrawString(CFDE_Brush* pBrush, |
thestig | a4fdfc5 | 2016-06-07 17:33:37 -0700 | [diff] [blame] | 41 | CFGAS_GEFont* pFont, |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 42 | const FXTEXT_CHARPOS* pCharPos, |
| 43 | int32_t iCount, |
| 44 | FX_FLOAT fFontSize, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 45 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 46 | FX_BOOL DrawBezier(CFDE_Pen* pPen, |
| 47 | FX_FLOAT fPenWidth, |
| 48 | const CFX_PointF& pt1, |
| 49 | const CFX_PointF& pt2, |
| 50 | const CFX_PointF& pt3, |
| 51 | const CFX_PointF& pt4, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 52 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 53 | FX_BOOL DrawCurve(CFDE_Pen* pPen, |
| 54 | FX_FLOAT fPenWidth, |
| 55 | const CFX_PointsF& points, |
| 56 | FX_BOOL bClosed, |
| 57 | FX_FLOAT fTension = 0.5f, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 58 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 59 | FX_BOOL DrawEllipse(CFDE_Pen* pPen, |
| 60 | FX_FLOAT fPenWidth, |
| 61 | const CFX_RectF& rect, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 62 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 63 | FX_BOOL DrawLines(CFDE_Pen* pPen, |
| 64 | FX_FLOAT fPenWidth, |
| 65 | const CFX_PointsF& points, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 66 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 67 | FX_BOOL DrawLine(CFDE_Pen* pPen, |
| 68 | FX_FLOAT fPenWidth, |
| 69 | const CFX_PointF& pt1, |
| 70 | const CFX_PointF& pt2, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 71 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 72 | FX_BOOL DrawPath(CFDE_Pen* pPen, |
| 73 | FX_FLOAT fPenWidth, |
| 74 | const CFDE_Path* pPath, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 75 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 76 | FX_BOOL DrawPolygon(CFDE_Pen* pPen, |
| 77 | FX_FLOAT fPenWidth, |
| 78 | const CFX_PointsF& points, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 79 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 80 | FX_BOOL DrawRectangle(CFDE_Pen* pPen, |
| 81 | FX_FLOAT fPenWidth, |
| 82 | const CFX_RectF& rect, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 83 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 84 | FX_BOOL FillClosedCurve(CFDE_Brush* pBrush, |
| 85 | const CFX_PointsF& points, |
| 86 | FX_FLOAT fTension = 0.5f, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 87 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 88 | FX_BOOL FillEllipse(CFDE_Brush* pBrush, |
| 89 | const CFX_RectF& rect, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 90 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 91 | FX_BOOL FillPath(CFDE_Brush* pBrush, |
| 92 | const CFDE_Path* pPath, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 93 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 94 | FX_BOOL FillPolygon(CFDE_Brush* pBrush, |
| 95 | const CFX_PointsF& points, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 96 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 97 | FX_BOOL FillRectangle(CFDE_Brush* pBrush, |
| 98 | const CFX_RectF& rect, |
thestig | cfb77cc | 2016-06-10 12:21:53 -0700 | [diff] [blame^] | 99 | const CFX_Matrix* pMatrix = nullptr); |
dsinclair | 25c223d | 2016-04-12 09:51:45 -0700 | [diff] [blame] | 100 | |
dsinclair | a5c1323 | 2016-04-12 13:19:36 -0700 | [diff] [blame] | 101 | FX_BOOL DrawSolidString(CFDE_Brush* pBrush, |
thestig | a4fdfc5 | 2016-06-07 17:33:37 -0700 | [diff] [blame] | 102 | CFGAS_GEFont* pFont, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 103 | const FXTEXT_CHARPOS* pCharPos, |
| 104 | int32_t iCount, |
| 105 | FX_FLOAT fFontSize, |
| 106 | const CFX_Matrix* pMatrix); |
dsinclair | a5c1323 | 2016-04-12 13:19:36 -0700 | [diff] [blame] | 107 | FX_BOOL DrawStringPath(CFDE_Brush* pBrush, |
thestig | a4fdfc5 | 2016-06-07 17:33:37 -0700 | [diff] [blame] | 108 | CFGAS_GEFont* pFont, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 109 | const FXTEXT_CHARPOS* pCharPos, |
| 110 | int32_t iCount, |
| 111 | FX_FLOAT fFontSize, |
| 112 | const CFX_Matrix* pMatrix); |
| 113 | |
| 114 | protected: |
dsinclair | a5c1323 | 2016-04-12 13:19:36 -0700 | [diff] [blame] | 115 | FX_BOOL CreatePen(CFDE_Pen* pPen, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 116 | FX_FLOAT fPenWidth, |
| 117 | CFX_GraphStateData& graphState); |
dsinclair | 25c223d | 2016-04-12 09:51:45 -0700 | [diff] [blame] | 118 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 119 | CFX_RenderDevice* m_pDevice; |
| 120 | CFX_RectF m_rtClip; |
| 121 | FX_BOOL m_bOwnerDevice; |
| 122 | FXTEXT_CHARPOS* m_pCharPos; |
| 123 | int32_t m_iCharCount; |
| 124 | }; |
| 125 | |
| 126 | #endif // XFA_FDE_FDE_GEDEVICE_H_ |