summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-15 15:30:18 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-15 15:30:18 -0700
commite3db14f4d0e11ed30bd7e014ffa8cea9d6fb93ad (patch)
treeda2f8308537c983db0bf14f10c515263501639a6
parent97dd3fec106ac8a945e03ed1509af0a8b73da993 (diff)
downloadpdfium-e3db14f4d0e11ed30bd7e014ffa8cea9d6fb93ad.tar.xz
Kill Func_Renderpage global function pointer, it never changes.
Kill some unused macros along the way, and put prototypes in header files. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1233203004 .
-rw-r--r--fpdfsdk/include/fsdk_define.h42
-rw-r--r--fpdfsdk/src/fpdf_progressive.cpp8
-rw-r--r--fpdfsdk/src/fpdfview.cpp24
3 files changed, 24 insertions, 50 deletions
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index f809043417..29b265a428 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -7,11 +7,6 @@
#ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_
#define FPDFSDK_INCLUDE_FSDK_DEFINE_H_
-#ifdef _WIN32
-#include <tchar.h>
-#include <math.h>
-#endif
-
#include "../../core/include/fpdfapi/fpdf_module.h"
#include "../../core/include/fpdfapi/fpdf_pageobj.h"
#include "../../core/include/fpdfapi/fpdf_parser.h"
@@ -23,26 +18,11 @@
#include "../../core/include/fpdfdoc/fpdf_vt.h"
#include "../../core/include/fxge/fx_ge.h"
#include "../../core/include/fxge/fx_ge_win32.h"
+#include "../../public/fpdfview.h"
-
-#ifndef FX_GetAValue
-/** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */
-#define FX_GetAValue(argb) ((argb & 0xFF000000) >> 24)
-#endif
-
-#ifndef FX_GetRValue
-/** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */
-#define FX_GetRValue(argb) ((argb & 0x00FF0000) >> 16)
-#endif
-
-#ifndef FX_GetGValue
-/** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */
-#define FX_GetGValue(argb) ((argb & 0x0000FF00) >> 8)
-#endif
-
-#ifndef FX_GetBValue
-/** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */
-#define FX_GetBValue(argb) (argb & 0x000000FF)
+#ifdef _WIN32
+#include <tchar.h>
+#include <math.h>
#endif
#ifndef FX_ARGBTOCOLORREF
@@ -56,8 +36,8 @@
#endif
typedef unsigned int FX_UINT;
-
-#include "../../public/fpdfview.h"
+class CRenderContext;
+class IFSDK_PAUSE_Adapter;
class CPDF_CustomAccess final : public IFX_FileRead
{
@@ -75,8 +55,12 @@ private:
FPDF_FILEACCESS m_FileAccess;
};
-void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
-FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
-
+void DropContext(void* data);
+void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
+FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
+void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page,
+ int start_x, int start_y, int size_x, int size_y,
+ int rotate, int flags, FX_BOOL bNeedToRestore,
+ IFSDK_PAUSE_Adapter* pause);
#endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_
diff --git a/fpdfsdk/src/fpdf_progressive.cpp b/fpdfsdk/src/fpdf_progressive.cpp
index f13ef9ac54..aab1cb6163 100644
--- a/fpdfsdk/src/fpdf_progressive.cpp
+++ b/fpdfsdk/src/fpdf_progressive.cpp
@@ -9,11 +9,6 @@
#include "../include/fsdk_define.h"
#include "../include/fsdk_rendercontext.h"
-extern void (*Func_RenderPage)( CRenderContext*, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, int flags,FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter * pause );
-
-extern void DropContext(void* data);
-
DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start( FPDF_BITMAP bitmap, FPDF_PAGE page,
int start_x, int start_y, int size_x,
int size_y, int rotate, int flags,
@@ -46,7 +41,8 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start( FPDF_BITMAP bitmap, FPDF_PAGE
#endif
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
- Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,FALSE, &IPauseAdapter);
+ FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
+ rotate, flags,FALSE, &IPauseAdapter);
if ( pContext->m_pRenderer )
{
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 9db0554ab3..7dc59473cc 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -324,11 +324,6 @@ void DropContext(void* data)
delete (CRenderContext*)data;
}
-void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, int flags,FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter * pause );
-void (*Func_RenderPage)(CRenderContext*, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, int flags,FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter * pause ) = FPDF_RenderPage_Retail;
-
#if defined(_DEBUG) || defined(DEBUG)
#define DEBUG_TRACE
#endif
@@ -364,7 +359,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
else
pContext->m_pDevice = new CFX_WindowsDevice(dc);
- Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
+ FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
+ rotate, flags, TRUE, NULL);
if (bBackgroundAlphaNeeded)
{
@@ -447,7 +443,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
#endif
// output to bitmap device
- Func_RenderPage(pContext, page, start_x - rect.left, start_y - rect.top, size_x, size_y, rotate, flags);
+ FPDF_RenderPage_Retail(pContext, page, start_x - rect.left,
+ start_y - rect.top, size_x, size_y, rotate, flags);
#ifdef DEBUG_TRACE
CPDF_ModuleMgr::Get()->ReportError(999, "Finished PDF rendering");
@@ -515,7 +512,8 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page,
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#endif
- Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
+ FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
+ rotate, flags, TRUE, NULL);
delete pContext;
pPage->RemovePrivateData((void*)1);
@@ -545,7 +543,6 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document)
return;
}
delete pParser;
-// delete pDoc;
}
DLLEXPORT unsigned long STDCALL FPDF_GetLastError()
@@ -664,14 +661,14 @@ DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap)
}
void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, int flags,FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter * pause )
+ int rotate, int flags,FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter * pause )
{
CPDF_Page* pPage = (CPDF_Page*)page;
if (pPage == NULL) return;
if (!pContext->m_pOptions)
pContext->m_pOptions = new CPDF_RenderOptions;
-// CPDF_RenderOptions options;
+
if (flags & FPDF_LCD_TEXT)
pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE;
else
@@ -696,12 +693,9 @@ void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_
pContext->m_pOptions->m_BackColor = 0xffffff;
}
const CPDF_OCContext::UsageType usage = (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View;
-
pContext->m_pOptions->m_AddFlags = flags >> 8;
-
pContext->m_pOptions->m_pOCContext = new CPDF_OCContext(pPage->m_pDocument, usage);
-
CFX_AffineMatrix matrix;
pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
@@ -727,7 +721,7 @@ void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_
pContext->m_pRenderer->Start(pContext->m_pContext, pContext->m_pDevice, pContext->m_pOptions, pause);
if (bNeedToRestore)
{
- pContext->m_pDevice->RestoreState();
+ pContext->m_pDevice->RestoreState();
}
}