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