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