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

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

Issue 2060913003: Make code compile with clang_use_chrome_plugin (part II) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 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/fx_font.h ('k') | core/fxge/include/fx_ge_win32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 29
30 CFX_FontCache* GetFontCache(); 30 CFX_FontCache* GetFontCache();
31 CFX_FontMgr* GetFontMgr() { return m_pFontMgr; } 31 CFX_FontMgr* GetFontMgr() { return m_pFontMgr; }
32 void SetTextGamma(FX_FLOAT gammaValue); 32 void SetTextGamma(FX_FLOAT gammaValue);
33 const uint8_t* GetTextGammaTable(); 33 const uint8_t* GetTextGammaTable();
34 34
35 void SetCodecModule(CCodec_ModuleMgr* pCodecModule) { 35 void SetCodecModule(CCodec_ModuleMgr* pCodecModule) {
36 m_pCodecModule = pCodecModule; 36 m_pCodecModule = pCodecModule;
37 } 37 }
38 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } 38 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; }
39 void* GetPlatformData() { return m_pPlatformData; }
40
39 FXFT_Library m_FTLibrary; 41 FXFT_Library m_FTLibrary;
40 void* GetPlatformData() { return m_pPlatformData; }
41 42
42 protected: 43 protected:
43 explicit CFX_GEModule(const char** pUserFontPaths); 44 explicit CFX_GEModule(const char** pUserFontPaths);
44 ~CFX_GEModule(); 45 ~CFX_GEModule();
45 46
46 void InitPlatform(); 47 void InitPlatform();
47 void DestroyPlatform(); 48 void DestroyPlatform();
48 49
49 private: 50 private:
50 uint8_t m_GammaValue[256]; 51 uint8_t m_GammaValue[256];
(...skipping 13 matching lines...) Expand all
64 #define FXPT_CLOSEFIGURE 0x01 65 #define FXPT_CLOSEFIGURE 0x01
65 #define FXPT_LINETO 0x02 66 #define FXPT_LINETO 0x02
66 #define FXPT_BEZIERTO 0x04 67 #define FXPT_BEZIERTO 0x04
67 #define FXPT_MOVETO 0x06 68 #define FXPT_MOVETO 0x06
68 #define FXPT_TYPE 0x06 69 #define FXPT_TYPE 0x06
69 #define FXFILL_ALTERNATE 1 70 #define FXFILL_ALTERNATE 1
70 #define FXFILL_WINDING 2 71 #define FXFILL_WINDING 2
71 72
72 class CFX_ClipRgn { 73 class CFX_ClipRgn {
73 public: 74 public:
75 enum ClipType { RectI, MaskF };
76
74 CFX_ClipRgn(int device_width, int device_height); 77 CFX_ClipRgn(int device_width, int device_height);
75 explicit CFX_ClipRgn(const FX_RECT& rect); 78 explicit CFX_ClipRgn(const FX_RECT& rect);
76 CFX_ClipRgn(const CFX_ClipRgn& src); 79 CFX_ClipRgn(const CFX_ClipRgn& src);
77 ~CFX_ClipRgn(); 80 ~CFX_ClipRgn();
78 81
79 enum ClipType { RectI, MaskF };
80 void Reset(const FX_RECT& rect);
81 ClipType GetType() const { return m_Type; } 82 ClipType GetType() const { return m_Type; }
82 const FX_RECT& GetBox() const { return m_Box; } 83 const FX_RECT& GetBox() const { return m_Box; }
83 CFX_DIBitmapRef GetMask() const { return m_Mask; } 84 CFX_DIBitmapRef GetMask() const { return m_Mask; }
85
86 void Reset(const FX_RECT& rect);
84 void IntersectRect(const FX_RECT& rect); 87 void IntersectRect(const FX_RECT& rect);
85 void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask); 88 void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask);
86 89
87 protected: 90 protected:
88 void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); 91 void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask);
89 92
90 ClipType m_Type; 93 ClipType m_Type;
91 FX_RECT m_Box; 94 FX_RECT m_Box;
92 CFX_DIBitmapRef m_Mask; 95 CFX_DIBitmapRef m_Mask;
93 }; 96 };
94 97
95 class CFX_PathData { 98 class CFX_PathData {
96 public: 99 public:
97 CFX_PathData(); 100 CFX_PathData();
98 CFX_PathData(const CFX_PathData& src); 101 CFX_PathData(const CFX_PathData& src);
99 ~CFX_PathData(); 102 ~CFX_PathData();
100 103
101 int GetPointCount() const { return m_PointCount; } 104 int GetPointCount() const { return m_PointCount; }
102 int GetFlag(int index) const { return m_pPoints[index].m_Flag; } 105 int GetFlag(int index) const { return m_pPoints[index].m_Flag; }
103 FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; } 106 FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; }
104 FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; } 107 FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; }
105 FX_PATHPOINT* GetPoints() const { return m_pPoints; } 108 FX_PATHPOINT* GetPoints() const { return m_pPoints; }
109
106 void SetPointCount(int nPoints); 110 void SetPointCount(int nPoints);
107 void AllocPointCount(int nPoints); 111 void AllocPointCount(int nPoints);
108 void AddPointCount(int addPoints); 112 void AddPointCount(int addPoints);
109 CFX_FloatRect GetBoundingBox() const; 113 CFX_FloatRect GetBoundingBox() const;
110 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; 114 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
111 void Transform(const CFX_Matrix* pMatrix); 115 void Transform(const CFX_Matrix* pMatrix);
112 FX_BOOL IsRect() const; 116 FX_BOOL IsRect() const;
113 FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath, 117 FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath,
114 CFX_Matrix* pMatrix, 118 CFX_Matrix* pMatrix,
115 FX_BOOL& bThin, 119 FX_BOOL& bThin,
116 FX_BOOL bAdjust) const; 120 FX_BOOL bAdjust) const;
117 FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const; 121 FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const;
118 void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix); 122 void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix);
119 void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); 123 void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top);
120 void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag); 124 void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag);
121 void TrimPoints(int nPoints); 125 void TrimPoints(int nPoints);
122 void Copy(const CFX_PathData& src); 126 void Copy(const CFX_PathData& src);
123 127
124 protected: 128 protected:
125 friend class CPDF_Path; 129 friend class CPDF_Path;
126 130
127 int m_PointCount; 131 int m_PointCount;
128 FX_PATHPOINT* m_pPoints; 132 FX_PATHPOINT* m_pPoints;
129 int m_AllocCount; 133 int m_AllocCount;
130 }; 134 };
131 135
132 class CFX_GraphStateData { 136 class CFX_GraphStateData {
133 public: 137 public:
138 enum LineCap { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 };
139
134 CFX_GraphStateData(); 140 CFX_GraphStateData();
135 CFX_GraphStateData(const CFX_GraphStateData& src); 141 CFX_GraphStateData(const CFX_GraphStateData& src);
136 ~CFX_GraphStateData(); 142 ~CFX_GraphStateData();
137 143
138 void Copy(const CFX_GraphStateData& src); 144 void Copy(const CFX_GraphStateData& src);
139 void SetDashCount(int count); 145 void SetDashCount(int count);
140 146
141 enum LineCap { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 };
142 LineCap m_LineCap; 147 LineCap m_LineCap;
143 int m_DashCount; 148 int m_DashCount;
144 FX_FLOAT* m_DashArray; 149 FX_FLOAT* m_DashArray;
145 FX_FLOAT m_DashPhase; 150 FX_FLOAT m_DashPhase;
146 151
147 enum LineJoin { 152 enum LineJoin {
148 LineJoinMiter = 0, 153 LineJoinMiter = 0,
149 LineJoinRound = 1, 154 LineJoinRound = 1,
150 LineJoinBevel = 2, 155 LineJoinBevel = 2,
151 }; 156 };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 CFX_RenderDevice(); 214 CFX_RenderDevice();
210 virtual ~CFX_RenderDevice(); 215 virtual ~CFX_RenderDevice();
211 216
212 void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); 217 void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver);
213 IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } 218 IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; }
214 219
215 FX_BOOL StartRendering(); 220 FX_BOOL StartRendering();
216 void EndRendering(); 221 void EndRendering();
217 void SaveState(); 222 void SaveState();
218 void RestoreState(bool bKeepSaved); 223 void RestoreState(bool bKeepSaved);
224
219 int GetWidth() const { return m_Width; } 225 int GetWidth() const { return m_Width; }
220 int GetHeight() const { return m_Height; } 226 int GetHeight() const { return m_Height; }
221 int GetDeviceClass() const { return m_DeviceClass; } 227 int GetDeviceClass() const { return m_DeviceClass; }
222 int GetBPP() const { return m_bpp; } 228 int GetBPP() const { return m_bpp; }
223 int GetRenderCaps() const { return m_RenderCaps; } 229 int GetRenderCaps() const { return m_RenderCaps; }
224 int GetDeviceCaps(int id) const; 230 int GetDeviceCaps(int id) const;
225 CFX_Matrix GetCTM() const; 231 CFX_Matrix GetCTM() const;
226 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } 232 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; }
227 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } 233 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; }
228 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, 234 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 int blend_type); 307 int blend_type);
302 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, 308 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap,
303 int left, 309 int left,
304 int top, 310 int top,
305 uint32_t color); 311 uint32_t color);
306 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap, 312 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap,
307 int left, 313 int left,
308 int top, 314 int top,
309 int dest_width, 315 int dest_width,
310 int dest_height, 316 int dest_height,
311 uint32_t color) { 317 uint32_t color);
312 return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height,
313 color, 0);
314 }
315 FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, 318 FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
316 int left, 319 int left,
317 int top, 320 int top,
318 int dest_width, 321 int dest_width,
319 int dest_height, 322 int dest_height,
320 uint32_t color, 323 uint32_t color,
321 uint32_t flags); 324 uint32_t flags);
322 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, 325 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
323 int bitmap_alpha, 326 int bitmap_alpha,
324 uint32_t color, 327 uint32_t color,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 SkPictureRecorder* CreateRecorder(int size_x, int size_y); 417 SkPictureRecorder* CreateRecorder(int size_x, int size_y);
415 void PreMultiply(); 418 void PreMultiply();
416 #endif 419 #endif
417 420
418 protected: 421 protected:
419 bool m_bOwnedBitmap; 422 bool m_bOwnedBitmap;
420 }; 423 };
421 424
422 class IFX_RenderDeviceDriver { 425 class IFX_RenderDeviceDriver {
423 public: 426 public:
427 virtual ~IFX_RenderDeviceDriver();
428
424 static IFX_RenderDeviceDriver* CreateFxgeDriver(CFX_DIBitmap* pBitmap, 429 static IFX_RenderDeviceDriver* CreateFxgeDriver(CFX_DIBitmap* pBitmap,
425 FX_BOOL bRgbByteOrder, 430 FX_BOOL bRgbByteOrder,
426 CFX_DIBitmap* pOriDevice, 431 CFX_DIBitmap* pOriDevice,
427 FX_BOOL bGroupKnockout); 432 FX_BOOL bGroupKnockout);
428 433
429 virtual ~IFX_RenderDeviceDriver() {}
430 434
431 virtual int GetDeviceCaps(int caps_id) = 0; 435 virtual int GetDeviceCaps(int caps_id) = 0;
432 436
433 virtual CFX_Matrix GetCTM() const { return CFX_Matrix(); } 437 virtual CFX_Matrix GetCTM() const;
434 438
435 virtual FX_BOOL StartRendering() { return TRUE; } 439 virtual FX_BOOL StartRendering();
436 440 virtual void EndRendering();
437 virtual void EndRendering() {}
438
439 virtual void SaveState() = 0; 441 virtual void SaveState() = 0;
440
441 virtual void RestoreState(bool bKeepSaved) = 0; 442 virtual void RestoreState(bool bKeepSaved) = 0;
442 443
443 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, 444 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
444 const CFX_Matrix* pObject2Device, 445 const CFX_Matrix* pObject2Device,
445 int fill_mode) = 0; 446 int fill_mode) = 0;
446
447 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, 447 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
448 const CFX_Matrix* pObject2Device, 448 const CFX_Matrix* pObject2Device,
449 const CFX_GraphStateData* pGraphState) { 449 const CFX_GraphStateData* pGraphState);
450 return FALSE;
451 }
452
453 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, 450 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData,
454 const CFX_Matrix* pObject2Device, 451 const CFX_Matrix* pObject2Device,
455 const CFX_GraphStateData* pGraphState, 452 const CFX_GraphStateData* pGraphState,
456 uint32_t fill_color, 453 uint32_t fill_color,
457 uint32_t stroke_color, 454 uint32_t stroke_color,
458 int fill_mode, 455 int fill_mode,
459 int blend_type) = 0; 456 int blend_type) = 0;
460 457 virtual FX_BOOL SetPixel(int x, int y, uint32_t color);
461 virtual FX_BOOL SetPixel(int x, int y, uint32_t color) { return FALSE; }
462
463 virtual FX_BOOL FillRectWithBlend(const FX_RECT* pRect, 458 virtual FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
464 uint32_t fill_color, 459 uint32_t fill_color,
465 int blend_type) { 460 int blend_type);
466 return FALSE;
467 }
468
469 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, 461 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
470 FX_FLOAT y1, 462 FX_FLOAT y1,
471 FX_FLOAT x2, 463 FX_FLOAT x2,
472 FX_FLOAT y2, 464 FX_FLOAT y2,
473 uint32_t color, 465 uint32_t color,
474 int blend_type) { 466 int blend_type);
475 return FALSE;
476 }
477 467
478 virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0; 468 virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0;
479 469 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
480 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { 470 virtual CFX_DIBitmap* GetBackDrop();
481 return FALSE;
482 }
483 virtual CFX_DIBitmap* GetBackDrop() { return nullptr; }
484
485 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, 471 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
486 uint32_t color, 472 uint32_t color,
487 const FX_RECT* pSrcRect, 473 const FX_RECT* pSrcRect,
488 int dest_left, 474 int dest_left,
489 int dest_top, 475 int dest_top,
490 int blend_type) = 0; 476 int blend_type) = 0;
491
492 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, 477 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
493 uint32_t color, 478 uint32_t color,
494 int dest_left, 479 int dest_left,
495 int dest_top, 480 int dest_top,
496 int dest_width, 481 int dest_width,
497 int dest_height, 482 int dest_height,
498 const FX_RECT* pClipRect, 483 const FX_RECT* pClipRect,
499 uint32_t flags, 484 uint32_t flags,
500 int blend_type) = 0; 485 int blend_type) = 0;
501
502 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, 486 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
503 int bitmap_alpha, 487 int bitmap_alpha,
504 uint32_t color, 488 uint32_t color,
505 const CFX_Matrix* pMatrix, 489 const CFX_Matrix* pMatrix,
506 uint32_t flags, 490 uint32_t flags,
507 void*& handle, 491 void*& handle,
508 int blend_type) = 0; 492 int blend_type) = 0;
509 493 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
510 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { 494 virtual void CancelDIBits(void* handle);
511 return FALSE;
512 }
513
514 virtual void CancelDIBits(void* handle) {}
515
516 virtual FX_BOOL DrawDeviceText(int nChars, 495 virtual FX_BOOL DrawDeviceText(int nChars,
517 const FXTEXT_CHARPOS* pCharPos, 496 const FXTEXT_CHARPOS* pCharPos,
518 CFX_Font* pFont, 497 CFX_Font* pFont,
519 CFX_FontCache* pCache, 498 CFX_FontCache* pCache,
520 const CFX_Matrix* pObject2Device, 499 const CFX_Matrix* pObject2Device,
521 FX_FLOAT font_size, 500 FX_FLOAT font_size,
522 uint32_t color) { 501 uint32_t color);
523 return FALSE; 502 virtual void* GetPlatformSurface() const;
524 } 503 virtual int GetDriverType() const;
525 504 virtual void ClearDriver();
526 virtual void* GetPlatformSurface() const { return nullptr; }
527 virtual int GetDriverType() const { return 0; }
528 virtual void ClearDriver() {}
529
530 virtual FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern, 505 virtual FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern,
531 const CFX_Matrix* pMatrix, 506 const CFX_Matrix* pMatrix,
532 const FX_RECT& clip_rect, 507 const FX_RECT& clip_rect,
533 int alpha, 508 int alpha,
534 FX_BOOL bAlphaMode) { 509 FX_BOOL bAlphaMode);
535 return false;
536 }
537 }; 510 };
538 511
539 #endif // CORE_FXGE_INCLUDE_FX_GE_H_ 512 #endif // CORE_FXGE_INCLUDE_FX_GE_H_
OLDNEW
« no previous file with comments | « core/fxge/include/fx_font.h ('k') | core/fxge/include/fx_ge_win32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698