From 7484762421e85aa5d610f47aa547470786eecab8 Mon Sep 17 00:00:00 2001 From: npm Date: Fri, 29 Jul 2016 15:20:25 -0700 Subject: Refactor fxge/fx_apple and fx_win header files - Renamed header for CFX_QuartzDevice class - Removed unused class CFX_WinBitmapDevice - Split remaining fx_ge_win32 header Review-Url: https://codereview.chromium.org/2197513004 --- core/fxge/include/cfx_windowsdevice.h | 39 +++++++++++++++ core/fxge/include/fx_ge_apple.h | 31 ------------ core/fxge/include/fx_ge_win32.h | 89 ----------------------------------- 3 files changed, 39 insertions(+), 120 deletions(-) create mode 100644 core/fxge/include/cfx_windowsdevice.h delete mode 100644 core/fxge/include/fx_ge_apple.h delete mode 100644 core/fxge/include/fx_ge_win32.h (limited to 'core/fxge/include') diff --git a/core/fxge/include/cfx_windowsdevice.h b/core/fxge/include/cfx_windowsdevice.h new file mode 100644 index 0000000000..906442d3d9 --- /dev/null +++ b/core/fxge/include/cfx_windowsdevice.h @@ -0,0 +1,39 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXGE_INCLUDE_CFX_WINDOWSDEVICE_H_ +#define CORE_FXGE_INCLUDE_CFX_WINDOWSDEVICE_H_ + +#ifdef _WIN32 +#ifndef _WINDOWS_ +#include +#endif + +class IFX_RenderDeviceDriver; + +#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) +typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, + const wchar_t* text, + size_t text_length); + +extern bool g_pdfium_print_text_with_gdi; +extern PDFiumEnsureTypefaceCharactersAccessible + g_pdfium_typeface_accessible_func; +#endif + +class CFX_WindowsDevice : public CFX_RenderDevice { + public: + static IFX_RenderDeviceDriver* CreateDriver(HDC hDC); + + explicit CFX_WindowsDevice(HDC hDC); + ~CFX_WindowsDevice() override; + + HDC GetDC() const; +}; + +#endif // _WIN32 + +#endif // CORE_FXGE_INCLUDE_CFX_WINDOWSDEVICE_H_ diff --git a/core/fxge/include/fx_ge_apple.h b/core/fxge/include/fx_ge_apple.h deleted file mode 100644 index 6dce86697f..0000000000 --- a/core/fxge/include/fx_ge_apple.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_INCLUDE_FX_GE_APPLE_H_ -#define CORE_FXGE_INCLUDE_FX_GE_APPLE_H_ - -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - -#include "core/fxge/include/fx_ge.h" - -class CFX_QuartzDevice : public CFX_RenderDevice { - public: - CFX_QuartzDevice(); - ~CFX_QuartzDevice() override; - - FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY); - FX_BOOL Attach(CFX_DIBitmap* pBitmap); - FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format); - - CGContextRef GetContext(); - - protected: - CGContextRef m_pContext; - FX_BOOL m_bOwnedBitmap; -}; -#endif - -#endif // CORE_FXGE_INCLUDE_FX_GE_APPLE_H_ diff --git a/core/fxge/include/fx_ge_win32.h b/core/fxge/include/fx_ge_win32.h deleted file mode 100644 index e53ee2e0f7..0000000000 --- a/core/fxge/include/fx_ge_win32.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ -#define CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ - -#ifdef _WIN32 -#ifndef _WINDOWS_ -#include -#endif -#define WINDIB_OPEN_MEMORY 0x1 -#define WINDIB_OPEN_PATHNAME 0x2 - -class IFX_RenderDeviceDriver; - -#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) -typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, - const wchar_t* text, - size_t text_length); - -extern bool g_pdfium_print_text_with_gdi; -extern PDFiumEnsureTypefaceCharactersAccessible - g_pdfium_typeface_accessible_func; -#endif - -typedef struct WINDIB_Open_Args_ { - int flags; - - const uint8_t* memory_base; - - size_t memory_size; - - const FX_WCHAR* path_name; -} WINDIB_Open_Args_; - -class CFX_WindowsDIB : public CFX_DIBitmap { - public: - CFX_WindowsDIB(HDC hDC, int width, int height); - ~CFX_WindowsDIB() override; - - static CFX_ByteString GetBitmapInfo(const CFX_DIBitmap* pBitmap); - static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); - static HBITMAP GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC); - static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); - static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename); - static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); - - HDC GetDC() const { return m_hMemDC; } - HBITMAP GetWindowsBitmap() const { return m_hBitmap; } - - void LoadFromDevice(HDC hDC, int left, int top); - void SetToDevice(HDC hDC, int left, int top); - - protected: - HDC m_hMemDC; - HBITMAP m_hBitmap; - HBITMAP m_hOldBitmap; -}; - -class CFX_WindowsDevice : public CFX_RenderDevice { - public: - static IFX_RenderDeviceDriver* CreateDriver(HDC hDC); - - explicit CFX_WindowsDevice(HDC hDC); - ~CFX_WindowsDevice() override; - - HDC GetDC() const; -}; - -class CFX_WinBitmapDevice : public CFX_RenderDevice { - public: - CFX_WinBitmapDevice(int width, int height, FXDIB_Format format); - ~CFX_WinBitmapDevice() override; - - HDC GetDC() { return m_hDC; } - - protected: - HBITMAP m_hBitmap; - - HBITMAP m_hOldBitmap; - - HDC m_hDC; -}; -#endif - -#endif // CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ -- cgit v1.2.3