Use override in more classes in core/
[pdfium.git] / core / src / fxge / agg / include / fx_agg_driver.h
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 FX_AGG_DRIVER_H_
8 #define FX_AGG_DRIVER_H_
9
10 #include "../../../../../third_party/agg23/agg_clip_liang_barsky.h"
11 #include "../../../../../third_party/agg23/agg_path_storage.h"
12 #include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h"
13
14 class CAgg_PathData {
15  public:
16   CAgg_PathData() {}
17   ~CAgg_PathData() {}
18   FX_NAMESPACE_DECLARE(agg, path_storage) m_PathData;
19   void BuildPath(const CFX_PathData* pPathData,
20                  const CFX_AffineMatrix* pObject2Device);
21 };
22 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
23  public:
24   CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
25                       int dither_bits,
26                       FX_BOOL bRgbByteOrder,
27                       CFX_DIBitmap* pOriDevice,
28                       FX_BOOL bGroupKnockout);
29   ~CFX_AggDeviceDriver() override;
30
31   void InitPlatform();
32   void DestroyPlatform();
33
34   // IFX_RenderDeviceDriver
35   int GetDeviceCaps(int caps_id) override;
36   void SaveState() override;
37   void RestoreState(FX_BOOL bKeepSaved) override;
38   FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
39                            const CFX_AffineMatrix* pObject2Device,
40                            int fill_mode) override;
41   FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
42                              const CFX_AffineMatrix* pObject2Device,
43                              const CFX_GraphStateData* pGraphState) override;
44   FX_BOOL DrawPath(const CFX_PathData* pPathData,
45                    const CFX_AffineMatrix* pObject2Device,
46                    const CFX_GraphStateData* pGraphState,
47                    FX_DWORD fill_color,
48                    FX_DWORD stroke_color,
49                    int fill_mode,
50                    int alpha_flag,
51                    void* pIccTransform,
52                    int blend_type) override;
53   FX_BOOL SetPixel(int x,
54                    int y,
55                    FX_DWORD color,
56                    int alpha_flag,
57                    void* pIccTransform) override;
58   FX_BOOL FillRect(const FX_RECT* pRect,
59                    FX_DWORD fill_color,
60                    int alpha_flag,
61                    void* pIccTransform,
62                    int blend_type) override;
63   FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
64                            FX_FLOAT y1,
65                            FX_FLOAT x2,
66                            FX_FLOAT y2,
67                            FX_DWORD color,
68                            int alpha_flag,
69                            void* pIccTransform,
70                            int blend_type) override {
71     return FALSE;
72   }
73   FX_BOOL GetClipBox(FX_RECT* pRect) override;
74   FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
75                     int left,
76                     int top,
77                     void* pIccTransform = NULL,
78                     FX_BOOL bDEdge = FALSE) override;
79   CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; }
80   FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
81                     FX_DWORD color,
82                     const FX_RECT* pSrcRect,
83                     int left,
84                     int top,
85                     int blend_type,
86                     int alpha_flag,
87                     void* pIccTransform) override;
88   FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
89                         FX_DWORD color,
90                         int dest_left,
91                         int dest_top,
92                         int dest_width,
93                         int dest_height,
94                         const FX_RECT* pClipRect,
95                         FX_DWORD flags,
96                         int alpha_flag,
97                         void* pIccTransform,
98                         int blend_type) override;
99   FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
100                       int bitmap_alpha,
101                       FX_DWORD color,
102                       const CFX_AffineMatrix* pMatrix,
103                       FX_DWORD flags,
104                       void*& handle,
105                       int alpha_flag,
106                       void* pIccTransform,
107                       int blend_type) override;
108   FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override;
109   void CancelDIBits(void* handle) override;
110   FX_BOOL DrawDeviceText(int nChars,
111                          const FXTEXT_CHARPOS* pCharPos,
112                          CFX_Font* pFont,
113                          CFX_FontCache* pCache,
114                          const CFX_AffineMatrix* pObject2Device,
115                          FX_FLOAT font_size,
116                          FX_DWORD color,
117                          int alpha_flag,
118                          void* pIccTransform) override;
119   int GetDriverType() override { return 1; }
120
121   FX_BOOL RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) &
122                                rasterizer,
123                            FX_DWORD color,
124                            FX_BOOL bFullCover,
125                            FX_BOOL bGroupKnockout,
126                            int alpha_flag,
127                            void* pIccTransform);
128
129   void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) &
130                    rasterizer);
131
132   virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); }
133
134   CFX_DIBitmap* m_pBitmap;
135   CFX_ClipRgn* m_pClipRgn;
136   CFX_PtrArray m_StateStack;
137   void* m_pPlatformGraphics;
138   void* m_pPlatformBitmap;
139   void* m_pDwRenderTartget;
140   int m_FillFlags;
141   int m_DitherBits;
142   FX_BOOL m_bRgbByteOrder;
143   CFX_DIBitmap* m_pOriDevice;
144   FX_BOOL m_bGroupKnockout;
145 };
146
147 #endif  // FX_AGG_DRIVER_H_