| 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 #ifndef CORE_SRC_FXGE_WIN32_WIN32_INT_H_ | 6 #ifndef CORE_SRC_FXGE_WIN32_WIN32_INT_H_ |
| 7 #define CORE_SRC_FXGE_WIN32_WIN32_INT_H_ | 7 #define CORE_SRC_FXGE_WIN32_WIN32_INT_H_ |
| 8 | 8 |
| 9 #include "../../../include/fxge/fx_ge.h" |
| 10 |
| 9 struct WINDIB_Open_Args_; | 11 struct WINDIB_Open_Args_; |
| 10 class CGdiplusExt { | 12 class CGdiplusExt { |
| 11 public: | 13 public: |
| 12 CGdiplusExt(); | 14 CGdiplusExt(); |
| 13 ~CGdiplusExt(); | 15 ~CGdiplusExt(); |
| 14 void Load(); | 16 void Load(); |
| 15 FX_BOOL IsAvailable() { return m_hModule != NULL; } | 17 FX_BOOL IsAvailable() { return m_hModule != NULL; } |
| 16 FX_BOOL StretchBitMask(HDC hDC, | 18 FX_BOOL StretchBitMask(HDC hDC, |
| 17 BOOL bMonoDevice, | 19 BOOL bMonoDevice, |
| 18 const CFX_DIBitmap* pBitmap, | 20 const CFX_DIBitmap* pBitmap, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 HMODULE m_hModule; | 96 HMODULE m_hModule; |
| 95 HMODULE m_GdiModule; | 97 HMODULE m_GdiModule; |
| 96 }; | 98 }; |
| 97 #include "dwrite_int.h" | 99 #include "dwrite_int.h" |
| 98 class CWin32Platform { | 100 class CWin32Platform { |
| 99 public: | 101 public: |
| 100 FX_BOOL m_bHalfTone; | 102 FX_BOOL m_bHalfTone; |
| 101 CGdiplusExt m_GdiplusExt; | 103 CGdiplusExt m_GdiplusExt; |
| 102 CDWriteExt m_DWriteExt; | 104 CDWriteExt m_DWriteExt; |
| 103 }; | 105 }; |
| 106 |
| 104 class CGdiDeviceDriver : public IFX_RenderDeviceDriver { | 107 class CGdiDeviceDriver : public IFX_RenderDeviceDriver { |
| 105 protected: | 108 protected: |
| 106 virtual int GetDeviceCaps(int caps_id); | 109 // IFX_RenderDeviceDriver |
| 107 virtual void SaveState() { SaveDC(m_hDC); } | 110 int GetDeviceCaps(int caps_id) override; |
| 108 virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) { | 111 void SaveState() override { SaveDC(m_hDC); } |
| 112 void RestoreState(FX_BOOL bKeepSaved = FALSE) override { |
| 109 RestoreDC(m_hDC, -1); | 113 RestoreDC(m_hDC, -1); |
| 110 if (bKeepSaved) { | 114 if (bKeepSaved) { |
| 111 SaveDC(m_hDC); | 115 SaveDC(m_hDC); |
| 112 } | 116 } |
| 113 } | 117 } |
| 114 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | 118 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
| 115 const CFX_AffineMatrix* pObject2Device, | |
| 116 int fill_mode); | |
| 117 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | |
| 118 const CFX_AffineMatrix* pObject2Device, | |
| 119 const CFX_GraphStateData* pGraphState); | |
| 120 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, | |
| 121 const CFX_AffineMatrix* pObject2Device, | 119 const CFX_AffineMatrix* pObject2Device, |
| 122 const CFX_GraphStateData* pGraphState, | 120 int fill_mode) override; |
| 123 FX_DWORD fill_color, | 121 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
| 124 FX_DWORD stroke_color, | 122 const CFX_AffineMatrix* pObject2Device, |
| 125 int fill_mode, | 123 const CFX_GraphStateData* pGraphState) override; |
| 124 FX_BOOL DrawPath(const CFX_PathData* pPathData, |
| 125 const CFX_AffineMatrix* pObject2Device, |
| 126 const CFX_GraphStateData* pGraphState, |
| 127 FX_DWORD fill_color, |
| 128 FX_DWORD stroke_color, |
| 129 int fill_mode, |
| 130 int alpha_flag, |
| 131 void* pIccTransform, |
| 132 int blend_type) override; |
| 133 FX_BOOL FillRect(const FX_RECT* pRect, |
| 134 FX_DWORD fill_color, |
| 135 int alpha_flag, |
| 136 void* pIccTransform, |
| 137 int blend_type) override; |
| 138 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, |
| 139 FX_FLOAT y1, |
| 140 FX_FLOAT x2, |
| 141 FX_FLOAT y2, |
| 142 FX_DWORD color, |
| 126 int alpha_flag, | 143 int alpha_flag, |
| 127 void* pIccTransform, | 144 void* pIccTransform, |
| 128 int blend_type); | 145 int blend_type) override; |
| 129 virtual FX_BOOL FillRect(const FX_RECT* pRect, | 146 FX_BOOL GetClipBox(FX_RECT* pRect) override; |
| 130 FX_DWORD fill_color, | 147 void* GetPlatformSurface() override { return (void*)m_hDC; } |
| 131 int alpha_flag, | 148 |
| 132 void* pIccTransform, | |
| 133 int blend_type); | |
| 134 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | |
| 135 FX_FLOAT y1, | |
| 136 FX_FLOAT x2, | |
| 137 FX_FLOAT y2, | |
| 138 FX_DWORD color, | |
| 139 int alpha_flag, | |
| 140 void* pIccTransform, | |
| 141 int blend_type); | |
| 142 virtual void* GetClipRgn(); | 149 virtual void* GetClipRgn(); |
| 143 virtual FX_BOOL SetClipRgn(void* pRgn); | 150 virtual FX_BOOL SetClipRgn(void* pRgn); |
| 144 virtual FX_BOOL GetClipBox(FX_RECT* pRect); | |
| 145 virtual FX_BOOL DeleteDeviceRgn(void* pRgn); | 151 virtual FX_BOOL DeleteDeviceRgn(void* pRgn); |
| 146 virtual void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); | 152 virtual void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); |
| 147 virtual void* GetPlatformSurface() { return (void*)m_hDC; } | 153 |
| 148 FX_BOOL GDI_SetDIBits(const CFX_DIBitmap* pBitmap, | 154 FX_BOOL GDI_SetDIBits(const CFX_DIBitmap* pBitmap, |
| 149 const FX_RECT* pSrcRect, | 155 const FX_RECT* pSrcRect, |
| 150 int left, | 156 int left, |
| 151 int top, | 157 int top, |
| 152 void* pIccTransform); | 158 void* pIccTransform); |
| 153 FX_BOOL GDI_StretchDIBits(const CFX_DIBitmap* pBitmap, | 159 FX_BOOL GDI_StretchDIBits(const CFX_DIBitmap* pBitmap, |
| 154 int dest_left, | 160 int dest_left, |
| 155 int dest_top, | 161 int dest_top, |
| 156 int dest_width, | 162 int dest_width, |
| 157 int dest_height, | 163 int dest_height, |
| 158 FX_DWORD flags, | 164 FX_DWORD flags, |
| 159 void* pIccTransform); | 165 void* pIccTransform); |
| 160 FX_BOOL GDI_StretchBitMask(const CFX_DIBitmap* pBitmap, | 166 FX_BOOL GDI_StretchBitMask(const CFX_DIBitmap* pBitmap, |
| 161 int dest_left, | 167 int dest_left, |
| 162 int dest_top, | 168 int dest_top, |
| 163 int dest_width, | 169 int dest_width, |
| 164 int dest_height, | 170 int dest_height, |
| 165 FX_DWORD bitmap_color, | 171 FX_DWORD bitmap_color, |
| 166 FX_DWORD flags, | 172 FX_DWORD flags, |
| 167 int alpha_flag, | 173 int alpha_flag, |
| 168 void* pIccTransform); | 174 void* pIccTransform); |
| 169 HDC m_hDC; | 175 HDC m_hDC; |
| 170 int m_Width, m_Height, m_nBitsPerPixel; | 176 int m_Width, m_Height, m_nBitsPerPixel; |
| 171 int m_DeviceClass, m_RenderCaps; | 177 int m_DeviceClass, m_RenderCaps; |
| 172 CGdiDeviceDriver(HDC hDC, int device_class); | 178 CGdiDeviceDriver(HDC hDC, int device_class); |
| 173 ~CGdiDeviceDriver() {} | 179 ~CGdiDeviceDriver() override {} |
| 174 }; | 180 }; |
| 181 |
| 175 class CGdiDisplayDriver : public CGdiDeviceDriver { | 182 class CGdiDisplayDriver : public CGdiDeviceDriver { |
| 176 public: | 183 public: |
| 177 CGdiDisplayDriver(HDC hDC); | 184 CGdiDisplayDriver(HDC hDC); |
| 178 | 185 |
| 179 protected: | 186 protected: |
| 180 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, | 187 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, |
| 181 int left, | 188 int left, |
| 182 int top, | 189 int top, |
| 183 void* pIccTransform = NULL, | 190 void* pIccTransform = NULL, |
| 184 FX_BOOL bDEdge = FALSE); | 191 FX_BOOL bDEdge = FALSE); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 FX_DWORD color, | 261 FX_DWORD color, |
| 255 const CFX_AffineMatrix* pMatrix, | 262 const CFX_AffineMatrix* pMatrix, |
| 256 FX_DWORD render_flags, | 263 FX_DWORD render_flags, |
| 257 void*& handle, | 264 void*& handle, |
| 258 int alpha_flag, | 265 int alpha_flag, |
| 259 void* pIccTransform, | 266 void* pIccTransform, |
| 260 int blend_type); | 267 int blend_type); |
| 261 int m_HorzSize, m_VertSize; | 268 int m_HorzSize, m_VertSize; |
| 262 FX_BOOL m_bSupportROP; | 269 FX_BOOL m_bSupportROP; |
| 263 }; | 270 }; |
| 271 |
| 264 class CPSOutput : public IFX_PSOutput { | 272 class CPSOutput : public IFX_PSOutput { |
| 265 public: | 273 public: |
| 266 CPSOutput(HDC hDC); | 274 explicit CPSOutput(HDC hDC); |
| 267 virtual ~CPSOutput(); | 275 ~CPSOutput() override; |
| 268 virtual void Release() { delete this; } | 276 |
| 277 // IFX_PSOutput |
| 278 void Release() override { delete this; } |
| 279 void OutputPS(const FX_CHAR* string, int len) override; |
| 280 |
| 269 void Init(); | 281 void Init(); |
| 270 virtual void OutputPS(const FX_CHAR* string, int len); | 282 |
| 271 HDC m_hDC; | 283 HDC m_hDC; |
| 272 FX_CHAR* m_pBuf; | 284 FX_CHAR* m_pBuf; |
| 273 }; | 285 }; |
| 286 |
| 274 class CPSPrinterDriver : public IFX_RenderDeviceDriver { | 287 class CPSPrinterDriver : public IFX_RenderDeviceDriver { |
| 275 public: | 288 public: |
| 276 CPSPrinterDriver(); | 289 CPSPrinterDriver(); |
| 277 FX_BOOL Init(HDC hDC, int ps_level, FX_BOOL bCmykOutput); | 290 FX_BOOL Init(HDC hDC, int ps_level, FX_BOOL bCmykOutput); |
| 278 ~CPSPrinterDriver(); | 291 ~CPSPrinterDriver() override; |
| 279 | 292 |
| 280 protected: | 293 protected: |
| 281 virtual FX_BOOL IsPSPrintDriver() { return TRUE; } | 294 // IFX_RenderDeviceDriver |
| 282 virtual int GetDeviceCaps(int caps_id); | 295 int GetDeviceCaps(int caps_id); |
| 283 virtual FX_BOOL StartRendering(); | 296 FX_BOOL IsPSPrintDriver() override { return TRUE; } |
| 284 virtual void EndRendering(); | 297 FX_BOOL StartRendering() override; |
| 285 virtual void SaveState(); | 298 void EndRendering() override; |
| 286 virtual void RestoreState(FX_BOOL bKeepSaved = FALSE); | 299 void SaveState() override; |
| 287 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | 300 void RestoreState(FX_BOOL bKeepSaved = FALSE) override; |
| 288 const CFX_AffineMatrix* pObject2Device, | 301 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
| 289 int fill_mode); | |
| 290 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | |
| 291 const CFX_AffineMatrix* pObject2Device, | |
| 292 const CFX_GraphStateData* pGraphState); | |
| 293 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, | |
| 294 const CFX_AffineMatrix* pObject2Device, | 302 const CFX_AffineMatrix* pObject2Device, |
| 295 const CFX_GraphStateData* pGraphState, | 303 int fill_mode) override; |
| 296 FX_DWORD fill_color, | 304 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
| 297 FX_DWORD stroke_color, | 305 const CFX_AffineMatrix* pObject2Device, |
| 298 int fill_mode, | 306 const CFX_GraphStateData* pGraphState) override; |
| 299 int alpha_flag, | 307 FX_BOOL DrawPath(const CFX_PathData* pPathData, |
| 300 void* pIccTransform, | 308 const CFX_AffineMatrix* pObject2Device, |
| 301 int blend_type); | 309 const CFX_GraphStateData* pGraphState, |
| 302 virtual FX_BOOL GetClipBox(FX_RECT* pRect); | 310 FX_DWORD fill_color, |
| 303 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, | 311 FX_DWORD stroke_color, |
| 304 FX_DWORD color, | 312 int fill_mode, |
| 305 const FX_RECT* pSrcRect, | 313 int alpha_flag, |
| 306 int left, | 314 void* pIccTransform, |
| 307 int top, | 315 int blend_type) override; |
| 308 int blend_type, | 316 FX_BOOL GetClipBox(FX_RECT* pRect) override; |
| 309 int alpha_flag, | 317 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, |
| 310 void* pIccTransform); | 318 FX_DWORD color, |
| 311 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | 319 const FX_RECT* pSrcRect, |
| 312 FX_DWORD color, | 320 int left, |
| 313 int dest_left, | 321 int top, |
| 314 int dest_top, | 322 int blend_type, |
| 315 int dest_width, | 323 int alpha_flag, |
| 316 int dest_height, | 324 void* pIccTransform) override; |
| 317 const FX_RECT* pClipRect, | 325 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, |
| 318 FX_DWORD flags, | 326 FX_DWORD color, |
| 319 int alpha_flag, | 327 int dest_left, |
| 320 void* pIccTransform, | 328 int dest_top, |
| 321 int blend_type); | 329 int dest_width, |
| 322 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | 330 int dest_height, |
| 323 int bitmap_alpha, | 331 const FX_RECT* pClipRect, |
| 324 FX_DWORD color, | 332 FX_DWORD flags, |
| 325 const CFX_AffineMatrix* pMatrix, | 333 int alpha_flag, |
| 326 FX_DWORD render_flags, | 334 void* pIccTransform, |
| 327 void*& handle, | 335 int blend_type) override; |
| 328 int alpha_flag, | 336 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, |
| 329 void* pIccTransform, | 337 int bitmap_alpha, |
| 330 int blend_type); | 338 FX_DWORD color, |
| 331 virtual FX_BOOL DrawDeviceText(int nChars, | 339 const CFX_AffineMatrix* pMatrix, |
| 332 const FXTEXT_CHARPOS* pCharPos, | 340 FX_DWORD render_flags, |
| 333 CFX_Font* pFont, | 341 void*& handle, |
| 334 CFX_FontCache* pCache, | 342 int alpha_flag, |
| 335 const CFX_AffineMatrix* pObject2Device, | 343 void* pIccTransform, |
| 336 FX_FLOAT font_size, | 344 int blend_type) override; |
| 337 FX_DWORD color, | 345 FX_BOOL DrawDeviceText(int nChars, |
| 338 int alpha_flag, | 346 const FXTEXT_CHARPOS* pCharPos, |
| 339 void* pIccTransform); | 347 CFX_Font* pFont, |
| 340 virtual void* GetPlatformSurface() { return (void*)m_hDC; } | 348 CFX_FontCache* pCache, |
| 349 const CFX_AffineMatrix* pObject2Device, |
| 350 FX_FLOAT font_size, |
| 351 FX_DWORD color, |
| 352 int alpha_flag, |
| 353 void* pIccTransform) override; |
| 354 void* GetPlatformSurface() override { return (void*)m_hDC; } |
| 355 |
| 341 HDC m_hDC; | 356 HDC m_hDC; |
| 342 FX_BOOL m_bCmykOutput; | 357 FX_BOOL m_bCmykOutput; |
| 343 int m_Width, m_Height, m_nBitsPerPixel; | 358 int m_Width, m_Height, m_nBitsPerPixel; |
| 344 int m_HorzSize, m_VertSize; | 359 int m_HorzSize, m_VertSize; |
| 345 CPSOutput* m_pPSOutput; | 360 CPSOutput* m_pPSOutput; |
| 346 CFX_PSRenderer m_PSRenderer; | 361 CFX_PSRenderer m_PSRenderer; |
| 347 }; | 362 }; |
| 348 void _Color2Argb(FX_ARGB& argb, | 363 void _Color2Argb(FX_ARGB& argb, |
| 349 FX_DWORD color, | 364 FX_DWORD color, |
| 350 int alpha_flag, | 365 int alpha_flag, |
| 351 void* pIccTransform); | 366 void* pIccTransform); |
| 352 | 367 |
| 353 #endif // CORE_SRC_FXGE_WIN32_WIN32_INT_H_ | 368 #endif // CORE_SRC_FXGE_WIN32_WIN32_INT_H_ |
| OLD | NEW |