summaryrefslogtreecommitdiff
path: root/testing/embedder_test.h
diff options
context:
space:
mode:
Diffstat (limited to 'testing/embedder_test.h')
-rw-r--r--testing/embedder_test.h52
1 files changed, 43 insertions, 9 deletions
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index b36ac06a89..18b16b7066 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -9,6 +9,7 @@
#include <memory>
#include <string>
+#include "public/cpp/fpdf_deleters.h"
#include "public/fpdf_dataavail.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_formfill.h"
@@ -108,18 +109,52 @@ class EmbedderTest : public ::testing::Test,
// Load a specific page of the open document.
FPDF_PAGE LoadPage(int page_number);
+ // Release the resources obtained from LoadPage(). Further use of |page|
+ // is prohibited after this call is made.
+ void UnloadPage(FPDF_PAGE page);
+
// Convert a loaded page into a bitmap.
- FPDF_BITMAP RenderPage(FPDF_PAGE page);
+ // DEPRECATED. Use some one of the methods below instead.
+ FPDF_BITMAP RenderPageDeprecated(FPDF_PAGE page);
- // Convert a loaded page into a bitmap with page rendering flags specified.
+ // RenderLoadedPageWithFlags() with no flags.
+ std::unique_ptr<void, FPDFBitmapDeleter> RenderLoadedPage(FPDF_PAGE page);
+
+ // Convert |page| loaded via LoadPage() into a bitmap with the specified page
+ // rendering |flags|.
+ //
// See public/fpdfview.h for a list of page rendering flags.
- FPDF_BITMAP RenderPageWithFlags(FPDF_PAGE page,
- FPDF_FORMHANDLE handle,
- int flags);
+ std::unique_ptr<void, FPDFBitmapDeleter> RenderLoadedPageWithFlags(
+ FPDF_PAGE page,
+ int flags);
- // Relese the resources obtained from LoadPage(). Further use of |page|
- // is prohibited after this call is made.
- void UnloadPage(FPDF_PAGE page);
+ // RenderSavedPageWithFlags() with no flags.
+ std::unique_ptr<void, FPDFBitmapDeleter> RenderSavedPage(FPDF_PAGE page);
+
+ // Convert |page| loaded via LoadSavedPage() into a bitmap with the specified
+ // page rendering |flags|.
+ //
+ // See public/fpdfview.h for a list of page rendering flags.
+ std::unique_ptr<void, FPDFBitmapDeleter> RenderSavedPageWithFlags(
+ FPDF_PAGE page,
+ int flags);
+
+ // DEPRECATED. Use RenderPageWithFlags() instead.
+ // Caller takes ownership of the returned bitmap.
+ //
+ // See public/fpdfview.h for a list of page rendering flags.
+ static FPDF_BITMAP RenderPageWithFlagsDeprecated(FPDF_PAGE page,
+ FPDF_FORMHANDLE handle,
+ int flags);
+
+ // Convert |page| into a bitmap with the specified page rendering |flags|.
+ // The form handle associated with |page| should be passed in via |handle|.
+ // If |handle| is nullptr, then forms on the page will not be rendered.
+ //
+ // See public/fpdfview.h for a list of page rendering flags.
+ // If none of the above Render methods are appropriate, then use this one.
+ static std::unique_ptr<void, FPDFBitmapDeleter>
+ RenderPageWithFlags(FPDF_PAGE page, FPDF_FORMHANDLE handle, int flags);
protected:
bool OpenDocumentHelper(const char* password,
@@ -157,7 +192,6 @@ class EmbedderTest : public ::testing::Test,
FPDF_DOCUMENT OpenSavedDocument(const char* password = nullptr);
void CloseSavedDocument();
FPDF_PAGE LoadSavedPage(int page_number);
- FPDF_BITMAP RenderSavedPage(FPDF_PAGE page);
void CloseSavedPage(FPDF_PAGE page);
void VerifySavedRendering(FPDF_PAGE page,
int width,