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_APPLE_APPLE_INT_H_ | 7 #ifndef CORE_FXGE_APPLE_APPLE_INT_H_ |
8 #define CORE_FXGE_APPLE_APPLE_INT_H_ | 8 #define CORE_FXGE_APPLE_APPLE_INT_H_ |
9 | 9 |
10 #include "core/fxcrt/fx_system.h" | 10 #include "core/fxcrt/fx_system.h" |
11 | 11 |
12 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | |
13 | |
14 #include "core/fxge/cfx_graphstatedata.h" | 12 #include "core/fxge/cfx_graphstatedata.h" |
15 #include "core/fxge/cfx_pathdata.h" | 13 #include "core/fxge/cfx_pathdata.h" |
16 #include "core/fxge/cfx_renderdevice.h" | 14 #include "core/fxge/cfx_renderdevice.h" |
17 #include "core/fxge/fx_dib.h" | 15 #include "core/fxge/fx_dib.h" |
18 #include "core/fxge/ifx_renderdevicedriver.h" | 16 #include "core/fxge/ifx_renderdevicedriver.h" |
19 | 17 |
20 #if _FX_OS_ == _FX_MACOSX_ | |
npm
2016/11/07 16:02:38
Also removing this as it looks like its equivalent
| |
21 #include <Carbon/Carbon.h> | 18 #include <Carbon/Carbon.h> |
22 #endif | |
23 | 19 |
24 class CQuartz2D { | 20 class CQuartz2D { |
25 public: | 21 public: |
26 void* createGraphics(CFX_DIBitmap* bitmap); | 22 void* createGraphics(CFX_DIBitmap* bitmap); |
27 void destroyGraphics(void* graphics); | 23 void destroyGraphics(void* graphics); |
28 | 24 |
29 void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); | 25 void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); |
30 void DestroyFont(void* pFont); | 26 void DestroyFont(void* pFont); |
31 void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix); | 27 void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix); |
32 bool drawGraphicsString(void* graphics, | 28 bool drawGraphicsString(void* graphics, |
33 void* font, | 29 void* font, |
34 FX_FLOAT fontSize, | 30 FX_FLOAT fontSize, |
35 uint16_t* glyphIndices, | 31 uint16_t* glyphIndices, |
36 CGPoint* glyphPositions, | 32 CGPoint* glyphPositions, |
37 int32_t chars, | 33 int32_t chars, |
38 FX_ARGB argb, | 34 FX_ARGB argb, |
39 CFX_Matrix* matrix = nullptr); | 35 CFX_Matrix* matrix = nullptr); |
40 void saveGraphicsState(void* graphics); | 36 void saveGraphicsState(void* graphics); |
41 void restoreGraphicsState(void* graphics); | 37 void restoreGraphicsState(void* graphics); |
42 }; | 38 }; |
43 | 39 |
44 class CApplePlatform { | 40 class CApplePlatform { |
45 public: | 41 public: |
46 CApplePlatform() {} | 42 CApplePlatform() {} |
47 ~CApplePlatform() {} | 43 ~CApplePlatform() {} |
48 | 44 |
49 CQuartz2D m_quartz2d; | 45 CQuartz2D m_quartz2d; |
50 }; | 46 }; |
51 | 47 |
52 class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { | |
53 public: | |
54 CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); | |
55 ~CFX_QuartzDeviceDriver() override; | |
56 | |
57 // IFX_RenderDeviceDriver | |
58 int GetDeviceCaps(int caps_id) const override; | |
59 CFX_Matrix GetCTM() const override; | |
60 void SaveState() override; | |
61 void RestoreState(bool bKeepSaved) override; | |
62 bool SetClip_PathFill(const CFX_PathData* pPathData, | |
63 const CFX_Matrix* pObject2Device, | |
64 int fill_mode) override; | |
65 bool SetClip_PathStroke(const CFX_PathData* pPathData, | |
66 const CFX_Matrix* pObject2Device, | |
67 const CFX_GraphStateData* pGraphState) override; | |
68 bool DrawPath(const CFX_PathData* pPathData, | |
69 const CFX_Matrix* pObject2Device, | |
70 const CFX_GraphStateData* pGraphState, | |
71 uint32_t fill_color, | |
72 uint32_t stroke_color, | |
73 int fill_mode, | |
74 int blend_type) override; | |
75 bool FillRectWithBlend(const FX_RECT* pRect, | |
76 uint32_t fill_color, | |
77 int blend_type) override; | |
78 bool DrawCosmeticLine(FX_FLOAT x1, | |
79 FX_FLOAT y1, | |
80 FX_FLOAT x2, | |
81 FX_FLOAT y2, | |
82 uint32_t color, | |
83 int blend_type) override; | |
84 bool GetClipBox(FX_RECT* pRect) override; | |
85 bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; | |
86 bool SetDIBits(const CFX_DIBSource* pBitmap, | |
87 uint32_t color, | |
88 const FX_RECT* pSrcRect, | |
89 int dest_left, | |
90 int dest_top, | |
91 int blend_type) override; | |
92 bool StretchDIBits(const CFX_DIBSource* pBitmap, | |
93 uint32_t color, | |
94 int dest_left, | |
95 int dest_top, | |
96 int dest_width, | |
97 int dest_height, | |
98 const FX_RECT* pClipRect, | |
99 uint32_t flags, | |
100 int blend_type) override; | |
101 bool StartDIBits(const CFX_DIBSource* pBitmap, | |
102 int bitmap_alpha, | |
103 uint32_t color, | |
104 const CFX_Matrix* pMatrix, | |
105 uint32_t flags, | |
106 void*& handle, | |
107 int blend_type) override; | |
108 bool DrawDeviceText(int nChars, | |
109 const FXTEXT_CHARPOS* pCharPos, | |
110 CFX_Font* pFont, | |
111 const CFX_Matrix* pObject2Device, | |
112 FX_FLOAT font_size, | |
113 uint32_t color) override; | |
114 void ClearDriver() override; | |
115 | |
116 protected: | |
117 void setStrokeInfo(const CFX_GraphStateData* graphState, | |
118 FX_ARGB argb, | |
119 FX_FLOAT lineWidth); | |
120 void setFillInfo(FX_ARGB argb); | |
121 void setPathToContext(const CFX_PathData* pathData); | |
122 FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState, | |
123 CGAffineTransform ctm); | |
124 bool CG_DrawGlyphRun(int nChars, | |
125 const FXTEXT_CHARPOS* pCharPos, | |
126 CFX_Font* pFont, | |
127 const CFX_Matrix* pGlyphMatrix, | |
128 const CFX_Matrix* pObject2Device, | |
129 FX_FLOAT font_size, | |
130 uint32_t argb); | |
131 void CG_SetImageTransform(int dest_left, | |
132 int dest_top, | |
133 int dest_width, | |
134 int dest_height, | |
135 CGRect* rect); | |
136 | |
137 CGContextRef m_context; | |
138 CGAffineTransform m_foxitDevice2User; | |
139 CGAffineTransform m_user2FoxitDevice; | |
140 int32_t m_saveCount; | |
141 | |
142 int32_t m_width; | |
143 int32_t m_height; | |
144 int32_t m_bitsPerPixel; | |
145 int32_t m_deviceClass; | |
146 int32_t m_renderCaps; | |
147 int32_t m_horzSize; | |
148 int32_t m_vertSize; | |
149 }; | |
150 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | |
151 | |
152 #endif // CORE_FXGE_APPLE_APPLE_INT_H_ | 48 #endif // CORE_FXGE_APPLE_APPLE_INT_H_ |
OLD | NEW |