OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_FX_GE_H_ | 7 #ifndef CORE_FXGE_INCLUDE_FX_GE_H_ |
8 #define CORE_FXGE_INCLUDE_FX_GE_H_ | 8 #define CORE_FXGE_INCLUDE_FX_GE_H_ |
9 | 9 |
10 #include "core/fxge/include/fx_dib.h" | 10 #include "core/fxge/include/fx_dib.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 CFX_RenderDevice(); | 210 CFX_RenderDevice(); |
211 virtual ~CFX_RenderDevice(); | 211 virtual ~CFX_RenderDevice(); |
212 | 212 |
213 void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); | 213 void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); |
214 IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } | 214 IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } |
215 | 215 |
216 FX_BOOL StartRendering(); | 216 FX_BOOL StartRendering(); |
217 void EndRendering(); | 217 void EndRendering(); |
218 void SaveState(); | 218 void SaveState(); |
219 void RestoreState(bool bKeepSaved); | 219 void RestoreState(bool bKeepSaved); |
220 | |
221 int GetWidth() const { return m_Width; } | 220 int GetWidth() const { return m_Width; } |
222 int GetHeight() const { return m_Height; } | 221 int GetHeight() const { return m_Height; } |
223 int GetDeviceClass() const { return m_DeviceClass; } | 222 int GetDeviceClass() const { return m_DeviceClass; } |
224 int GetBPP() const { return m_bpp; } | 223 int GetBPP() const { return m_bpp; } |
225 int GetRenderCaps() const { return m_RenderCaps; } | 224 int GetRenderCaps() const { return m_RenderCaps; } |
226 int GetDeviceCaps(int id) const; | 225 int GetDeviceCaps(int id) const; |
227 CFX_Matrix GetCTM() const; | 226 CFX_Matrix GetCTM() const; |
228 | |
229 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } | 227 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } |
230 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } | 228 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } |
231 | |
232 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, | 229 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, |
233 int width, | 230 int width, |
234 int height) const; | 231 int height) const; |
235 | |
236 const FX_RECT& GetClipBox() const { return m_ClipBox; } | 232 const FX_RECT& GetClipBox() const { return m_ClipBox; } |
237 | |
238 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | 233 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
239 const CFX_Matrix* pObject2Device, | 234 const CFX_Matrix* pObject2Device, |
240 int fill_mode); | 235 int fill_mode); |
241 | |
242 FX_BOOL SetClip_Rect(const FX_RECT& pRect); | 236 FX_BOOL SetClip_Rect(const FX_RECT& pRect); |
243 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | 237 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
244 const CFX_Matrix* pObject2Device, | 238 const CFX_Matrix* pObject2Device, |
245 const CFX_GraphStateData* pGraphState); | 239 const CFX_GraphStateData* pGraphState); |
246 | |
247 FX_BOOL DrawPath(const CFX_PathData* pPathData, | 240 FX_BOOL DrawPath(const CFX_PathData* pPathData, |
248 const CFX_Matrix* pObject2Device, | 241 const CFX_Matrix* pObject2Device, |
249 const CFX_GraphStateData* pGraphState, | 242 const CFX_GraphStateData* pGraphState, |
250 uint32_t fill_color, | 243 uint32_t fill_color, |
251 uint32_t stroke_color, | 244 uint32_t stroke_color, |
252 int fill_mode, | 245 int fill_mode) { |
253 int alpha_flag = 0, | 246 return DrawPathWithBlend(pPathData, pObject2Device, pGraphState, fill_color, |
254 void* pIccTransform = NULL, | 247 stroke_color, fill_mode, FXDIB_BLEND_NORMAL); |
255 int blend_type = FXDIB_BLEND_NORMAL); | 248 } |
256 | 249 FX_BOOL DrawPathWithBlend(const CFX_PathData* pPathData, |
257 FX_BOOL SetPixel(int x, | 250 const CFX_Matrix* pObject2Device, |
258 int y, | 251 const CFX_GraphStateData* pGraphState, |
259 uint32_t color, | 252 uint32_t fill_color, |
260 int alpha_flag = 0, | 253 uint32_t stroke_color, |
261 void* pIccTransform = NULL); | 254 int fill_mode, |
262 | 255 int blend_type); |
263 FX_BOOL FillRect(const FX_RECT* pRect, | 256 FX_BOOL SetPixel(int x, int y, uint32_t color); |
264 uint32_t color, | 257 FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) { |
265 int alpha_flag = 0, | 258 return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); |
266 void* pIccTransform = NULL, | 259 } |
267 int blend_type = FXDIB_BLEND_NORMAL); | 260 FX_BOOL FillRectWithBlend(const FX_RECT* pRect, |
268 | 261 uint32_t color, |
| 262 int blend_type); |
269 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | 263 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, |
270 FX_FLOAT y1, | 264 FX_FLOAT y1, |
271 FX_FLOAT x2, | 265 FX_FLOAT x2, |
272 FX_FLOAT y2, | 266 FX_FLOAT y2, |
273 uint32_t color, | 267 uint32_t color) { |
274 int fill_mode = 0, | 268 return DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, color, 0, |
275 int alpha_flag = 0, | 269 FXDIB_BLEND_NORMAL); |
276 void* pIccTransform = NULL, | 270 } |
277 int blend_type = FXDIB_BLEND_NORMAL); | 271 FX_BOOL DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1, |
| 272 FX_FLOAT y1, |
| 273 FX_FLOAT x2, |
| 274 FX_FLOAT y2, |
| 275 uint32_t color, |
| 276 int fill_mode, |
| 277 int blend_type); |
278 | 278 |
279 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, | 279 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top); |
280 int left, | |
281 int top, | |
282 void* pIccTransform = NULL); | |
283 | |
284 CFX_DIBitmap* GetBackDrop(); | 280 CFX_DIBitmap* GetBackDrop(); |
285 | 281 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) { |
286 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, | 282 return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL); |
287 int left, | 283 } |
288 int top, | 284 FX_BOOL SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, |
289 int blend_type = FXDIB_BLEND_NORMAL, | 285 int left, |
290 void* pIccTransform = NULL); | 286 int top, |
291 | 287 int blend_type); |
292 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | 288 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, |
293 int left, | 289 int left, |
294 int top, | 290 int top, |
295 int dest_width, | 291 int dest_width, |
296 int dest_height, | 292 int dest_height) { |
297 uint32_t flags = 0, | 293 return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width, |
298 void* pIccTransform = NULL, | 294 dest_height, 0, FXDIB_BLEND_NORMAL); |
299 int blend_type = FXDIB_BLEND_NORMAL); | 295 } |
300 | 296 FX_BOOL StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap, |
| 297 int left, |
| 298 int top, |
| 299 int dest_width, |
| 300 int dest_height, |
| 301 uint32_t flags, |
| 302 int blend_type); |
301 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, | 303 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, |
302 int left, | 304 int left, |
303 int top, | 305 int top, |
304 uint32_t color, | 306 uint32_t color); |
305 int alpha_flag = 0, | |
306 void* pIccTransform = NULL); | |
307 | |
308 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap, | 307 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap, |
309 int left, | 308 int left, |
310 int top, | 309 int top, |
311 int dest_width, | 310 int dest_width, |
312 int dest_height, | 311 int dest_height, |
313 uint32_t color, | 312 uint32_t color) { |
314 uint32_t flags = 0, | 313 return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height, |
315 int alpha_flag = 0, | 314 color, 0); |
316 void* pIccTransform = NULL); | 315 } |
317 | 316 FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, |
| 317 int left, |
| 318 int top, |
| 319 int dest_width, |
| 320 int dest_height, |
| 321 uint32_t color, |
| 322 uint32_t flags); |
318 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | 323 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, |
319 int bitmap_alpha, | 324 int bitmap_alpha, |
320 uint32_t color, | 325 uint32_t color, |
321 const CFX_Matrix* pMatrix, | 326 const CFX_Matrix* pMatrix, |
322 uint32_t flags, | 327 uint32_t flags, |
323 void*& handle, | 328 void*& handle) { |
324 int alpha_flag = 0, | 329 return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags, |
325 void* pIccTransform = NULL, | 330 handle, FXDIB_BLEND_NORMAL); |
326 int blend_type = FXDIB_BLEND_NORMAL); | 331 } |
327 | 332 FX_BOOL StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, |
| 333 int bitmap_alpha, |
| 334 uint32_t color, |
| 335 const CFX_Matrix* pMatrix, |
| 336 uint32_t flags, |
| 337 void*& handle, |
| 338 int blend_type); |
328 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); | 339 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); |
329 | |
330 void CancelDIBits(void* handle); | 340 void CancelDIBits(void* handle); |
331 | 341 |
332 FX_BOOL DrawNormalText(int nChars, | 342 FX_BOOL DrawNormalText(int nChars, |
333 const FXTEXT_CHARPOS* pCharPos, | 343 const FXTEXT_CHARPOS* pCharPos, |
334 CFX_Font* pFont, | 344 CFX_Font* pFont, |
335 CFX_FontCache* pCache, | 345 CFX_FontCache* pCache, |
336 FX_FLOAT font_size, | 346 FX_FLOAT font_size, |
337 const CFX_Matrix* pText2Device, | 347 const CFX_Matrix* pText2Device, |
338 uint32_t fill_color, | 348 uint32_t fill_color, |
339 uint32_t text_flags, | 349 uint32_t text_flags); |
340 int alpha_flag = 0, | |
341 void* pIccTransform = NULL); | |
342 | |
343 FX_BOOL DrawTextPath(int nChars, | 350 FX_BOOL DrawTextPath(int nChars, |
344 const FXTEXT_CHARPOS* pCharPos, | 351 const FXTEXT_CHARPOS* pCharPos, |
345 CFX_Font* pFont, | 352 CFX_Font* pFont, |
346 CFX_FontCache* pCache, | 353 CFX_FontCache* pCache, |
347 FX_FLOAT font_size, | 354 FX_FLOAT font_size, |
348 const CFX_Matrix* pText2User, | 355 const CFX_Matrix* pText2User, |
349 const CFX_Matrix* pUser2Device, | 356 const CFX_Matrix* pUser2Device, |
350 const CFX_GraphStateData* pGraphState, | 357 const CFX_GraphStateData* pGraphState, |
351 uint32_t fill_color, | 358 uint32_t fill_color, |
352 uint32_t stroke_color, | 359 uint32_t stroke_color, |
353 CFX_PathData* pClippingPath, | 360 CFX_PathData* pClippingPath) { |
354 int nFlag = 0, | 361 return DrawTextPathWithFlags(nChars, pCharPos, pFont, pCache, font_size, |
355 int alpha_flag = 0, | 362 pText2User, pUser2Device, pGraphState, |
356 void* pIccTransform = NULL, | 363 fill_color, stroke_color, pClippingPath, 0); |
357 int blend_type = FXDIB_BLEND_NORMAL); | 364 } |
358 virtual void Begin() {} | 365 FX_BOOL DrawTextPathWithFlags(int nChars, |
359 virtual void End() {} | 366 const FXTEXT_CHARPOS* pCharPos, |
| 367 CFX_Font* pFont, |
| 368 CFX_FontCache* pCache, |
| 369 FX_FLOAT font_size, |
| 370 const CFX_Matrix* pText2User, |
| 371 const CFX_Matrix* pUser2Device, |
| 372 const CFX_GraphStateData* pGraphState, |
| 373 uint32_t fill_color, |
| 374 uint32_t stroke_color, |
| 375 CFX_PathData* pClippingPath, |
| 376 int nFlag); |
360 | 377 |
361 private: | 378 private: |
362 void InitDeviceInfo(); | 379 void InitDeviceInfo(); |
363 void UpdateClipBox(); | 380 void UpdateClipBox(); |
364 FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData, | 381 FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData, |
365 const CFX_Matrix* pObject2Device, | 382 const CFX_Matrix* pObject2Device, |
366 const CFX_GraphStateData* pGraphState, | 383 const CFX_GraphStateData* pGraphState, |
367 uint32_t fill_color, | 384 uint32_t fill_color, |
368 uint32_t stroke_color, | 385 uint32_t stroke_color, |
369 int fill_mode, | 386 int fill_mode, |
370 int alpha_flag, | |
371 void* pIccTransform, | |
372 int blend_type); | 387 int blend_type); |
373 | 388 |
374 CFX_DIBitmap* m_pBitmap; | 389 CFX_DIBitmap* m_pBitmap; |
375 int m_Width; | 390 int m_Width; |
376 int m_Height; | 391 int m_Height; |
377 int m_bpp; | 392 int m_bpp; |
378 int m_RenderCaps; | 393 int m_RenderCaps; |
379 int m_DeviceClass; | 394 int m_DeviceClass; |
380 FX_RECT m_ClipBox; | 395 FX_RECT m_ClipBox; |
381 IFX_RenderDeviceDriver* m_pDeviceDriver; | 396 IFX_RenderDeviceDriver* m_pDeviceDriver; |
(...skipping 27 matching lines...) Expand all Loading... |
409 | 424 |
410 class IFX_RenderDeviceDriver { | 425 class IFX_RenderDeviceDriver { |
411 public: | 426 public: |
412 static IFX_RenderDeviceDriver* CreateFxgeDriver( | 427 static IFX_RenderDeviceDriver* CreateFxgeDriver( |
413 CFX_DIBitmap* pBitmap, | 428 CFX_DIBitmap* pBitmap, |
414 FX_BOOL bRgbByteOrder = FALSE, | 429 FX_BOOL bRgbByteOrder = FALSE, |
415 CFX_DIBitmap* pOriDevice = NULL, | 430 CFX_DIBitmap* pOriDevice = NULL, |
416 FX_BOOL bGroupKnockout = FALSE); | 431 FX_BOOL bGroupKnockout = FALSE); |
417 | 432 |
418 virtual ~IFX_RenderDeviceDriver() {} | 433 virtual ~IFX_RenderDeviceDriver() {} |
419 virtual void Begin() {} | |
420 virtual void End() {} | |
421 | 434 |
422 virtual int GetDeviceCaps(int caps_id) = 0; | 435 virtual int GetDeviceCaps(int caps_id) = 0; |
423 | 436 |
424 virtual CFX_Matrix GetCTM() const { return CFX_Matrix(); } | 437 virtual CFX_Matrix GetCTM() const { return CFX_Matrix(); } |
425 | 438 |
426 virtual FX_BOOL IsPSPrintDriver() { return FALSE; } | 439 virtual FX_BOOL IsPSPrintDriver() { return FALSE; } |
427 | 440 |
428 virtual FX_BOOL StartRendering() { return TRUE; } | 441 virtual FX_BOOL StartRendering() { return TRUE; } |
429 | 442 |
430 virtual void EndRendering() {} | 443 virtual void EndRendering() {} |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 FX_BOOL m_bCmykOutput; | 654 FX_BOOL m_bCmykOutput; |
642 FX_BOOL m_bColorSet; | 655 FX_BOOL m_bColorSet; |
643 uint32_t m_LastColor; | 656 uint32_t m_LastColor; |
644 FX_RECT m_ClipBox; | 657 FX_RECT m_ClipBox; |
645 CFX_ArrayTemplate<CPSFont*> m_PSFontList; | 658 CFX_ArrayTemplate<CPSFont*> m_PSFontList; |
646 CFX_ArrayTemplate<FX_RECT> m_ClipBoxStack; | 659 CFX_ArrayTemplate<FX_RECT> m_ClipBoxStack; |
647 FX_BOOL m_bInited; | 660 FX_BOOL m_bInited; |
648 }; | 661 }; |
649 | 662 |
650 #endif // CORE_FXGE_INCLUDE_FX_GE_H_ | 663 #endif // CORE_FXGE_INCLUDE_FX_GE_H_ |
OLD | NEW |