OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_ | 7 #ifndef CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_ |
8 #define CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_ | 8 #define CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 public: | 84 public: |
85 CFX_RenderDevice(); | 85 CFX_RenderDevice(); |
86 virtual ~CFX_RenderDevice(); | 86 virtual ~CFX_RenderDevice(); |
87 | 87 |
88 // Take ownership of |pDriver|. | 88 // Take ownership of |pDriver|. |
89 void SetDeviceDriver(std::unique_ptr<IFX_RenderDeviceDriver> pDriver); | 89 void SetDeviceDriver(std::unique_ptr<IFX_RenderDeviceDriver> pDriver); |
90 IFX_RenderDeviceDriver* GetDeviceDriver() const { | 90 IFX_RenderDeviceDriver* GetDeviceDriver() const { |
91 return m_pDeviceDriver.get(); | 91 return m_pDeviceDriver.get(); |
92 } | 92 } |
93 | 93 |
94 FX_BOOL StartRendering(); | |
95 void EndRendering(); | |
96 void SaveState(); | 94 void SaveState(); |
97 void RestoreState(bool bKeepSaved); | 95 void RestoreState(bool bKeepSaved); |
98 | 96 |
99 int GetWidth() const { return m_Width; } | 97 int GetWidth() const { return m_Width; } |
100 int GetHeight() const { return m_Height; } | 98 int GetHeight() const { return m_Height; } |
101 int GetDeviceClass() const { return m_DeviceClass; } | 99 int GetDeviceClass() const { return m_DeviceClass; } |
102 int GetBPP() const { return m_bpp; } | |
103 int GetRenderCaps() const { return m_RenderCaps; } | 100 int GetRenderCaps() const { return m_RenderCaps; } |
104 int GetDeviceCaps(int id) const; | 101 int GetDeviceCaps(int id) const; |
105 CFX_Matrix GetCTM() const; | 102 CFX_Matrix GetCTM() const; |
106 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } | 103 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } |
107 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } | 104 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } |
108 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, | 105 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, |
109 int width, | 106 int width, |
110 int height) const; | 107 int height) const; |
111 const FX_RECT& GetClipBox() const { return m_ClipBox; } | 108 const FX_RECT& GetClipBox() const { return m_ClipBox; } |
112 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | 109 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
(...skipping 20 matching lines...) Expand all Loading... |
133 int fill_mode, | 130 int fill_mode, |
134 int blend_type); | 131 int blend_type); |
135 FX_BOOL SetPixel(int x, int y, uint32_t color); | 132 FX_BOOL SetPixel(int x, int y, uint32_t color); |
136 FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) { | 133 FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) { |
137 return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); | 134 return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); |
138 } | 135 } |
139 FX_BOOL FillRectWithBlend(const FX_RECT* pRect, | 136 FX_BOOL FillRectWithBlend(const FX_RECT* pRect, |
140 uint32_t color, | 137 uint32_t color, |
141 int blend_type); | 138 int blend_type); |
142 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | 139 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, |
143 FX_FLOAT y1, | |
144 FX_FLOAT x2, | |
145 FX_FLOAT y2, | |
146 uint32_t color) { | |
147 return DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, color, 0, | |
148 FXDIB_BLEND_NORMAL); | |
149 } | |
150 FX_BOOL DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1, | |
151 FX_FLOAT y1, | 140 FX_FLOAT y1, |
152 FX_FLOAT x2, | 141 FX_FLOAT x2, |
153 FX_FLOAT y2, | 142 FX_FLOAT y2, |
154 uint32_t color, | 143 uint32_t color, |
155 int fill_mode, | 144 int fill_mode, |
156 int blend_type); | 145 int blend_type); |
157 | 146 |
158 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top); | 147 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top); |
159 CFX_DIBitmap* GetBackDrop(); | 148 CFX_DIBitmap* GetBackDrop(); |
160 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) { | 149 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 206 |
218 FX_BOOL DrawNormalText(int nChars, | 207 FX_BOOL DrawNormalText(int nChars, |
219 const FXTEXT_CHARPOS* pCharPos, | 208 const FXTEXT_CHARPOS* pCharPos, |
220 CFX_Font* pFont, | 209 CFX_Font* pFont, |
221 CFX_FontCache* pCache, | 210 CFX_FontCache* pCache, |
222 FX_FLOAT font_size, | 211 FX_FLOAT font_size, |
223 const CFX_Matrix* pText2Device, | 212 const CFX_Matrix* pText2Device, |
224 uint32_t fill_color, | 213 uint32_t fill_color, |
225 uint32_t text_flags); | 214 uint32_t text_flags); |
226 FX_BOOL DrawTextPath(int nChars, | 215 FX_BOOL DrawTextPath(int nChars, |
227 const FXTEXT_CHARPOS* pCharPos, | |
228 CFX_Font* pFont, | |
229 CFX_FontCache* pCache, | |
230 FX_FLOAT font_size, | |
231 const CFX_Matrix* pText2User, | |
232 const CFX_Matrix* pUser2Device, | |
233 const CFX_GraphStateData* pGraphState, | |
234 uint32_t fill_color, | |
235 uint32_t stroke_color, | |
236 CFX_PathData* pClippingPath) { | |
237 return DrawTextPathWithFlags(nChars, pCharPos, pFont, pCache, font_size, | |
238 pText2User, pUser2Device, pGraphState, | |
239 fill_color, stroke_color, pClippingPath, 0); | |
240 } | |
241 FX_BOOL DrawTextPathWithFlags(int nChars, | |
242 const FXTEXT_CHARPOS* pCharPos, | 216 const FXTEXT_CHARPOS* pCharPos, |
243 CFX_Font* pFont, | 217 CFX_Font* pFont, |
244 CFX_FontCache* pCache, | 218 CFX_FontCache* pCache, |
245 FX_FLOAT font_size, | 219 FX_FLOAT font_size, |
246 const CFX_Matrix* pText2User, | 220 const CFX_Matrix* pText2User, |
247 const CFX_Matrix* pUser2Device, | 221 const CFX_Matrix* pUser2Device, |
248 const CFX_GraphStateData* pGraphState, | 222 const CFX_GraphStateData* pGraphState, |
249 uint32_t fill_color, | 223 uint32_t fill_color, |
250 uint32_t stroke_color, | 224 uint32_t stroke_color, |
251 CFX_PathData* pClippingPath, | 225 CFX_PathData* pClippingPath, |
(...skipping 25 matching lines...) Expand all Loading... |
277 int m_Width; | 251 int m_Width; |
278 int m_Height; | 252 int m_Height; |
279 int m_bpp; | 253 int m_bpp; |
280 int m_RenderCaps; | 254 int m_RenderCaps; |
281 int m_DeviceClass; | 255 int m_DeviceClass; |
282 FX_RECT m_ClipBox; | 256 FX_RECT m_ClipBox; |
283 std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver; | 257 std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver; |
284 }; | 258 }; |
285 | 259 |
286 #endif // CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_ | 260 #endif // CORE_FXGE_INCLUDE_CFX_RENDERDEVICE_H_ |
OLD | NEW |