| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ | |
| 8 #define CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ | |
| 9 | |
| 10 #ifdef _WIN32 | |
| 11 #ifndef _WINDOWS_ | |
| 12 #include <windows.h> | |
| 13 #endif | |
| 14 #define WINDIB_OPEN_MEMORY 0x1 | |
| 15 #define WINDIB_OPEN_PATHNAME 0x2 | |
| 16 | |
| 17 class IFX_RenderDeviceDriver; | |
| 18 | |
| 19 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) | |
| 20 typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, | |
| 21 const wchar_t* text, | |
| 22 size_t text_length); | |
| 23 | |
| 24 extern bool g_pdfium_print_text_with_gdi; | |
| 25 extern PDFiumEnsureTypefaceCharactersAccessible | |
| 26 g_pdfium_typeface_accessible_func; | |
| 27 #endif | |
| 28 | |
| 29 typedef struct WINDIB_Open_Args_ { | |
| 30 int flags; | |
| 31 | |
| 32 const uint8_t* memory_base; | |
| 33 | |
| 34 size_t memory_size; | |
| 35 | |
| 36 const FX_WCHAR* path_name; | |
| 37 } WINDIB_Open_Args_; | |
| 38 | |
| 39 class CFX_WindowsDIB : public CFX_DIBitmap { | |
| 40 public: | |
| 41 CFX_WindowsDIB(HDC hDC, int width, int height); | |
| 42 ~CFX_WindowsDIB() override; | |
| 43 | |
| 44 static CFX_ByteString GetBitmapInfo(const CFX_DIBitmap* pBitmap); | |
| 45 static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); | |
| 46 static HBITMAP GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC); | |
| 47 static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); | |
| 48 static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename); | |
| 49 static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); | |
| 50 | |
| 51 HDC GetDC() const { return m_hMemDC; } | |
| 52 HBITMAP GetWindowsBitmap() const { return m_hBitmap; } | |
| 53 | |
| 54 void LoadFromDevice(HDC hDC, int left, int top); | |
| 55 void SetToDevice(HDC hDC, int left, int top); | |
| 56 | |
| 57 protected: | |
| 58 HDC m_hMemDC; | |
| 59 HBITMAP m_hBitmap; | |
| 60 HBITMAP m_hOldBitmap; | |
| 61 }; | |
| 62 | |
| 63 class CFX_WindowsDevice : public CFX_RenderDevice { | |
| 64 public: | |
| 65 static IFX_RenderDeviceDriver* CreateDriver(HDC hDC); | |
| 66 | |
| 67 explicit CFX_WindowsDevice(HDC hDC); | |
| 68 ~CFX_WindowsDevice() override; | |
| 69 | |
| 70 HDC GetDC() const; | |
| 71 }; | |
| 72 | |
| 73 class CFX_WinBitmapDevice : public CFX_RenderDevice { | |
| 74 public: | |
| 75 CFX_WinBitmapDevice(int width, int height, FXDIB_Format format); | |
| 76 ~CFX_WinBitmapDevice() override; | |
| 77 | |
| 78 HDC GetDC() { return m_hDC; } | |
| 79 | |
| 80 protected: | |
| 81 HBITMAP m_hBitmap; | |
| 82 | |
| 83 HBITMAP m_hOldBitmap; | |
| 84 | |
| 85 HDC m_hDC; | |
| 86 }; | |
| 87 #endif | |
| 88 | |
| 89 #endif // CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ | |
| OLD | NEW |