summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcrt/fx_basic_util.cpp55
-rw-r--r--fpdfsdk/fpdfview.cpp45
-rw-r--r--fpdfsdk/fsdk_rendercontext.cpp14
-rw-r--r--fpdfsdk/include/fsdk_rendercontext.h4
-rw-r--r--public/fpdfview.h4
5 files changed, 19 insertions, 103 deletions
diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp
index be5200fc6f..02e09ce057 100644
--- a/core/fxcrt/fx_basic_util.cpp
+++ b/core/fxcrt/fx_basic_util.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cctype>
+#include <memory>
#ifdef PDF_ENABLE_XFA
CFX_PrivateData::CFX_PrivateData() {}
@@ -208,41 +209,35 @@ class CFindFileDataW : public CFindFileData {
WIN32_FIND_DATAW m_FindData;
};
#endif
+
void* FX_OpenFolder(const FX_CHAR* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#ifndef _WIN32_WCE
- CFindFileDataA* pData = new CFindFileDataA;
+ std::unique_ptr<CFindFileDataA> pData(new CFindFileDataA);
pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(),
FindExInfoStandard, &pData->m_FindData,
- FindExSearchNameMatch, NULL, 0);
-#else
- CFindFileDataW* pData = new CFindFileDataW;
- pData->m_Handle = FindFirstFileW(CFX_WideString::FromLocal(path) + L"/*.*",
- &pData->m_FindData);
-#endif
- if (pData->m_Handle == INVALID_HANDLE_VALUE) {
- delete pData;
- return NULL;
- }
+ FindExSearchNameMatch, nullptr, 0);
+ if (pData->m_Handle == INVALID_HANDLE_VALUE)
+ return nullptr;
+
pData->m_bEnd = FALSE;
- return pData;
+ return pData.release();
#else
DIR* dir = opendir(path);
return dir;
#endif
}
+
void* FX_OpenFolder(const FX_WCHAR* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- CFindFileDataW* pData = new CFindFileDataW;
+ std::unique_ptr<CFindFileDataW> pData(new CFindFileDataW);
pData->m_Handle = FindFirstFileExW((CFX_WideString(path) + L"/*.*").c_str(),
FindExInfoStandard, &pData->m_FindData,
- FindExSearchNameMatch, NULL, 0);
- if (pData->m_Handle == INVALID_HANDLE_VALUE) {
- delete pData;
- return NULL;
- }
+ FindExSearchNameMatch, nullptr, 0);
+ if (pData->m_Handle == INVALID_HANDLE_VALUE)
+ return nullptr;
+
pData->m_bEnd = FALSE;
- return pData;
+ return pData.release();
#else
DIR* dir = opendir(CFX_ByteString::FromUnicode(path).c_str());
return dir;
@@ -255,29 +250,15 @@ FX_BOOL FX_GetNextFile(void* handle,
return FALSE;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#ifndef _WIN32_WCE
CFindFileDataA* pData = (CFindFileDataA*)handle;
- if (pData->m_bEnd) {
+ if (pData->m_bEnd)
return FALSE;
- }
+
filename = pData->m_FindData.cFileName;
bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
- if (!FindNextFileA(pData->m_Handle, &pData->m_FindData)) {
+ if (!FindNextFileA(pData->m_Handle, &pData->m_FindData))
pData->m_bEnd = TRUE;
- }
- return TRUE;
-#else
- CFindFileDataW* pData = (CFindFileDataW*)handle;
- if (pData->m_bEnd) {
- return FALSE;
- }
- filename = CFX_ByteString::FromUnicode(pData->m_FindData.cFileName);
- bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
- if (!FindNextFileW(pData->m_Handle, &pData->m_FindData)) {
- pData->m_bEnd = TRUE;
- }
return TRUE;
-#endif
#elif defined(__native_client__)
abort();
return FALSE;
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 9bf983974c..7797165bc2 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -537,7 +537,6 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
CRenderContext* pContext = new CRenderContext;
pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>(pContext));
-#if !defined(_WIN32_WCE)
CFX_DIBitmap* pBitmap = nullptr;
FX_BOOL bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
FX_BOOL bHasImageMask = pPage->HasImageMask();
@@ -572,50 +571,6 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
}
}
}
-#else
- // get clip region
- RECT rect, cliprect;
- rect.left = start_x;
- rect.top = start_y;
- rect.right = start_x + size_x;
- rect.bottom = start_y + size_y;
- GetClipBox(dc, &cliprect);
- IntersectRect(&rect, &rect, &cliprect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
-
- // Create a DIB section
- LPVOID pBuffer;
- BITMAPINFOHEADER bmih;
- FXSYS_memset(&bmih, 0, sizeof bmih);
- bmih.biSize = sizeof bmih;
- bmih.biBitCount = 24;
- bmih.biHeight = -height;
- bmih.biPlanes = 1;
- bmih.biWidth = width;
- pContext->m_hBitmap = CreateDIBSection(dc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS,
- &pBuffer, NULL, 0);
- FXSYS_memset(pBuffer, 0xff, height * ((width * 3 + 3) / 4 * 4));
-
- // Create a device with this external buffer
- pContext->m_pBitmap = new CFX_DIBitmap;
- pContext->m_pBitmap->Create(width, height, FXDIB_Rgb, (uint8_t*)pBuffer);
- pContext->m_pDevice = new CPDF_FxgeDevice;
- ((CPDF_FxgeDevice*)pContext->m_pDevice)->Attach(pContext->m_pBitmap);
-
- // output to bitmap device
- FPDF_RenderPage_Retail(pContext, page, start_x - rect.left,
- start_y - rect.top, size_x, size_y, rotate, flags);
-
- // Now output to real device
- HDC hMemDC = CreateCompatibleDC(dc);
- HGDIOBJ hOldBitmap = SelectObject(hMemDC, pContext->m_hBitmap);
-
- BitBlt(dc, rect.left, rect.top, width, height, hMemDC, 0, 0, SRCCOPY);
- SelectObject(hMemDC, hOldBitmap);
- DeleteDC(hMemDC);
-
-#endif // !defined(_WIN32_WCE)
if (bBackgroundAlphaNeeded || bHasImageMask)
delete pBitmap;
diff --git a/fpdfsdk/fsdk_rendercontext.cpp b/fpdfsdk/fsdk_rendercontext.cpp
index eb630dd60f..3ba60778a7 100644
--- a/fpdfsdk/fsdk_rendercontext.cpp
+++ b/fpdfsdk/fsdk_rendercontext.cpp
@@ -15,10 +15,6 @@ void CRenderContext::Clear() {
m_pRenderer = NULL;
m_pAnnots = NULL;
m_pOptions = NULL;
-#ifdef _WIN32_WCE
- m_pBitmap = NULL;
- m_hBitmap = NULL;
-#endif
}
CRenderContext::~CRenderContext() {
@@ -28,11 +24,6 @@ CRenderContext::~CRenderContext() {
delete m_pAnnots;
delete m_pOptions->m_pOCContext;
delete m_pOptions;
-#ifdef _WIN32_WCE
- delete m_pBitmap;
- if (m_hBitmap)
- DeleteObject(m_hBitmap);
-#endif
}
IFSDK_PAUSE_Adapter::IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause) {
@@ -42,8 +33,5 @@ IFSDK_PAUSE_Adapter::IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause) {
IFSDK_PAUSE_Adapter::~IFSDK_PAUSE_Adapter() {}
FX_BOOL IFSDK_PAUSE_Adapter::NeedToPauseNow() {
- if (m_IPause->NeedToPauseNow) {
- return m_IPause->NeedToPauseNow(m_IPause);
- }
- return FALSE;
+ return m_IPause->NeedToPauseNow && m_IPause->NeedToPauseNow(m_IPause);
}
diff --git a/fpdfsdk/include/fsdk_rendercontext.h b/fpdfsdk/include/fsdk_rendercontext.h
index 1bcd076466..c2ae45eef5 100644
--- a/fpdfsdk/include/fsdk_rendercontext.h
+++ b/fpdfsdk/include/fsdk_rendercontext.h
@@ -25,10 +25,6 @@ class CRenderContext : public CFX_Deletable {
CPDF_ProgressiveRenderer* m_pRenderer;
CPDF_AnnotList* m_pAnnots;
CPDF_RenderOptions* m_pOptions;
-#ifdef _WIN32_WCE
- CFX_DIBitmap* m_pBitmap;
- HBITMAP m_hBitmap;
-#endif
};
class IFSDK_PAUSE_Adapter : public IFX_Pause {
diff --git a/public/fpdfview.h b/public/fpdfview.h
index dad6299da5..cea431a498 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -97,11 +97,7 @@ typedef struct _FPDF_BSTR {
// For Linux/Unix programmers: most compiler/library environments use 4 bytes
// for a Unicode character, and you have to convert between FPDF_WIDESTRING and
// system wide string by yourself.
-#ifdef _WIN32_WCE
-typedef const unsigned short* FPDF_STRING;
-#else
typedef const char* FPDF_STRING;
-#endif
// Matrix for transformation.
typedef struct _FS_MATRIX_ {