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_SRC_FXGE_APPLE_APPLE_INT_H_ | 7 #ifndef CORE_SRC_FXGE_APPLE_APPLE_INT_H_ |
8 #define CORE_SRC_FXGE_APPLE_APPLE_INT_H_ | 8 #define CORE_SRC_FXGE_APPLE_APPLE_INT_H_ |
9 | 9 |
10 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 10 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 11 |
| 12 #include "../../../include/fxge/fx_ge.h" |
| 13 |
11 #if _FX_OS_ == _FX_MACOSX_ | 14 #if _FX_OS_ == _FX_MACOSX_ |
12 #include <Carbon/Carbon.h> | 15 #include <Carbon/Carbon.h> |
13 #endif | 16 #endif |
| 17 |
14 typedef enum eFXIOSFONTCHARSET { | 18 typedef enum eFXIOSFONTCHARSET { |
15 eFXFontCharsetDEFAULT = 0, | 19 eFXFontCharsetDEFAULT = 0, |
16 eFXFontCharsetANSI = 1, | 20 eFXFontCharsetANSI = 1, |
17 eFXFontCharsetSYMBOL = 1 << 1, | 21 eFXFontCharsetSYMBOL = 1 << 1, |
18 eFXFontCharsetSHIFTJIS = 1 << 2, | 22 eFXFontCharsetSHIFTJIS = 1 << 2, |
19 eFXFontCharsetHANGEUL = 1 << 3, | 23 eFXFontCharsetHANGEUL = 1 << 3, |
20 eFXFontCharsetGB2312 = 1 << 4, | 24 eFXFontCharsetGB2312 = 1 << 4, |
21 eFXFontCharsetCHINESEBIG5 = 1 << 5, | 25 eFXFontCharsetCHINESEBIG5 = 1 << 5, |
22 eFXFontCharsetTHAI = 1 << 6, | 26 eFXFontCharsetTHAI = 1 << 6, |
23 eFXFontCharsetEASTEUROPE = 1 << 7, | 27 eFXFontCharsetEASTEUROPE = 1 << 7, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void saveGraphicsState(void* graphics); | 65 void saveGraphicsState(void* graphics); |
62 void restoreGraphicsState(void* graphics); | 66 void restoreGraphicsState(void* graphics); |
63 }; | 67 }; |
64 class CApplePlatform { | 68 class CApplePlatform { |
65 public: | 69 public: |
66 CApplePlatform() {} | 70 CApplePlatform() {} |
67 ~CApplePlatform() {} | 71 ~CApplePlatform() {} |
68 | 72 |
69 CQuartz2D _quartz2d; | 73 CQuartz2D _quartz2d; |
70 }; | 74 }; |
| 75 |
71 class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { | 76 class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { |
72 public: | 77 public: |
73 CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); | 78 CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); |
74 virtual ~CFX_QuartzDeviceDriver(); | 79 ~CFX_QuartzDeviceDriver() override; |
75 | 80 |
76 virtual int GetDeviceCaps(int caps_id); | 81 // IFX_RenderDeviceDriver |
77 virtual CFX_Matrix GetCTM() const; | 82 int GetDeviceCaps(int caps_id) override; |
78 virtual CFX_DIBitmap* GetBackDrop() { return NULL; } | 83 CFX_Matrix GetCTM() const override; |
79 virtual void* GetPlatformSurface() { return NULL; } | 84 FX_BOOL IsPSPrintDriver() override { return FALSE; } |
80 virtual FX_BOOL IsPSPrintDriver() { return FALSE; } | 85 FX_BOOL StartRendering() override { return TRUE; } |
81 virtual FX_BOOL StartRendering() { return TRUE; } | 86 void EndRendering() override {} |
82 virtual void EndRendering() {} | 87 void SaveState() override; |
83 virtual void SaveState(); | 88 void RestoreState(FX_BOOL bKeepSaved) override; |
84 virtual void RestoreState(FX_BOOL bKeepSaved); | 89 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
85 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | |
86 const CFX_AffineMatrix* pObject2Device, | |
87 int fill_mode); | |
88 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | |
89 const CFX_AffineMatrix* pObject2Device, | |
90 const CFX_GraphStateData* pGraphState); | |
91 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, | |
92 const CFX_AffineMatrix* pObject2Device, | 90 const CFX_AffineMatrix* pObject2Device, |
93 const CFX_GraphStateData* pGraphState, | 91 int fill_mode) override; |
94 FX_DWORD fill_color, | 92 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
95 FX_DWORD stroke_color, | 93 const CFX_AffineMatrix* pObject2Device, |
96 int fill_mode, | 94 const CFX_GraphStateData* pGraphState) override; |
| 95 FX_BOOL DrawPath(const CFX_PathData* pPathData, |
| 96 const CFX_AffineMatrix* pObject2Device, |
| 97 const CFX_GraphStateData* pGraphState, |
| 98 FX_DWORD fill_color, |
| 99 FX_DWORD stroke_color, |
| 100 int fill_mode, |
| 101 int alpha_flag = 0, |
| 102 void* pIccTransform = NULL, |
| 103 int blend_type = FXDIB_BLEND_NORMAL) override; |
| 104 FX_BOOL SetPixel(int x, |
| 105 int y, |
| 106 FX_DWORD color, |
| 107 int alpha_flag = 0, |
| 108 void* pIccTransform = NULL) override { |
| 109 return FALSE; |
| 110 } |
| 111 FX_BOOL FillRect(const FX_RECT* pRect, |
| 112 FX_DWORD fill_color, |
| 113 int alpha_flag = 0, |
| 114 void* pIccTransform = NULL, |
| 115 int blend_type = FXDIB_BLEND_NORMAL) override; |
| 116 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, |
| 117 FX_FLOAT y1, |
| 118 FX_FLOAT x2, |
| 119 FX_FLOAT y2, |
| 120 FX_DWORD color, |
97 int alpha_flag = 0, | 121 int alpha_flag = 0, |
98 void* pIccTransform = NULL, | 122 void* pIccTransform = NULL, |
99 int blend_type = FXDIB_BLEND_NORMAL); | 123 int blend_type = FXDIB_BLEND_NORMAL) override; |
100 virtual FX_BOOL SetPixel(int x, | 124 FX_BOOL GetClipBox(FX_RECT* pRect) override; |
101 int y, | 125 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, |
102 FX_DWORD color, | 126 int left, |
103 int alpha_flag = 0, | 127 int top, |
104 void* pIccTransform = NULL) { | 128 void* pIccTransform = NULL, |
| 129 FX_BOOL bDEdge = FALSE) override; |
| 130 CFX_DIBitmap* GetBackDrop() override { return NULL; } |
| 131 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, |
| 132 FX_DWORD color, |
| 133 const FX_RECT* pSrcRect, |
| 134 int dest_left, |
| 135 int dest_top, |
| 136 int blend_type, |
| 137 int alpha_flag = 0, |
| 138 void* pIccTransform = NULL) override; |
| 139 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, |
| 140 FX_DWORD color, |
| 141 int dest_left, |
| 142 int dest_top, |
| 143 int dest_width, |
| 144 int dest_height, |
| 145 const FX_RECT* pClipRect, |
| 146 FX_DWORD flags, |
| 147 int alpha_flag = 0, |
| 148 void* pIccTransform = NULL, |
| 149 int blend_type = FXDIB_BLEND_NORMAL) override; |
| 150 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, |
| 151 int bitmap_alpha, |
| 152 FX_DWORD color, |
| 153 const CFX_AffineMatrix* pMatrix, |
| 154 FX_DWORD flags, |
| 155 void*& handle, |
| 156 int alpha_flag = 0, |
| 157 void* pIccTransform = NULL, |
| 158 int blend_type = FXDIB_BLEND_NORMAL) override { |
105 return FALSE; | 159 return FALSE; |
106 } | 160 } |
107 virtual FX_BOOL FillRect(const FX_RECT* pRect, | 161 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override { |
108 FX_DWORD fill_color, | |
109 int alpha_flag = 0, | |
110 void* pIccTransform = NULL, | |
111 int blend_type = FXDIB_BLEND_NORMAL); | |
112 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | |
113 FX_FLOAT y1, | |
114 FX_FLOAT x2, | |
115 FX_FLOAT y2, | |
116 FX_DWORD color, | |
117 int alpha_flag = 0, | |
118 void* pIccTransform = NULL, | |
119 int blend_type = FXDIB_BLEND_NORMAL); | |
120 virtual FX_BOOL GetClipBox(FX_RECT* pRect); | |
121 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, | |
122 int left, | |
123 int top, | |
124 void* pIccTransform = NULL, | |
125 FX_BOOL bDEdge = FALSE); | |
126 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, | |
127 FX_DWORD color, | |
128 const FX_RECT* pSrcRect, | |
129 int dest_left, | |
130 int dest_top, | |
131 int blend_type, | |
132 int alpha_flag = 0, | |
133 void* pIccTransform = NULL); | |
134 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | |
135 FX_DWORD color, | |
136 int dest_left, | |
137 int dest_top, | |
138 int dest_width, | |
139 int dest_height, | |
140 const FX_RECT* pClipRect, | |
141 FX_DWORD flags, | |
142 int alpha_flag = 0, | |
143 void* pIccTransform = NULL, | |
144 int blend_type = FXDIB_BLEND_NORMAL); | |
145 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | |
146 int bitmap_alpha, | |
147 FX_DWORD color, | |
148 const CFX_AffineMatrix* pMatrix, | |
149 FX_DWORD flags, | |
150 void*& handle, | |
151 int alpha_flag = 0, | |
152 void* pIccTransform = NULL, | |
153 int blend_type = FXDIB_BLEND_NORMAL) { | |
154 return FALSE; | 162 return FALSE; |
155 } | 163 } |
156 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { | 164 void CancelDIBits(void* handle) override {} |
157 return FALSE; | 165 FX_BOOL DrawDeviceText(int nChars, |
158 } | 166 const FXTEXT_CHARPOS* pCharPos, |
159 virtual void CancelDIBits(void* handle) {} | 167 CFX_Font* pFont, |
160 virtual FX_BOOL DrawDeviceText(int nChars, | 168 CFX_FontCache* pCache, |
161 const FXTEXT_CHARPOS* pCharPos, | 169 const CFX_AffineMatrix* pObject2Device, |
162 CFX_Font* pFont, | 170 FX_FLOAT font_size, |
163 CFX_FontCache* pCache, | 171 FX_DWORD color, |
164 const CFX_AffineMatrix* pObject2Device, | 172 int alpha_flag = 0, |
165 FX_FLOAT font_size, | 173 void* pIccTransform = NULL) override; |
166 FX_DWORD color, | 174 void* GetPlatformSurface() override { return NULL; } |
167 int alpha_flag = 0, | 175 void ClearDriver() override; |
168 void* pIccTransform = NULL); | |
169 virtual void ClearDriver(); | |
170 | 176 |
171 protected: | 177 protected: |
172 void setStrokeInfo(const CFX_GraphStateData* graphState, | 178 void setStrokeInfo(const CFX_GraphStateData* graphState, |
173 FX_ARGB argb, | 179 FX_ARGB argb, |
174 FX_FLOAT lineWidth); | 180 FX_FLOAT lineWidth); |
175 void setFillInfo(FX_ARGB argb); | 181 void setFillInfo(FX_ARGB argb); |
176 void setPathToContext(const CFX_PathData* pathData); | 182 void setPathToContext(const CFX_PathData* pathData); |
177 FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState, | 183 FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState, |
178 CGAffineTransform ctm); | 184 CGAffineTransform ctm); |
179 FX_BOOL CG_DrawGlypRun(int nChars, | 185 FX_BOOL CG_DrawGlypRun(int nChars, |
(...skipping 19 matching lines...) Expand all Loading... |
199 int32_t m_saveCount; | 205 int32_t m_saveCount; |
200 | 206 |
201 int32_t _width; | 207 int32_t _width; |
202 int32_t _height; | 208 int32_t _height; |
203 int32_t _bitsPerPixel; | 209 int32_t _bitsPerPixel; |
204 int32_t _deviceClass; | 210 int32_t _deviceClass; |
205 int32_t _renderCaps; | 211 int32_t _renderCaps; |
206 int32_t _horzSize; | 212 int32_t _horzSize; |
207 int32_t _vertSize; | 213 int32_t _vertSize; |
208 }; | 214 }; |
| 215 |
209 class CFX_FontProvider final : public IFX_FileRead { | 216 class CFX_FontProvider final : public IFX_FileRead { |
210 public: | 217 public: |
211 virtual void Release() override { delete this; } | 218 // IFX_FileRead |
212 virtual FX_FILESIZE GetSize() override { return (FX_FILESIZE)_totalSize; } | 219 void Release() override { delete this; } |
213 virtual FX_BOOL ReadBlock(void* buffer, | 220 FX_FILESIZE GetSize() override { return (FX_FILESIZE)_totalSize; } |
214 FX_FILESIZE offset, | 221 FX_BOOL IsEOF() override { return _offSet == _totalSize; } |
215 size_t size) override; | 222 FX_FILESIZE GetPosition() override { return (FX_FILESIZE)_offSet; } |
216 | 223 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; |
217 virtual FX_BOOL IsEOF() override { return _offSet == _totalSize; } | 224 size_t ReadBlock(void* buffer, size_t size) override; |
218 virtual FX_FILESIZE GetPosition() override { return (FX_FILESIZE)_offSet; } | |
219 virtual size_t ReadBlock(void* buffer, size_t size) override; | |
220 | 225 |
221 public: | 226 public: |
222 CFX_FontProvider(CGFontRef cgFont); | 227 CFX_FontProvider(CGFontRef cgFont); |
223 ~CFX_FontProvider(); | 228 ~CFX_FontProvider() override; |
224 void InitTableOffset(); | 229 void InitTableOffset(); |
225 unsigned long Read(unsigned long offset, | 230 unsigned long Read(unsigned long offset, |
226 unsigned char* buffer, | 231 unsigned char* buffer, |
227 unsigned long count); | 232 unsigned long count); |
228 | 233 |
229 protected: | 234 protected: |
230 uint32_t CalcTableCheckSum(const uint32_t* table, | 235 uint32_t CalcTableCheckSum(const uint32_t* table, |
231 uint32_t numberOfBytesInTable); | 236 uint32_t numberOfBytesInTable); |
232 uint32_t CalcTableDataRefCheckSum(CFDataRef dataRef); | 237 uint32_t CalcTableDataRefCheckSum(CFDataRef dataRef); |
233 | 238 |
(...skipping 13 matching lines...) Expand all Loading... |
247 uint32_t fCheckSum; | 252 uint32_t fCheckSum; |
248 uint32_t fOffset; | 253 uint32_t fOffset; |
249 uint32_t fLength; | 254 uint32_t fLength; |
250 } TableEntry; | 255 } TableEntry; |
251 FontHeader _fontHeader; | 256 FontHeader _fontHeader; |
252 unsigned char* _tableEntries; | 257 unsigned char* _tableEntries; |
253 size_t* _tableOffsets; | 258 size_t* _tableOffsets; |
254 int _tableCount; | 259 int _tableCount; |
255 int _totalSize; | 260 int _totalSize; |
256 }; | 261 }; |
| 262 |
257 uint32_t FX_GetHashCode(const FX_CHAR* pStr); | 263 uint32_t FX_GetHashCode(const FX_CHAR* pStr); |
258 FX_DWORD FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); | 264 FX_DWORD FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); |
259 uint32_t FX_IOSGetFamilyNamesCount(); | 265 uint32_t FX_IOSGetFamilyNamesCount(); |
260 const FX_CHAR* FX_IOSGetFamilyName(uint32_t uIndex); | 266 const FX_CHAR* FX_IOSGetFamilyName(uint32_t uIndex); |
261 #endif | 267 #endif |
262 | 268 |
263 #endif // CORE_SRC_FXGE_APPLE_APPLE_INT_H_ | 269 #endif // CORE_SRC_FXGE_APPLE_APPLE_INT_H_ |
OLD | NEW |