Update pdfium for windows

This commit is contained in:
Luis Ángel San Martín
2024-10-12 10:15:43 +02:00
parent b7b9e9561c
commit 442307cc65
32 changed files with 5351 additions and 2630 deletions

View File

@ -0,0 +1,86 @@
// Copyright 2017 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
#define PUBLIC_CPP_FPDF_DELETERS_H_
#include "public/fpdf_annot.h"
#include "public/fpdf_dataavail.h"
#include "public/fpdf_edit.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_javascript.h"
#include "public/fpdf_structtree.h"
#include "public/fpdf_text.h"
#include "public/fpdf_transformpage.h"
#include "public/fpdfview.h"
// Custom deleters for using FPDF_* types with std::unique_ptr<>.
struct FPDFAnnotationDeleter {
inline void operator()(FPDF_ANNOTATION annot) { FPDFPage_CloseAnnot(annot); }
};
struct FPDFAvailDeleter {
inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); }
};
struct FPDFBitmapDeleter {
inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); }
};
struct FPDFClipPathDeleter {
inline void operator()(FPDF_CLIPPATH clip_path) {
FPDF_DestroyClipPath(clip_path);
}
};
struct FPDFDocumentDeleter {
inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); }
};
struct FPDFFontDeleter {
inline void operator()(FPDF_FONT font) { FPDFFont_Close(font); }
};
struct FPDFFormHandleDeleter {
inline void operator()(FPDF_FORMHANDLE form) {
FPDFDOC_ExitFormFillEnvironment(form);
}
};
struct FPDFJavaScriptActionDeleter {
inline void operator()(FPDF_JAVASCRIPT_ACTION javascript) {
FPDFDoc_CloseJavaScriptAction(javascript);
}
};
struct FPDFPageDeleter {
inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); }
};
struct FPDFPageLinkDeleter {
inline void operator()(FPDF_PAGELINK pagelink) {
FPDFLink_CloseWebLinks(pagelink);
}
};
struct FPDFPageObjectDeleter {
inline void operator()(FPDF_PAGEOBJECT object) {
FPDFPageObj_Destroy(object);
}
};
struct FPDFStructTreeDeleter {
inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); }
};
struct FPDFTextFindDeleter {
inline void operator()(FPDF_SCHHANDLE handle) { FPDFText_FindClose(handle); }
};
struct FPDFTextPageDeleter {
inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); }
};
#endif // PUBLIC_CPP_FPDF_DELETERS_H_

View File

@ -0,0 +1,67 @@
// Copyright 2018 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PUBLIC_CPP_FPDF_SCOPERS_H_
#define PUBLIC_CPP_FPDF_SCOPERS_H_
#include <memory>
#include <type_traits>
#include "public/cpp/fpdf_deleters.h"
// Versions of FPDF types that clean up the object at scope exit.
using ScopedFPDFAnnotation =
std::unique_ptr<std::remove_pointer<FPDF_ANNOTATION>::type,
FPDFAnnotationDeleter>;
using ScopedFPDFAvail =
std::unique_ptr<std::remove_pointer<FPDF_AVAIL>::type, FPDFAvailDeleter>;
using ScopedFPDFBitmap =
std::unique_ptr<std::remove_pointer<FPDF_BITMAP>::type, FPDFBitmapDeleter>;
using ScopedFPDFClipPath =
std::unique_ptr<std::remove_pointer<FPDF_CLIPPATH>::type,
FPDFClipPathDeleter>;
using ScopedFPDFDocument =
std::unique_ptr<std::remove_pointer<FPDF_DOCUMENT>::type,
FPDFDocumentDeleter>;
using ScopedFPDFFont =
std::unique_ptr<std::remove_pointer<FPDF_FONT>::type, FPDFFontDeleter>;
using ScopedFPDFFormHandle =
std::unique_ptr<std::remove_pointer<FPDF_FORMHANDLE>::type,
FPDFFormHandleDeleter>;
using ScopedFPDFJavaScriptAction =
std::unique_ptr<std::remove_pointer<FPDF_JAVASCRIPT_ACTION>::type,
FPDFJavaScriptActionDeleter>;
using ScopedFPDFPage =
std::unique_ptr<std::remove_pointer<FPDF_PAGE>::type, FPDFPageDeleter>;
using ScopedFPDFPageLink =
std::unique_ptr<std::remove_pointer<FPDF_PAGELINK>::type,
FPDFPageLinkDeleter>;
using ScopedFPDFPageObject =
std::unique_ptr<std::remove_pointer<FPDF_PAGEOBJECT>::type,
FPDFPageObjectDeleter>;
using ScopedFPDFStructTree =
std::unique_ptr<std::remove_pointer<FPDF_STRUCTTREE>::type,
FPDFStructTreeDeleter>;
using ScopedFPDFTextFind =
std::unique_ptr<std::remove_pointer<FPDF_SCHHANDLE>::type,
FPDFTextFindDeleter>;
using ScopedFPDFTextPage =
std::unique_ptr<std::remove_pointer<FPDF_TEXTPAGE>::type,
FPDFTextPageDeleter>;
#endif // PUBLIC_CPP_FPDF_SCOPERS_H_