Remove more cruft from fx_system.h
[pdfium.git] / core / src / fxge / win32 / fx_win32_device.cpp
index debf94d..4bef988 100644 (file)
@@ -5,7 +5,7 @@
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
 #include "../../../include/fxge/fx_ge.h"
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
 #include "../../../include/fxge/fx_ge_win32.h"
 #include <crtdbg.h>
 #include "../agg/include/fxfx_agg_clip_liang_barsky.h"
@@ -16,7 +16,7 @@
 #include "../agg/include/fx_agg_driver.h"
 #include "../../../include/fxge/fx_freetype.h"
 #include "../../../include/fxcodec/fx_codec.h"
-class CWin32FontInfo FX_FINAL : public IFX_SystemFontInfo
+class CWin32FontInfo final : public IFX_SystemFontInfo
 {
 public:
     CWin32FontInfo();
@@ -393,14 +393,11 @@ FX_BOOL CWin32FontInfo::GetFontCharset(void* hFont, int& charset)
 }
 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault()
 {
-    return FX_NEW CWin32FontInfo;
+    return new CWin32FontInfo;
 }
 void CFX_GEModule::InitPlatform()
 {
-    CWin32Platform* pPlatformData = FX_NEW CWin32Platform;
-    if (!pPlatformData) {
-        return;
-    }
+    CWin32Platform* pPlatformData = new CWin32Platform;
     OSVERSIONINFO ver;
     ver.dwOSVersionInfoSize = sizeof(ver);
     GetVersionEx(&ver);
@@ -658,9 +655,6 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMa
     FX_DWORD* pDash = NULL;
     if (pGraphState->m_DashCount) {
         pDash = FX_Alloc(FX_DWORD, pGraphState->m_DashCount);
-        if (!pDash) {
-            return NULL;
-        }
         for (int i = 0; i < pGraphState->m_DashCount; i ++) {
             pDash[i] = FXSYS_round(pMatrix ? pMatrix->TransformDistance(pGraphState->m_DashArray[i]) : pGraphState->m_DashArray[i]);
             if (pDash[i] < 1) {
@@ -1143,10 +1137,7 @@ CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC, FX_BOOL bCmykOutput, FX_BOOL bForc
     m_bForcePSOutput = bForcePSOutput;
     m_psLevel = psLevel;
     if (bForcePSOutput) {
-        IFX_RenderDeviceDriver* pDriver = FX_NEW CPSPrinterDriver;
-        if (!pDriver) {
-            return;
-        }
+        IFX_RenderDeviceDriver* pDriver = new CPSPrinterDriver;
         ((CPSPrinterDriver*)pDriver)->Init(hDC, psLevel, bCmykOutput);
         SetDeviceDriver(pDriver);
         return;
@@ -1172,9 +1163,9 @@ IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOu
         device_class = FXDC_DISPLAY;
     }
     if (device_class == FXDC_PRINTER) {
-        return FX_NEW CGdiPrinterDriver(hDC);
+        return new CGdiPrinterDriver(hDC);
     }
-    return FX_NEW CGdiDisplayDriver(hDC);
+    return new CGdiDisplayDriver(hDC);
 }
 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format format)
 {
@@ -1190,18 +1181,12 @@ CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for
     if (m_hBitmap == NULL) {
         return;
     }
-    CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap;
-    if (!pBitmap) {
-        return;
-    }
+    CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
     pBitmap->Create(width, height, format, pBuffer);
     SetBitmap(pBitmap);
     m_hDC = ::CreateCompatibleDC(NULL);
     m_hOldBitmap = (HBITMAP)SelectObject(m_hDC, m_hBitmap);
-    IFX_RenderDeviceDriver* pDriver = FX_NEW CGdiDisplayDriver(m_hDC);
-    if (!pDriver) {
-        return;
-    }
+    IFX_RenderDeviceDriver* pDriver = new CGdiDisplayDriver(m_hDC);
     SetDeviceDriver(pDriver);
 }
 CFX_WinBitmapDevice::~CFX_WinBitmapDevice()