summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/fsdk_define.h
blob: 29b265a428a2e1310cfa7d5239f75f6101f6240f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 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 FPDFSDK_INCLUDE_FSDK_DEFINE_H_
#define FPDFSDK_INCLUDE_FSDK_DEFINE_H_

#include "../../core/include/fpdfapi/fpdf_module.h"
#include "../../core/include/fpdfapi/fpdf_pageobj.h"
#include "../../core/include/fpdfapi/fpdf_parser.h"
#include "../../core/include/fpdfapi/fpdf_parser.h"
#include "../../core/include/fpdfapi/fpdf_render.h"
#include "../../core/include/fpdfapi/fpdf_serial.h"
#include "../../core/include/fpdfapi/fpdfapi.h"
#include "../../core/include/fpdfdoc/fpdf_doc.h"
#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"

#ifdef _WIN32
#include <tchar.h>
#include <math.h>
#endif

#ifndef FX_ARGBTOCOLORREF
/** @brief Convert a #FX_ARGB to a #FX_COLORREF. */
#define FX_ARGBTOCOLORREF(argb)		((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))
#endif

#ifndef FX_COLORREFTOARGB
/** @brief Convert a #FX_COLORREF to a #FX_ARGB. */
#define FX_COLORREFTOARGB(rgb)		((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))
#endif

typedef unsigned int FX_UINT;
class CRenderContext;
class IFSDK_PAUSE_Adapter;

class CPDF_CustomAccess final : public IFX_FileRead
{
public:
	CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
	~CPDF_CustomAccess() {}

	virtual FX_FILESIZE	GetSize() override { return m_FileAccess.m_FileLen; }

	virtual void		Release() override { delete this; }

	virtual FX_BOOL		ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;

private:
	FPDF_FILEACCESS		m_FileAccess;
};

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_