summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-02-07 20:28:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-07 20:28:35 +0000
commita98e36657d0e5a78e216f828b3e712e85250c1a7 (patch)
tree4621be8a3be00efafe28eea4639b87675db80d2b /fpdfsdk
parent2496f8e3f3cb1cbfffd664c9b5d7983dc192887b (diff)
downloadpdfium-a98e36657d0e5a78e216f828b3e712e85250c1a7.tar.xz
Clean up RenderPage methods in EmbedderTest.
Add replacement methods that make themselves clear as to what they are rendering, and return unique_ptrs to help prevent leakage. Mark existing methods deprecated. Change-Id: I9055407e614dfbe765428fb32a7da64df3418d1d Reviewed-on: https://pdfium-review.googlesource.com/25470 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfannot_embeddertest.cpp45
-rw-r--r--fpdfsdk/fpdfedit_embeddertest.cpp43
-rw-r--r--fpdfsdk/fpdfformfill_embeddertest.cpp6
-rw-r--r--fpdfsdk/fpdfppo_embeddertest.cpp8
-rw-r--r--fpdfsdk/fpdfsave_embeddertest.cpp12
-rw-r--r--fpdfsdk/fpdfview_embeddertest.cpp4
6 files changed, 62 insertions, 56 deletions
diff --git a/fpdfsdk/fpdfannot_embeddertest.cpp b/fpdfsdk/fpdfannot_embeddertest.cpp
index ba9bbe0ea9..5b5c29717b 100644
--- a/fpdfsdk/fpdfannot_embeddertest.cpp
+++ b/fpdfsdk/fpdfannot_embeddertest.cpp
@@ -38,9 +38,9 @@ TEST_F(FPDFAnnotEmbeddertest, RenderAnnotWithOnlyRolloverAP) {
// normal appearance defined, only its rollover appearance. In this case, its
// normal appearance should be generated, allowing the highlight annotation to
// still display.
- FPDF_BITMAP bitmap = RenderPageWithFlags(page, form_handle(), FPDF_ANNOT);
- CompareBitmap(bitmap, 612, 792, "dc98f06da047bd8aabfa99562d2cbd1e");
- FPDFBitmap_Destroy(bitmap);
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap =
+ RenderLoadedPageWithFlags(page, FPDF_ANNOT);
+ CompareBitmap(bitmap.get(), 612, 792, "dc98f06da047bd8aabfa99562d2cbd1e");
UnloadPage(page);
}
@@ -356,7 +356,8 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyRectQuadpointsWithAP) {
EXPECT_EQ(4, FPDFPage_GetAnnotCount(page));
// Check that the original file renders correctly.
- FPDF_BITMAP bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ FPDF_BITMAP bitmap =
+ RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, md5_original);
FPDFBitmap_Destroy(bitmap);
@@ -396,7 +397,7 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyRectQuadpointsWithAP) {
EXPECT_EQ(quadpoints.y4, new_quadpoints.y4);
// Check that updating quadpoints does not change the annotation's position.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, md5_original);
FPDFBitmap_Destroy(bitmap);
@@ -416,7 +417,7 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyRectQuadpointsWithAP) {
}
// Check that updating the rectangle changes the annotation's position.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, md5_modified_highlight);
FPDFBitmap_Destroy(bitmap);
@@ -437,7 +438,7 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyRectQuadpointsWithAP) {
// Check that updating the rectangle changes the square annotation's
// position.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, md5_modified_square);
FPDFBitmap_Destroy(bitmap);
}
@@ -546,7 +547,8 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyPath) {
EXPECT_EQ(2, FPDFPage_GetAnnotCount(page));
// Check that the page renders correctly.
- FPDF_BITMAP bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ FPDF_BITMAP bitmap =
+ RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_original);
FPDFBitmap_Destroy(bitmap);
@@ -569,7 +571,7 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyPath) {
EXPECT_TRUE(FPDFAnnot_UpdateObject(annot.get(), path));
// Check that the page with the modified annotation renders correctly.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_modified_path);
FPDFBitmap_Destroy(bitmap);
@@ -583,7 +585,7 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyPath) {
EXPECT_EQ(2, FPDFAnnot_GetObjectCount(annot.get()));
// Check that the page with an annotation with two paths renders correctly.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_two_paths);
FPDFBitmap_Destroy(bitmap);
@@ -593,7 +595,7 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyPath) {
}
// Check that the page renders the same as before.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_modified_path);
FPDFBitmap_Destroy(bitmap);
@@ -669,7 +671,8 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyAnnotationFlags) {
ASSERT_TRUE(page);
// Check that the page renders correctly.
- FPDF_BITMAP bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ FPDF_BITMAP bitmap =
+ RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, "dc98f06da047bd8aabfa99562d2cbd1e");
FPDFBitmap_Destroy(bitmap);
@@ -692,7 +695,7 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyAnnotationFlags) {
EXPECT_TRUE(flags & FPDF_ANNOT_FLAG_PRINT);
// Check that the page renders correctly without rendering the annotation.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
FPDFBitmap_Destroy(bitmap);
@@ -706,7 +709,7 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyAnnotationFlags) {
EXPECT_TRUE(flags & FPDF_ANNOT_FLAG_PRINT);
// Check that the page renders correctly as before.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 612, 792, "dc98f06da047bd8aabfa99562d2cbd1e");
FPDFBitmap_Destroy(bitmap);
}
@@ -732,7 +735,8 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyImage) {
EXPECT_EQ(2, FPDFPage_GetAnnotCount(page));
// Check that the page renders correctly.
- FPDF_BITMAP bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ FPDF_BITMAP bitmap =
+ RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_original);
FPDFBitmap_Destroy(bitmap);
@@ -766,7 +770,7 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyImage) {
}
// Check that the page renders correctly with the new image object.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_new_image);
FPDFBitmap_Destroy(bitmap);
@@ -813,7 +817,8 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyText) {
EXPECT_EQ(2, FPDFPage_GetAnnotCount(page));
// Check that the page renders correctly.
- FPDF_BITMAP bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ FPDF_BITMAP bitmap =
+ RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_original);
FPDFBitmap_Destroy(bitmap);
@@ -842,7 +847,7 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyText) {
}
// Check that the page renders correctly with the new text object.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_new_text);
FPDFBitmap_Destroy(bitmap);
@@ -863,13 +868,13 @@ TEST_F(FPDFAnnotEmbeddertest, AddAndModifyText) {
}
// Check that the page renders correctly with the modified text object.
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_modified_text);
FPDFBitmap_Destroy(bitmap);
// Remove the new annotation, and check that the page renders as before.
EXPECT_TRUE(FPDFPage_RemoveAnnot(page, 2));
- bitmap = RenderPageWithFlags(page, form_handle_, FPDF_ANNOT);
+ bitmap = RenderPageWithFlagsDeprecated(page, form_handle_, FPDF_ANNOT);
CompareBitmap(bitmap, 595, 842, md5_original);
FPDFBitmap_Destroy(bitmap);
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index 1a422bd941..f388107708 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -197,7 +197,7 @@ TEST_F(FPDFEditEmbeddertest, RasterizePDF) {
EXPECT_TRUE(OpenDocument("black.pdf"));
FPDF_PAGE orig_page = LoadPage(0);
EXPECT_NE(nullptr, orig_page);
- orig_bitmap = RenderPage(orig_page);
+ orig_bitmap = RenderPageDeprecated(orig_page);
CompareBitmap(orig_bitmap, 612, 792, kAllBlackMd5sum);
UnloadPage(orig_page);
}
@@ -241,7 +241,7 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_SetFillColor(red_rect, 255, 0, 0, 255));
EXPECT_TRUE(FPDFPath_SetDrawMode(red_rect, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, red_rect);
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "66d02eaa6181e2c069ce2ea99beda497");
FPDFBitmap_Destroy(page_bitmap);
@@ -302,7 +302,7 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_SetDrawMode(green_rect, FPDF_FILLMODE_WINDING, 0));
FPDFPage_InsertObject(page, green_rect);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "7b0b87604594e773add528fae567a558");
FPDFBitmap_Destroy(page_bitmap);
@@ -340,7 +340,7 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_EQ(nullptr, FPDFPath_GetPathSegment(black_path, 3));
FPDFPage_InsertObject(page, black_path);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "eadc8020a14dfcf091da2688733d8806");
FPDFBitmap_Destroy(page_bitmap);
@@ -355,7 +355,7 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_BezierTo(blue_path, 375, 330, 390, 360, 400, 400));
EXPECT_TRUE(FPDFPath_Close(blue_path));
FPDFPage_InsertObject(page, blue_path);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
const char last_md5[] = "9823e1a21bd9b72b6a442ba4f12af946";
CompareBitmap(page_bitmap, 612, 792, last_md5);
FPDFBitmap_Destroy(page_bitmap);
@@ -418,7 +418,7 @@ TEST_F(FPDFEditEmbeddertest, PathOnTopOfText) {
FPDFPage_InsertObject(page, black_path);
// Render and check the result. Text is slightly different on Mac.
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5[] = "f9e6fa74230f234286bfcada9f7606d8";
#else
@@ -447,7 +447,7 @@ TEST_F(FPDFEditEmbeddertest, EditOverExistingContent) {
EXPECT_TRUE(FPDFPath_SetDrawMode(red_rect, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, red_rect);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 612, 792, "ad04e5bd0f471a9a564fb034bd0fb073");
FPDFBitmap_Destroy(bitmap);
EXPECT_TRUE(FPDFPage_GenerateContent(page));
@@ -472,7 +472,8 @@ TEST_F(FPDFEditEmbeddertest, EditOverExistingContent) {
EXPECT_TRUE(FPDFPath_SetFillColor(green_rect2, 0, 255, 0, 100));
EXPECT_TRUE(FPDFPath_SetDrawMode(green_rect2, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, green_rect2);
- FPDF_BITMAP new_bitmap = RenderPageWithFlags(page, saved_form_handle_, 0);
+ FPDF_BITMAP new_bitmap =
+ RenderPageWithFlagsDeprecated(page, saved_form_handle_, 0);
const char last_md5[] = "4b5b00f824620f8c9b8801ebb98e1cdd";
CompareBitmap(new_bitmap, 612, 792, last_md5);
FPDFBitmap_Destroy(new_bitmap);
@@ -499,7 +500,7 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetStrokeWidth(rect, 15.0f));
EXPECT_TRUE(FPDFPath_SetDrawMode(rect, 0, 1));
FPDFPage_InsertObject(page, rect);
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "64bd31f862a89e0a9e505a5af6efd506");
FPDFBitmap_Destroy(page_bitmap);
@@ -513,7 +514,7 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetStrokeWidth(check, 8.35f));
EXPECT_TRUE(FPDFPath_SetDrawMode(check, 0, 1));
FPDFPage_InsertObject(page, check);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "4b6f3b9d25c4e194821217d5016c3724");
FPDFBitmap_Destroy(page_bitmap);
@@ -528,7 +529,7 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetStrokeWidth(path, 10.5f));
EXPECT_TRUE(FPDFPath_SetDrawMode(path, FPDF_FILLMODE_ALTERNATE, 1));
FPDFPage_InsertObject(page, path);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "ff3e6a22326754944cc6e56609acd73b");
FPDFBitmap_Destroy(page_bitmap);
FPDF_ClosePage(page);
@@ -547,7 +548,7 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object1, text1.get()));
FPDFPageObj_Transform(text_object1, 1, 0, 0, 1, 20, 20);
FPDFPage_InsertObject(page, text_object1);
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
#else
@@ -565,7 +566,7 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object2, text2.get()));
FPDFPageObj_Transform(text_object2, 1, 0, 0, 1, 100, 600);
FPDFPage_InsertObject(page, text_object2);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5_2[] = "a5c4ace4c6f27644094813fe1441a21c";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
@@ -585,7 +586,7 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object3, text3.get()));
FPDFPageObj_Transform(text_object3, 1, 1.5, 2, 0.5, 200, 200);
FPDFPage_InsertObject(page, text_object3);
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5_3[] = "40b3ef04f915ff4c4208948001763544";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
@@ -674,7 +675,7 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) {
EXPECT_EQ(2, static_cast<int>(graphics_dict->GetCount()));
// Check the bitmap
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "5384da3406d62360ffb5cac4476fff1c");
FPDFBitmap_Destroy(page_bitmap);
@@ -684,14 +685,14 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) {
EXPECT_EQ(3, static_cast<int>(graphics_dict->GetCount()));
// Check that bitmap displays changed content
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "2e51656f5073b0bee611d9cd086aa09c");
FPDFBitmap_Destroy(page_bitmap);
// And now generate, without changes
EXPECT_TRUE(FPDFPage_GenerateContent(page));
EXPECT_EQ(3, static_cast<int>(graphics_dict->GetCount()));
- page_bitmap = RenderPage(page);
+ page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, "2e51656f5073b0bee611d9cd086aa09c");
FPDFBitmap_Destroy(page_bitmap);
@@ -888,7 +889,7 @@ TEST_F(FPDFEditEmbeddertest, AddTrueTypeFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object, text.get()));
FPDFPageObj_Transform(text_object, 1, 0, 0, 1, 400, 400);
FPDFPage_InsertObject(page, text_object);
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";
#else
@@ -906,7 +907,7 @@ TEST_F(FPDFEditEmbeddertest, AddTrueTypeFontText) {
FPDFPageObj_Transform(text_object2, 1, 0, 0, 1, 200, 200);
FPDFPage_InsertObject(page, text_object2);
}
- FPDF_BITMAP page_bitmap2 = RenderPage(page);
+ FPDF_BITMAP page_bitmap2 = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5_2[] = "8eded4193ff1f0f77b8b600a825e97ea";
#else
@@ -985,7 +986,7 @@ TEST_F(FPDFEditEmbeddertest, AddCIDFontText) {
}
// Check that the text renders properly.
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
const char md5[] = "c68cd79aa72bf83a7b25271370d46b21";
CompareBitmap(page_bitmap, 612, 792, md5);
FPDFBitmap_Destroy(page_bitmap);
@@ -1018,7 +1019,7 @@ TEST_F(FPDFEditEmbeddertest, SaveAndRender) {
EXPECT_TRUE(FPDFPath_BezierTo(green_path, 38, 33, 39, 36, 40, 40));
EXPECT_TRUE(FPDFPath_Close(green_path));
FPDFPage_InsertObject(page, green_path);
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, md5);
FPDFBitmap_Destroy(page_bitmap);
diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp
index ae1c02ede1..8b81467822 100644
--- a/fpdfsdk/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/fpdfformfill_embeddertest.cpp
@@ -532,7 +532,7 @@ TEST_F(FPDFFormFillEmbeddertest, FormText) {
EXPECT_TRUE(OpenDocument("text_form.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap1(RenderPage(page));
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap1 = RenderLoadedPage(page);
CompareBitmap(bitmap1.get(), 300, 300, md5_1);
// Click on the textfield
@@ -546,14 +546,14 @@ TEST_F(FPDFFormFillEmbeddertest, FormText) {
FORM_OnChar(form_handle(), page, 65, 0);
FORM_OnChar(form_handle(), page, 66, 0);
FORM_OnChar(form_handle(), page, 67, 0);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap2(RenderPage(page));
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap2 = RenderLoadedPage(page);
CompareBitmap(bitmap2.get(), 300, 300, md5_2);
// Take out focus by clicking out of the textfield
FORM_OnMouseMove(form_handle(), page, 0, 15.0, 15.0);
FORM_OnLButtonDown(form_handle(), page, 0, 15.0, 15.0);
FORM_OnLButtonUp(form_handle(), page, 0, 15.0, 15.0);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap3(RenderPage(page));
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap3 = RenderLoadedPage(page);
CompareBitmap(bitmap3.get(), 300, 300, md5_3);
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
diff --git a/fpdfsdk/fpdfppo_embeddertest.cpp b/fpdfsdk/fpdfppo_embeddertest.cpp
index 2a4c774bae..0b3463e391 100644
--- a/fpdfsdk/fpdfppo_embeddertest.cpp
+++ b/fpdfsdk/fpdfppo_embeddertest.cpp
@@ -217,7 +217,7 @@ TEST_F(FPDFPPOEmbeddertest, BUG_750568) {
FPDF_PAGE page = LoadPage(i);
ASSERT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap));
ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap));
ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap));
@@ -236,7 +236,7 @@ TEST_F(FPDFPPOEmbeddertest, BUG_750568) {
FPDF_PAGE page = FPDF_LoadPage(output_doc, i);
ASSERT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap));
ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap));
ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap));
@@ -254,7 +254,7 @@ TEST_F(FPDFPPOEmbeddertest, ImportWithZeroLengthStream) {
FPDF_PAGE page = LoadPage(0);
ASSERT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap));
ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap));
ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap));
@@ -270,7 +270,7 @@ TEST_F(FPDFPPOEmbeddertest, ImportWithZeroLengthStream) {
EXPECT_EQ(1, FPDF_GetPageCount(new_doc));
FPDF_PAGE new_page = FPDF_LoadPage(new_doc, 0);
ASSERT_NE(nullptr, new_page);
- FPDF_BITMAP new_bitmap = RenderPage(new_page);
+ FPDF_BITMAP new_bitmap = RenderPageDeprecated(new_page);
ASSERT_EQ(200, FPDFBitmap_GetWidth(new_bitmap));
ASSERT_EQ(200, FPDFBitmap_GetHeight(new_bitmap));
ASSERT_EQ(800, FPDFBitmap_GetStride(new_bitmap));
diff --git a/fpdfsdk/fpdfsave_embeddertest.cpp b/fpdfsdk/fpdfsave_embeddertest.cpp
index 3122be1b53..bbf7566b1c 100644
--- a/fpdfsdk/fpdfsave_embeddertest.cpp
+++ b/fpdfsdk/fpdfsave_embeddertest.cpp
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "public/fpdf_save.h"
-
+#include <memory>
#include <string>
#include "core/fxcrt/fx_string.h"
#include "public/fpdf_edit.h"
#include "public/fpdf_ppo.h"
+#include "public/fpdf_save.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
@@ -66,7 +66,7 @@ TEST_F(FPDFSaveEmbedderTest, SaveLinearizedDoc) {
EXPECT_TRUE(OpenDocument("linearized.pdf"));
for (int i = 0; i < kPageCount; ++i) {
FPDF_PAGE page = LoadPage(i);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
EXPECT_EQ(612, FPDFBitmap_GetWidth(bitmap));
EXPECT_EQ(792, FPDFBitmap_GetHeight(bitmap));
original_md5[i] = HashBitmap(bitmap);
@@ -84,9 +84,9 @@ TEST_F(FPDFSaveEmbedderTest, SaveLinearizedDoc) {
EXPECT_TRUE(OpenSavedDocument());
for (int i = 0; i < kPageCount; ++i) {
FPDF_PAGE page = LoadSavedPage(i);
- FPDF_BITMAP bitmap = RenderSavedPage(page);
- EXPECT_EQ(original_md5[i], HashBitmap(bitmap));
- FPDFBitmap_Destroy(bitmap);
+ ASSERT_TRUE(page);
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderSavedPage(page);
+ EXPECT_EQ(original_md5[i], HashBitmap(bitmap.get()));
CloseSavedPage(page);
}
CloseSavedDocument();
diff --git a/fpdfsdk/fpdfview_embeddertest.cpp b/fpdfsdk/fpdfview_embeddertest.cpp
index 47d02235ef..c46b3bd14f 100644
--- a/fpdfsdk/fpdfview_embeddertest.cpp
+++ b/fpdfsdk/fpdfview_embeddertest.cpp
@@ -429,14 +429,14 @@ TEST_F(FPDFViewEmbeddertest, FPDF_RenderPageBitmapWithMatrix) {
EXPECT_EQ(200, page_width);
EXPECT_EQ(300, page_height);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, page_width, page_height, kOriginalMD5);
FPDFBitmap_Destroy(bitmap);
FS_RECTF page_rect{0, 0, page_width, page_height};
// Try rendering with an identity matrix. The output should be the same as
- // the RenderPage() output.
+ // the RenderPageDeprecated() output.
FS_MATRIX identity_matrix{1, 0, 0, 1, 0, 0};
TestRenderPageBitmapWithMatrix(page, page_width, page_height, identity_matrix,
page_rect, kOriginalMD5);