blob: 2d2a9019044a2679ad85f4c6ffbddd4446d41b40 [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
dsinclairacd0d592016-04-21 11:06:27 -070010#include "core/fxge/include/fx_ge.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040011#include "xfa/fgas/crt/fgas_memory.h"
12
dsinclairacd0d592016-04-21 11:06:27 -070013class CFDE_Brush;
14class CFDE_Path;
15class CFDE_Pen;
thestiga4fdfc52016-06-07 17:33:37 -070016class CFGAS_GEFont;
dsinclairacd0d592016-04-21 11:06:27 -070017
18class CFDE_RenderDevice : public CFX_Target {
Dan Sinclair1770c022016-03-14 14:14:16 -040019 public:
dsinclairacd0d592016-04-21 11:06:27 -070020 CFDE_RenderDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice);
tsepezf74ad992016-05-11 10:26:05 -070021 ~CFDE_RenderDevice() override;
Dan Sinclair1770c022016-03-14 14:14:16 -040022
dsinclairacd0d592016-04-21 11:06:27 -070023 int32_t GetWidth() const;
24 int32_t GetHeight() const;
dsinclairfe433f12016-06-06 12:03:31 -070025 void SaveState();
26 void RestoreState();
dsinclairacd0d592016-04-21 11:06:27 -070027 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 Sinclair1770c022016-03-14 14:14:16 -040031
dsinclairacd0d592016-04-21 11:06:27 -070032 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,
thestigcfb77cc2016-06-10 12:21:53 -070038 const CFX_Matrix* pImgMatrix = nullptr,
39 const CFX_Matrix* pDevMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070040 FX_BOOL DrawString(CFDE_Brush* pBrush,
thestiga4fdfc52016-06-07 17:33:37 -070041 CFGAS_GEFont* pFont,
dsinclairacd0d592016-04-21 11:06:27 -070042 const FXTEXT_CHARPOS* pCharPos,
43 int32_t iCount,
44 FX_FLOAT fFontSize,
thestigcfb77cc2016-06-10 12:21:53 -070045 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070046 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,
thestigcfb77cc2016-06-10 12:21:53 -070052 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070053 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,
thestigcfb77cc2016-06-10 12:21:53 -070058 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070059 FX_BOOL DrawEllipse(CFDE_Pen* pPen,
60 FX_FLOAT fPenWidth,
61 const CFX_RectF& rect,
thestigcfb77cc2016-06-10 12:21:53 -070062 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070063 FX_BOOL DrawLines(CFDE_Pen* pPen,
64 FX_FLOAT fPenWidth,
65 const CFX_PointsF& points,
thestigcfb77cc2016-06-10 12:21:53 -070066 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070067 FX_BOOL DrawLine(CFDE_Pen* pPen,
68 FX_FLOAT fPenWidth,
69 const CFX_PointF& pt1,
70 const CFX_PointF& pt2,
thestigcfb77cc2016-06-10 12:21:53 -070071 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070072 FX_BOOL DrawPath(CFDE_Pen* pPen,
73 FX_FLOAT fPenWidth,
74 const CFDE_Path* pPath,
thestigcfb77cc2016-06-10 12:21:53 -070075 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070076 FX_BOOL DrawPolygon(CFDE_Pen* pPen,
77 FX_FLOAT fPenWidth,
78 const CFX_PointsF& points,
thestigcfb77cc2016-06-10 12:21:53 -070079 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070080 FX_BOOL DrawRectangle(CFDE_Pen* pPen,
81 FX_FLOAT fPenWidth,
82 const CFX_RectF& rect,
thestigcfb77cc2016-06-10 12:21:53 -070083 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070084 FX_BOOL FillClosedCurve(CFDE_Brush* pBrush,
85 const CFX_PointsF& points,
86 FX_FLOAT fTension = 0.5f,
thestigcfb77cc2016-06-10 12:21:53 -070087 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070088 FX_BOOL FillEllipse(CFDE_Brush* pBrush,
89 const CFX_RectF& rect,
thestigcfb77cc2016-06-10 12:21:53 -070090 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070091 FX_BOOL FillPath(CFDE_Brush* pBrush,
92 const CFDE_Path* pPath,
thestigcfb77cc2016-06-10 12:21:53 -070093 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070094 FX_BOOL FillPolygon(CFDE_Brush* pBrush,
95 const CFX_PointsF& points,
thestigcfb77cc2016-06-10 12:21:53 -070096 const CFX_Matrix* pMatrix = nullptr);
dsinclairacd0d592016-04-21 11:06:27 -070097 FX_BOOL FillRectangle(CFDE_Brush* pBrush,
98 const CFX_RectF& rect,
thestigcfb77cc2016-06-10 12:21:53 -070099 const CFX_Matrix* pMatrix = nullptr);
dsinclair25c223d2016-04-12 09:51:45 -0700100
dsinclaira5c13232016-04-12 13:19:36 -0700101 FX_BOOL DrawSolidString(CFDE_Brush* pBrush,
thestiga4fdfc52016-06-07 17:33:37 -0700102 CFGAS_GEFont* pFont,
Dan Sinclair1770c022016-03-14 14:14:16 -0400103 const FXTEXT_CHARPOS* pCharPos,
104 int32_t iCount,
105 FX_FLOAT fFontSize,
106 const CFX_Matrix* pMatrix);
dsinclaira5c13232016-04-12 13:19:36 -0700107 FX_BOOL DrawStringPath(CFDE_Brush* pBrush,
thestiga4fdfc52016-06-07 17:33:37 -0700108 CFGAS_GEFont* pFont,
Dan Sinclair1770c022016-03-14 14:14:16 -0400109 const FXTEXT_CHARPOS* pCharPos,
110 int32_t iCount,
111 FX_FLOAT fFontSize,
112 const CFX_Matrix* pMatrix);
113
114 protected:
dsinclaira5c13232016-04-12 13:19:36 -0700115 FX_BOOL CreatePen(CFDE_Pen* pPen,
Dan Sinclair1770c022016-03-14 14:14:16 -0400116 FX_FLOAT fPenWidth,
117 CFX_GraphStateData& graphState);
dsinclair25c223d2016-04-12 09:51:45 -0700118
Dan Sinclair1770c022016-03-14 14:14:16 -0400119 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_