blob: 35efab2b2d42e4c22a923561c02e7950798595ce [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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
dsinclair74a34fc2016-09-29 16:41:42 -070010#include "core/fxge/cfx_renderdevice.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040011#include "xfa/fgas/crt/fgas_memory.h"
tsepeze6477992017-01-05 12:57:00 -080012#include "xfa/fgas/font/cfgas_gefont.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040013
dsinclairacd0d592016-04-21 11:06:27 -070014class CFDE_Brush;
15class CFDE_Path;
16class CFDE_Pen;
npm9ada2d82016-08-10 07:51:38 -070017class CFX_GraphStateData;
dsinclairacd0d592016-04-21 11:06:27 -070018
19class CFDE_RenderDevice : public CFX_Target {
Dan Sinclair1770c022016-03-14 14:14:16 -040020 public:
tsepezd19e9122016-11-02 15:43:18 -070021 CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice);
tsepezf74ad992016-05-11 10:26:05 -070022 ~CFDE_RenderDevice() override;
Dan Sinclair1770c022016-03-14 14:14:16 -040023
dsinclairacd0d592016-04-21 11:06:27 -070024 int32_t GetWidth() const;
25 int32_t GetHeight() const;
dsinclairfe433f12016-06-06 12:03:31 -070026 void SaveState();
27 void RestoreState();
tsepezd19e9122016-11-02 15:43:18 -070028 bool SetClipPath(const CFDE_Path* pClip);
dsinclairacd0d592016-04-21 11:06:27 -070029 CFDE_Path* GetClipPath() const;
tsepezd19e9122016-11-02 15:43:18 -070030 bool SetClipRect(const CFX_RectF& rtClip);
dsinclairacd0d592016-04-21 11:06:27 -070031 const CFX_RectF& GetClipRect();
Dan Sinclair1770c022016-03-14 14:14:16 -040032
dsinclairacd0d592016-04-21 11:06:27 -070033 FX_FLOAT GetDpiX() const;
34 FX_FLOAT GetDpiY() const;
35
tsepezd19e9122016-11-02 15:43:18 -070036 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,
tsepeze6477992017-01-05 12:57:00 -080042 const CFX_RetainPtr<CFGAS_GEFont>& pFont,
tsepezd19e9122016-11-02 15:43:18 -070043 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,
dsinclairacd0d592016-04-21 11:06:27 -070082 FX_FLOAT fPenWidth,
tsepezd19e9122016-11-02 15:43:18 -070083 const CFX_RectF& rect,
thestigcfb77cc2016-06-10 12:21:53 -070084 const CFX_Matrix* pMatrix = nullptr);
tsepezd19e9122016-11-02 15:43:18 -070085 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,
thestigcfb77cc2016-06-10 12:21:53 -070091 const CFX_Matrix* pMatrix = nullptr);
tsepezd19e9122016-11-02 15:43:18 -070092 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,
thestigcfb77cc2016-06-10 12:21:53 -070097 const CFX_Matrix* pMatrix = nullptr);
tsepezd19e9122016-11-02 15:43:18 -070098 bool FillRectangle(CFDE_Brush* pBrush,
99 const CFX_RectF& rect,
100 const CFX_Matrix* pMatrix = nullptr);
dsinclair25c223d2016-04-12 09:51:45 -0700101
tsepezd19e9122016-11-02 15:43:18 -0700102 bool DrawSolidString(CFDE_Brush* pBrush,
tsepeze6477992017-01-05 12:57:00 -0800103 const CFX_RetainPtr<CFGAS_GEFont>& pFont,
tsepezd19e9122016-11-02 15:43:18 -0700104 const FXTEXT_CHARPOS* pCharPos,
105 int32_t iCount,
106 FX_FLOAT fFontSize,
107 const CFX_Matrix* pMatrix);
108 bool DrawStringPath(CFDE_Brush* pBrush,
tsepeze6477992017-01-05 12:57:00 -0800109 const CFX_RetainPtr<CFGAS_GEFont>& pFont,
tsepezd19e9122016-11-02 15:43:18 -0700110 const FXTEXT_CHARPOS* pCharPos,
111 int32_t iCount,
112 FX_FLOAT fFontSize,
113 const CFX_Matrix* pMatrix);
Dan Sinclair1770c022016-03-14 14:14:16 -0400114
115 protected:
tsepezd19e9122016-11-02 15:43:18 -0700116 bool CreatePen(CFDE_Pen* pPen,
117 FX_FLOAT fPenWidth,
118 CFX_GraphStateData& graphState);
dsinclair25c223d2016-04-12 09:51:45 -0700119
weilicddf8252016-08-04 15:43:59 -0700120 CFX_RenderDevice* const m_pDevice;
Dan Sinclair1770c022016-03-14 14:14:16 -0400121 CFX_RectF m_rtClip;
tsepezd19e9122016-11-02 15:43:18 -0700122 bool m_bOwnerDevice;
Dan Sinclair1770c022016-03-14 14:14:16 -0400123 int32_t m_iCharCount;
124};
125
126#endif // XFA_FDE_FDE_GEDEVICE_H_