| 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_INCLUDE_FXGE_FX_GE_WIN32_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ |
| 8 #define CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ | 8 #define CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ |
| 9 | 9 |
| 10 #ifdef _WIN32 | 10 #ifdef _WIN32 |
| 11 #ifndef _WINDOWS_ | 11 #ifndef _WINDOWS_ |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 #endif | 13 #endif |
| 14 #define WINDIB_OPEN_MEMORY 0x1 | 14 #define WINDIB_OPEN_MEMORY 0x1 |
| 15 #define WINDIB_OPEN_PATHNAME 0x2 | 15 #define WINDIB_OPEN_PATHNAME 0x2 |
| 16 typedef struct WINDIB_Open_Args_ { | 16 typedef struct WINDIB_Open_Args_ { |
| 17 int flags; |
| 17 | 18 |
| 18 int flags; | 19 const uint8_t* memory_base; |
| 19 | 20 |
| 20 const uint8_t* memory_base; | 21 size_t memory_size; |
| 21 | 22 |
| 22 size_t memory_size; | 23 const FX_WCHAR* path_name; |
| 24 } WINDIB_Open_Args_; |
| 25 class CFX_WindowsDIB : public CFX_DIBitmap { |
| 26 public: |
| 27 static CFX_ByteString GetBitmapInfo(const CFX_DIBitmap* pBitmap); |
| 23 | 28 |
| 24 const FX_WCHAR* path_name; | 29 static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); |
| 25 } WINDIB_Open_Args_; | |
| 26 class CFX_WindowsDIB : public CFX_DIBitmap | |
| 27 { | |
| 28 public: | |
| 29 | 30 |
| 30 static CFX_ByteString» GetBitmapInfo(const CFX_DIBitmap* pBitmap); | 31 static HBITMAP GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC); |
| 31 | 32 |
| 32 static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); | 33 static CFX_DIBitmap* LoadFromDDB(HDC hDC, |
| 34 HBITMAP hBitmap, |
| 35 FX_DWORD* pPalette = NULL, |
| 36 FX_DWORD size = 256); |
| 33 | 37 |
| 34 static HBITMAP» » GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC
); | 38 static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); |
| 35 | 39 |
| 36 static CFX_DIBitmap* LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pPalett
e = NULL, FX_DWORD size = 256); | 40 static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename) { |
| 41 return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); |
| 42 } |
| 37 | 43 |
| 38 static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); | 44 static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); |
| 39 | 45 |
| 40 static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename) | 46 CFX_WindowsDIB(HDC hDC, int width, int height); |
| 41 { | |
| 42 return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); | |
| 43 } | |
| 44 | 47 |
| 45 static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); | 48 ~CFX_WindowsDIB(); |
| 46 | 49 |
| 47 CFX_WindowsDIB(HDC hDC, int width, int height); | 50 HDC GetDC() const { return m_hMemDC; } |
| 48 | 51 |
| 49 ~CFX_WindowsDIB(); | 52 HBITMAP GetWindowsBitmap() const { return m_hBitmap; } |
| 50 | 53 |
| 51 HDC»» » » » GetDC() const | 54 void LoadFromDevice(HDC hDC, int left, int top); |
| 52 { | |
| 53 return m_hMemDC; | |
| 54 } | |
| 55 | 55 |
| 56 HBITMAP» » » » GetWindowsBitmap() const | 56 void SetToDevice(HDC hDC, int left, int top); |
| 57 { | |
| 58 return m_hBitmap; | |
| 59 } | |
| 60 | 57 |
| 61 void» » » » LoadFromDevice(HDC hDC, int left, int to
p); | 58 protected: |
| 59 HDC m_hMemDC; |
| 62 | 60 |
| 63 void» » » » SetToDevice(HDC hDC, int left, int top); | 61 HBITMAP m_hBitmap; |
| 64 protected: | |
| 65 | 62 |
| 66 HDC»» » » » m_hMemDC; | 63 HBITMAP m_hOldBitmap; |
| 64 }; |
| 65 class CFX_WindowsDevice : public CFX_RenderDevice { |
| 66 public: |
| 67 static IFX_RenderDeviceDriver* CreateDriver(HDC hDC, |
| 68 FX_BOOL bCmykOutput = FALSE); |
| 67 | 69 |
| 68 HBITMAP» » » » m_hBitmap; | 70 CFX_WindowsDevice(HDC hDC, |
| 71 FX_BOOL bCmykOutput = FALSE, |
| 72 FX_BOOL bForcePSOutput = FALSE, |
| 73 int psLevel = 2); |
| 69 | 74 |
| 70 HBITMAP» » » » m_hOldBitmap; | 75 HDC GetDC() const; |
| 76 |
| 77 FX_BOOL m_bForcePSOutput; |
| 78 |
| 79 static int m_psLevel; |
| 71 }; | 80 }; |
| 72 class CFX_WindowsDevice : public CFX_RenderDevice | 81 class CFX_WinBitmapDevice : public CFX_RenderDevice { |
| 73 { | 82 public: |
| 74 public: | 83 CFX_WinBitmapDevice(int width, int height, FXDIB_Format format); |
| 75 static IFX_RenderDeviceDriver*» CreateDriver(HDC hDC, FX_BOOL bCmykOutpu
t = FALSE); | |
| 76 | 84 |
| 77 CFX_WindowsDevice(HDC hDC, FX_BOOL bCmykOutput = FALSE, FX_BOOL bForcePSOutp
ut = FALSE, int psLevel = 2); | 85 ~CFX_WinBitmapDevice(); |
| 78 | 86 |
| 79 HDC»» GetDC() const; | 87 HDC GetDC() { return m_hDC; } |
| 80 | 88 |
| 81 FX_BOOL m_bForcePSOutput; | 89 protected: |
| 90 HBITMAP m_hBitmap; |
| 82 | 91 |
| 83 static int m_psLevel; | 92 HBITMAP m_hOldBitmap; |
| 84 }; | |
| 85 class CFX_WinBitmapDevice : public CFX_RenderDevice | |
| 86 { | |
| 87 public: | |
| 88 | 93 |
| 89 CFX_WinBitmapDevice(int width, int height, FXDIB_Format format); | 94 HDC m_hDC; |
| 90 | |
| 91 ~CFX_WinBitmapDevice(); | |
| 92 | |
| 93 HDC»» GetDC() | |
| 94 { | |
| 95 return m_hDC; | |
| 96 } | |
| 97 protected: | |
| 98 | |
| 99 HBITMAP» m_hBitmap; | |
| 100 | |
| 101 HBITMAP m_hOldBitmap; | |
| 102 | |
| 103 HDC»» m_hDC; | |
| 104 }; | 95 }; |
| 105 #endif | 96 #endif |
| 106 | 97 |
| 107 #endif // CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ | 98 #endif // CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ |
| OLD | NEW |