Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: core/fxge/include/cfx_renderdevice.h

Issue 2377393002: Move core/fxge/include to core/fxge (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxge/include/cfx_pathdata.h ('k') | core/fxge/include/cfx_substfont.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_
8 #define CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_
9
10 #include <memory>
11
12 #include "core/fxge/include/cfx_gemodule.h"
13 #include "core/fxge/include/fx_dib.h"
14 #include "core/fxge/include/fx_font.h"
15
16 class CFX_Font;
17 class CFX_GraphStateData;
18 class IFX_RenderDeviceDriver;
19
20 #define FXDC_DEVICE_CLASS 1
21 #define FXDC_PIXEL_WIDTH 2
22 #define FXDC_PIXEL_HEIGHT 3
23 #define FXDC_BITS_PIXEL 4
24 #define FXDC_HORZ_SIZE 5
25 #define FXDC_VERT_SIZE 6
26 #define FXDC_RENDER_CAPS 7
27 #define FXDC_DISPLAY 1
28 #define FXDC_PRINTER 2
29
30 #define FXPT_CLOSEFIGURE 0x01
31 #define FXPT_LINETO 0x02
32 #define FXPT_BEZIERTO 0x04
33 #define FXPT_MOVETO 0x06
34 #define FXPT_TYPE 0x06
35
36 #define FXRC_GET_BITS 0x01
37 #define FXRC_BIT_MASK 0x02
38 #define FXRC_ALPHA_MASK 0x04
39 #define FXRC_ALPHA_PATH 0x10
40 #define FXRC_ALPHA_IMAGE 0x20
41 #define FXRC_ALPHA_OUTPUT 0x40
42 #define FXRC_BLEND_MODE 0x80
43 #define FXRC_SOFT_CLIP 0x100
44 #define FXRC_CMYK_OUTPUT 0x200
45 #define FXRC_BITMASK_OUTPUT 0x400
46 #define FXRC_BYTEMASK_OUTPUT 0x800
47 #define FXRENDER_IMAGE_LOSSY 0x1000
48 #define FXRC_FILLSTROKE_PATH 0x2000
49 #define FXRC_SHADING 0x4000
50
51 #define FXFILL_ALTERNATE 1
52 #define FXFILL_WINDING 2
53 #define FXFILL_FULLCOVER 4
54 #define FXFILL_RECT_AA 8
55 #define FX_FILL_STROKE 16
56 #define FX_STROKE_ADJUST 32
57 #define FX_STROKE_TEXT_MODE 64
58 #define FX_FILL_TEXT_MODE 128
59 #define FX_ZEROAREA_FILL 256
60 #define FXFILL_NOPATHSMOOTH 512
61
62 #define FXTEXT_CLEARTYPE 0x01
63 #define FXTEXT_BGR_STRIPE 0x02
64 #define FXTEXT_PRINTGRAPHICTEXT 0x04
65 #define FXTEXT_NO_NATIVETEXT 0x08
66 #define FXTEXT_PRINTIMAGETEXT 0x10
67 #define FXTEXT_NOSMOOTH 0x20
68
69 struct FXTEXT_CHARPOS {
70 FX_FLOAT m_AdjustMatrix[4];
71 FX_FLOAT m_OriginX;
72 FX_FLOAT m_OriginY;
73 uint32_t m_GlyphIndex;
74 int32_t m_FontCharWidth;
75 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
76 uint32_t m_ExtGID;
77 #endif
78 int32_t m_FallbackFontPosition;
79 bool m_bGlyphAdjust;
80 bool m_bFontStyle;
81 };
82
83 class CFX_RenderDevice {
84 public:
85 CFX_RenderDevice();
86 virtual ~CFX_RenderDevice();
87
88 // Take ownership of |pDriver|.
89 void SetDeviceDriver(std::unique_ptr<IFX_RenderDeviceDriver> pDriver);
90 IFX_RenderDeviceDriver* GetDeviceDriver() const {
91 return m_pDeviceDriver.get();
92 }
93
94 void SaveState();
95 void RestoreState(bool bKeepSaved);
96
97 int GetWidth() const { return m_Width; }
98 int GetHeight() const { return m_Height; }
99 int GetDeviceClass() const { return m_DeviceClass; }
100 int GetRenderCaps() const { return m_RenderCaps; }
101 int GetDeviceCaps(int id) const;
102 CFX_Matrix GetCTM() const;
103 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; }
104 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; }
105 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
106 int width,
107 int height) const;
108 const FX_RECT& GetClipBox() const { return m_ClipBox; }
109 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
110 const CFX_Matrix* pObject2Device,
111 int fill_mode);
112 FX_BOOL SetClip_Rect(const FX_RECT& pRect);
113 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
114 const CFX_Matrix* pObject2Device,
115 const CFX_GraphStateData* pGraphState);
116 FX_BOOL DrawPath(const CFX_PathData* pPathData,
117 const CFX_Matrix* pObject2Device,
118 const CFX_GraphStateData* pGraphState,
119 uint32_t fill_color,
120 uint32_t stroke_color,
121 int fill_mode) {
122 return DrawPathWithBlend(pPathData, pObject2Device, pGraphState, fill_color,
123 stroke_color, fill_mode, FXDIB_BLEND_NORMAL);
124 }
125 FX_BOOL DrawPathWithBlend(const CFX_PathData* pPathData,
126 const CFX_Matrix* pObject2Device,
127 const CFX_GraphStateData* pGraphState,
128 uint32_t fill_color,
129 uint32_t stroke_color,
130 int fill_mode,
131 int blend_type);
132 FX_BOOL SetPixel(int x, int y, uint32_t color);
133 FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) {
134 return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL);
135 }
136 FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
137 uint32_t color,
138 int blend_type);
139 FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
140 FX_FLOAT y1,
141 FX_FLOAT x2,
142 FX_FLOAT y2,
143 uint32_t color,
144 int fill_mode,
145 int blend_type);
146
147 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
148 CFX_DIBitmap* GetBackDrop();
149 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) {
150 return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL);
151 }
152 FX_BOOL SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
153 int left,
154 int top,
155 int blend_type);
156 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
157 int left,
158 int top,
159 int dest_width,
160 int dest_height) {
161 return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width,
162 dest_height, 0, FXDIB_BLEND_NORMAL);
163 }
164 FX_BOOL StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap,
165 int left,
166 int top,
167 int dest_width,
168 int dest_height,
169 uint32_t flags,
170 int blend_type);
171 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap,
172 int left,
173 int top,
174 uint32_t color);
175 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap,
176 int left,
177 int top,
178 int dest_width,
179 int dest_height,
180 uint32_t color);
181 FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
182 int left,
183 int top,
184 int dest_width,
185 int dest_height,
186 uint32_t color,
187 uint32_t flags);
188 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
189 int bitmap_alpha,
190 uint32_t color,
191 const CFX_Matrix* pMatrix,
192 uint32_t flags,
193 void*& handle) {
194 return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags,
195 handle, FXDIB_BLEND_NORMAL);
196 }
197 FX_BOOL StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
198 int bitmap_alpha,
199 uint32_t color,
200 const CFX_Matrix* pMatrix,
201 uint32_t flags,
202 void*& handle,
203 int blend_type);
204 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
205 void CancelDIBits(void* handle);
206
207 FX_BOOL DrawNormalText(int nChars,
208 const FXTEXT_CHARPOS* pCharPos,
209 CFX_Font* pFont,
210 FX_FLOAT font_size,
211 const CFX_Matrix* pText2Device,
212 uint32_t fill_color,
213 uint32_t text_flags);
214 FX_BOOL DrawTextPath(int nChars,
215 const FXTEXT_CHARPOS* pCharPos,
216 CFX_Font* pFont,
217 FX_FLOAT font_size,
218 const CFX_Matrix* pText2User,
219 const CFX_Matrix* pUser2Device,
220 const CFX_GraphStateData* pGraphState,
221 uint32_t fill_color,
222 uint32_t stroke_color,
223 CFX_PathData* pClippingPath,
224 int nFlag);
225
226 #ifdef _SKIA_SUPPORT_
227 virtual void DebugVerifyBitmapIsPreMultiplied() const;
228 virtual bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
229 const CFX_DIBSource* pMask,
230 int left,
231 int top,
232 int bitmap_alpha,
233 int blend_type);
234 void Flush();
235 #endif
236
237 private:
238 void InitDeviceInfo();
239 void UpdateClipBox();
240 FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData,
241 const CFX_Matrix* pObject2Device,
242 const CFX_GraphStateData* pGraphState,
243 uint32_t fill_color,
244 uint32_t stroke_color,
245 int fill_mode,
246 int blend_type);
247
248 CFX_DIBitmap* m_pBitmap;
249 int m_Width;
250 int m_Height;
251 int m_bpp;
252 int m_RenderCaps;
253 int m_DeviceClass;
254 FX_RECT m_ClipBox;
255 std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver;
256 };
257
258 #endif // CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_
OLDNEW
« no previous file with comments | « core/fxge/include/cfx_pathdata.h ('k') | core/fxge/include/cfx_substfont.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698